--- linuxsampler/trunk/src/engines/common/Event.h 2017/05/24 11:06:28 3204 +++ linuxsampler/trunk/src/engines/common/Event.h 2017/05/24 20:05:38 3205 @@ -350,7 +350,13 @@ */ template void EventGenerator::scheduleAheadMicroSec(RTAVLTree& queue, T& node, int32_t fragmentPosBase, uint64_t microseconds) { - node.scheduleTime = uiTotalSamplesProcessed + fragmentPosBase + float(uiSampleRate) * (float(microseconds) / 1000000.f); + // round up (+1) if microseconds is not zero (i.e. because 44.1 kHz and + // 1 us would yield in < 1 and thus would be offset == 0) + const sched_time_t offset = + (microseconds != 0LL) ? + 1.f + (float(uiSampleRate) * (float(microseconds) / 1000000.f)) + : 0.f; + node.scheduleTime = uiTotalSamplesProcessed + fragmentPosBase + offset; queue.insert(node); }