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 |
|
|
962 |
|
|
963 |
//same as 'pEngine->pBasicFilterParameters[i] = bqbase;' |
//same as 'pEngine->pBasicFilterParameters[i] = bqbase;' |
964 |
bq = (float*) &pEngine->pBasicFilterParameters[i]; |
bq = (float*) &pEngine->pBasicFilterParameters[i]; |
965 |
bq[0] = bqbase.a1; |
bq[0] = bqbase.b0; |
966 |
bq[1] = bqbase.a2; |
bq[1] = bqbase.b1; |
967 |
bq[2] = bqbase.b0; |
bq[2] = bqbase.b2; |
968 |
bq[3] = bqbase.b1; |
bq[3] = bqbase.a1; |
969 |
bq[4] = bqbase.b2; |
bq[4] = bqbase.a2; |
970 |
|
|
971 |
// same as 'pEngine->pMainFilterParameters[i] = bqmain;' |
// same as 'pEngine->pMainFilterParameters[i] = bqmain;' |
972 |
bq = (float*) &pEngine->pMainFilterParameters[i]; |
bq = (float*) &pEngine->pMainFilterParameters[i]; |
973 |
bq[0] = bqmain.a1; |
bq[0] = bqmain.b0; |
974 |
bq[1] = bqmain.a2; |
bq[1] = bqmain.b1; |
975 |
bq[2] = bqmain.b0; |
bq[2] = bqmain.b2; |
976 |
bq[3] = bqmain.b1; |
bq[3] = bqmain.a1; |
977 |
bq[4] = bqmain.b2; |
bq[4] = bqmain.a2; |
978 |
} |
} |
979 |
} |
} |
980 |
|
|
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 |
/** |
/** |