diff options
author | Tim E. Real <termtech@rogers.com> | 2011-06-19 01:26:26 +0000 |
---|---|---|
committer | Tim E. Real <termtech@rogers.com> | 2011-06-19 01:26:26 +0000 |
commit | 02941424387a064301372c12bda3e8c3ab3fee45 (patch) | |
tree | e4cdea4400d8a34060a1c4d2b32da8e7ef46ab90 /muse2/muse/node.cpp | |
parent | 448d81436ed8c2bc501506c2663a9bdb8c0dd023 (diff) |
Major work, all synthesizers. Other fixes. Please see ChangeLog.
Diffstat (limited to 'muse2/muse/node.cpp')
-rw-r--r-- | muse2/muse/node.cpp | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/muse2/muse/node.cpp b/muse2/muse/node.cpp index 06dbbc8d..da3874f0 100644 --- a/muse2/muse/node.cpp +++ b/muse2/muse/node.cpp @@ -1889,35 +1889,43 @@ void AudioTrack::setChannels(int n) void AudioTrack::setTotalOutChannels(int num) { - if(num == _totalOutChannels) - return; - + //if(num == _totalOutChannels) + // return; + // p4.0.27 Fixes crash if file loaded with track channels less than synth channels. int chans = _totalOutChannels; - // Number of allocated buffers is always MAX_CHANNELS or more, even if _totalOutChannels is less. - if(chans < MAX_CHANNELS) - chans = MAX_CHANNELS; - for(int i = 0; i < chans; ++i) + if(num != chans) { - if(outBuffers[i]) - free(outBuffers[i]); - } - delete[] outBuffers; - _totalOutChannels = num; - chans = num; - // Number of allocated buffers is always MAX_CHANNELS or more, even if _totalOutChannels is less. - if(chans < MAX_CHANNELS) - chans = MAX_CHANNELS; + //int chans = _totalOutChannels; + // Number of allocated buffers is always MAX_CHANNELS or more, even if _totalOutChannels is less. + if(chans < MAX_CHANNELS) + chans = MAX_CHANNELS; + for(int i = 0; i < chans; ++i) + { + if(outBuffers[i]) + free(outBuffers[i]); + } + delete[] outBuffers; - outBuffers = new float*[chans]; - for (int i = 0; i < chans; ++i) - posix_memalign((void**)&outBuffers[i], 16, sizeof(float) * segmentSize); - + _totalOutChannels = num; + chans = num; + // Number of allocated buffers is always MAX_CHANNELS or more, even if _totalOutChannels is less. + if(chans < MAX_CHANNELS) + chans = MAX_CHANNELS; + + outBuffers = new float*[chans]; + for (int i = 0; i < chans; ++i) + posix_memalign((void**)&outBuffers[i], 16, sizeof(float) * segmentSize); + + //chans = num; + // Limit the actual track (meters, copying etc, all 'normal' operation) to two-channel stereo. + //if(chans > MAX_CHANNELS) + // chans = MAX_CHANNELS; + } chans = num; // Limit the actual track (meters, copying etc, all 'normal' operation) to two-channel stereo. if(chans > MAX_CHANNELS) chans = MAX_CHANNELS; - setChannels(chans); } |