SampleBuffer: fix a segfault when moving a loop point while playing a no...

...te, also do some sptring cleanup (some unused/redundant variables removed)

Also, some codepath optimization: add a method to SampleBuffer for setting all loop/start/endpoints at once, so we don't have to wait for mutex unlocks 4 times in a row. Then make AFP utilize this method.