--- linuxsampler/trunk/src/engines/common/AbstractVoice.cpp 2011/07/23 10:23:35 2215 +++ linuxsampler/trunk/src/engines/common/AbstractVoice.cpp 2011/07/25 17:21:16 2216 @@ -135,13 +135,12 @@ PanLeftSmoother.trigger(pEngineChannel->GlobalPanLeft, subfragmentRate); PanRightSmoother.trigger(pEngineChannel->GlobalPanRight, subfragmentRate); - finalSynthesisParameters.dPos = RgnInfo.SampleStartOffset; // offset where we should start playback of sample (0 - 2000 sample points) - Pos = RgnInfo.SampleStartOffset; - // Check if the sample needs disk streaming or is too short for that long cachedsamples = GetSampleCacheSize() / SmplInfo.FrameSize; DiskVoice = cachedsamples < SmplInfo.TotalFrameCount; + SetSampleStartOffset(); + if (DiskVoice) { // voice to be streamed from disk if (cachedsamples > (GetEngine()->MaxSamplesPerCycle << CONFIG_MAX_PITCH)) { MaxRAMPos = cachedsamples - (GetEngine()->MaxSamplesPerCycle << CONFIG_MAX_PITCH) / SmplInfo.ChannelCount; //TODO: this calculation is too pessimistic and may better be moved to Render() method, so it calculates MaxRAMPos dependent to the current demand of sample points to be rendered (e.g. in case of JACK) @@ -295,6 +294,11 @@ return 0; // success } + + void AbstractVoice::SetSampleStartOffset() { + finalSynthesisParameters.dPos = RgnInfo.SampleStartOffset; // offset where we should start playback of sample (0 - 2000 sample points) + Pos = RgnInfo.SampleStartOffset; + } /** * Synthesizes the current audio fragment for this voice.