150 |
MaxRAMPos = cachedsamples - (pEngine->MaxSamplesPerCycle << CONFIG_MAX_PITCH) / pSample->Channels; //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) |
MaxRAMPos = cachedsamples - (pEngine->MaxSamplesPerCycle << CONFIG_MAX_PITCH) / pSample->Channels; //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) |
151 |
|
|
152 |
// check if there's a loop defined which completely fits into the cached (RAM) part of the sample |
// check if there's a loop defined which completely fits into the cached (RAM) part of the sample |
153 |
if (pSample->Loops && pSample->LoopEnd <= MaxRAMPos) { |
RAMLoop = (pSample->Loops && pSample->LoopEnd <= MaxRAMPos); |
|
RAMLoop = true; |
|
|
loop.uiTotalCycles = pSample->LoopPlayCount; |
|
|
loop.uiCyclesLeft = pSample->LoopPlayCount; |
|
|
loop.uiStart = pSample->LoopStart; |
|
|
loop.uiEnd = pSample->LoopEnd; |
|
|
loop.uiSize = pSample->LoopSize; |
|
|
} |
|
|
else RAMLoop = false; |
|
154 |
|
|
155 |
if (pDiskThread->OrderNewStream(&DiskStreamRef, pSample, MaxRAMPos, !RAMLoop) < 0) { |
if (pDiskThread->OrderNewStream(&DiskStreamRef, pSample, MaxRAMPos, !RAMLoop) < 0) { |
156 |
dmsg(1,("Disk stream order failed!\n")); |
dmsg(1,("Disk stream order failed!\n")); |
161 |
} |
} |
162 |
else { // RAM only voice |
else { // RAM only voice |
163 |
MaxRAMPos = cachedsamples; |
MaxRAMPos = cachedsamples; |
164 |
if (pSample->Loops) { |
RAMLoop = (pSample->Loops != 0); |
|
RAMLoop = true; |
|
|
loop.uiCyclesLeft = pSample->LoopPlayCount; |
|
|
} |
|
|
else RAMLoop = false; |
|
165 |
dmsg(4,("RAM only voice launched (Looping: %s)\n", (RAMLoop) ? "yes" : "no")); |
dmsg(4,("RAM only voice launched (Looping: %s)\n", (RAMLoop) ? "yes" : "no")); |
166 |
} |
} |
167 |
|
if (RAMLoop) { |
168 |
|
loop.uiTotalCycles = pSample->LoopPlayCount; |
169 |
|
loop.uiCyclesLeft = pSample->LoopPlayCount; |
170 |
|
loop.uiStart = pSample->LoopStart; |
171 |
|
loop.uiEnd = pSample->LoopEnd; |
172 |
|
loop.uiSize = pSample->LoopSize; |
173 |
|
} |
174 |
|
|
175 |
// calculate initial pitch value |
// calculate initial pitch value |
176 |
{ |
{ |