61 |
|
|
62 |
// select synthesis implementation (currently either pure C++ or MMX+SSE(1)) |
// select synthesis implementation (currently either pure C++ or MMX+SSE(1)) |
63 |
SYNTHESIS_MODE_SET_IMPLEMENTATION(SynthesisMode, Features::supportsMMX() && Features::supportsSSE()); |
SYNTHESIS_MODE_SET_IMPLEMENTATION(SynthesisMode, Features::supportsMMX() && Features::supportsSSE()); |
64 |
|
SYNTHESIS_MODE_SET_PROFILING(SynthesisMode, true); |
65 |
} |
} |
66 |
|
|
67 |
Voice::~Voice() { |
Voice::~Voice() { |
694 |
} |
} |
695 |
DiskStreamRef.pStream->IncrementReadPos(pSample->Channels * (int(Pos) - MaxRAMPos)); |
DiskStreamRef.pStream->IncrementReadPos(pSample->Channels * (int(Pos) - MaxRAMPos)); |
696 |
Pos -= int(Pos); |
Pos -= int(Pos); |
697 |
|
RealSampleWordsLeftToRead = -1; // -1 means no silence has been added yet |
698 |
} |
} |
699 |
|
|
700 |
const int sampleWordsLeftToRead = DiskStreamRef.pStream->GetReadSpace(); |
const int sampleWordsLeftToRead = DiskStreamRef.pStream->GetReadSpace(); |
703 |
if (DiskStreamRef.State == Stream::state_end) { |
if (DiskStreamRef.State == Stream::state_end) { |
704 |
const int maxSampleWordsPerCycle = (pEngine->MaxSamplesPerCycle << MAX_PITCH) * pSample->Channels + 6; // +6 for the interpolator algorithm |
const int maxSampleWordsPerCycle = (pEngine->MaxSamplesPerCycle << MAX_PITCH) * pSample->Channels + 6; // +6 for the interpolator algorithm |
705 |
if (sampleWordsLeftToRead <= maxSampleWordsPerCycle) { |
if (sampleWordsLeftToRead <= maxSampleWordsPerCycle) { |
706 |
|
// remember how many sample words there are before any silence has been added |
707 |
|
if (RealSampleWordsLeftToRead < 0) RealSampleWordsLeftToRead = sampleWordsLeftToRead; |
708 |
DiskStreamRef.pStream->WriteSilence(maxSampleWordsPerCycle - sampleWordsLeftToRead); |
DiskStreamRef.pStream->WriteSilence(maxSampleWordsPerCycle - sampleWordsLeftToRead); |
709 |
} |
} |
710 |
} |
} |
720 |
Pos -= iPos; // just keep fractional part of Pos |
Pos -= iPos; // just keep fractional part of Pos |
721 |
|
|
722 |
// change state of voice to 'end' if we really reached the end of the sample data |
// change state of voice to 'end' if we really reached the end of the sample data |
723 |
if (DiskStreamRef.State == Stream::state_end && readSampleWords >= sampleWordsLeftToRead) this->PlaybackState = playback_state_end; |
if (RealSampleWordsLeftToRead >= 0) { |
724 |
|
RealSampleWordsLeftToRead -= readSampleWords; |
725 |
|
if (RealSampleWordsLeftToRead <= 0) this->PlaybackState = playback_state_end; |
726 |
|
} |
727 |
} |
} |
728 |
break; |
break; |
729 |
|
|
986 |
* @param pSrc - pointer to input sample data |
* @param pSrc - pointer to input sample data |
987 |
* @param Skip - number of sample points to skip in output buffer |
* @param Skip - number of sample points to skip in output buffer |
988 |
*/ |
*/ |
989 |
void Voice::Synthesize(uint Samples, sample_t* pSrc, int Skip) { |
void Voice::Synthesize(uint Samples, sample_t* pSrc, uint Skip) { |
990 |
UpdateSynthesisMode(); |
RunSynthesisFunction(SynthesisMode, *this, Samples, pSrc, Skip); |
|
SynthesizeFragment_Fn* f = (SynthesizeFragment_Fn*) SynthesizeFragmentFnPtr; |
|
|
f(*this, Samples, pSrc, Skip); |
|
|
} |
|
|
|
|
|
/** |
|
|
* Determine the respective synthesis function for the given synthesis |
|
|
* mode. |
|
|
*/ |
|
|
void Voice::UpdateSynthesisMode() { |
|
|
SynthesizeFragmentFnPtr = GetSynthesisFunction(SynthesisMode); |
|
991 |
} |
} |
992 |
|
|
993 |
/** |
/** |