> "am I on a beat" code -- probably buggily

that's weird, because the loop code is failing because it's not detecting that it's on a beat.  It's setting the in point to "prev beat," and when it's on a beat that goes to the previous beat, which is wrong.  I'd prefer not to change every other instance of Beats, but then how do I fix the looping control?  My previous solution was "if dSamples == nextbeat then use nextbeat as loop in"