Need pointers on fixing audio timing issues

    Dec 20 2012 | 11:33 pm
    I will not post my patcher here now because I would need to isolate the parts that are related to my issue, I'm not looking for someone to fix my code anyway, I have to rebuild this and I want to do it the right way.
    I have a looper that records a bar and the way I trigger when its recording is quantized. I think the easiest way to explain this is to say that I am remaking the clip recording of Ableton Live. In other words, I press the button, the looper enters "waiting mode" it waits for a 1 from my clock, once this condition is met, it records a bar to buffer, crop the buffer, saves the buffer. I know this part works fine so I believe my issue is syncing the sound source with that clock. The clock used for the looper is actually slaved to a midi clock coming from a drum machine, that drum machine is also my sound source.
    What are good ways to make sure everything stays perfectly in sync when using max with midi hardware?
    Thanks for your insights.