diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/simpl/synthesis.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/simpl/synthesis.cpp b/src/simpl/synthesis.cpp index 9dd1131..221e60e 100644 --- a/src/simpl/synthesis.cpp +++ b/src/simpl/synthesis.cpp @@ -125,10 +125,15 @@ void SMSSynthesis::det_synthesis_type(int new_det_synthesis_type) { } void SMSSynthesis::synth_frame(Frame* frame) { - for(int i = 0; i < _data.nTracks; i++) { - _data.pFSinAmp[i] = frame->peak(i)->amplitude; - _data.pFSinFreq[i] = frame->peak(i)->frequency; - _data.pFSinPha[i] = frame->peak(i)->phase; + int num_partials = _data.nTracks; + if(num_partials > frame->num_partials()) { + num_partials = frame->num_partials(); + } + + for(int i = 0; i < num_partials; i++) { + _data.pFSinAmp[i] = frame->partial(i)->amplitude; + _data.pFSinFreq[i] = frame->partial(i)->frequency; + _data.pFSinPha[i] = frame->partial(i)->phase; } sms_synthesize(&_data, frame->synth(), &_synth_params); |