Remove identical calls to InstrumentTrack::processAudioBuffer
Remove identical calls to `InstrumentTrack::processAudioBuffer` which appear in the overridden implementations of `Instrument::play` and `Instrument::playNotes`. Instead the call to `processAudioBuffer` has been moved into `InstrumentPlayHandle::play` and `InstrumentTrack::playNote`. These two methods call the aforementioned methods of `Instrument`. Especially in the case of `InstrumentTrack::playNote` the previous implementation resulted in some unncessary "ping pong" where `InstrumentTrack` called a method on an `Instrument` which then in turn called a method on `InstrumentTrack`. And this was done in almost every instrument.
In `InstrumentTrack::playNote` an additional check was added which only calls `processAudioBuffer` if the buffer is not `nullptr`. The reason is that under certain circumstances `PlayHandle::doProcessing` calls the `play` method by explicitly passing a `nullptr` as the buffer. This behavior was added with commit 7bc97f5d5b. Because it is unknown if this was done for some side effects the code was adjusted so that it behaves identical in this case.
Move the complex implementation for `InstrumentPlayHandle::play` and `InstrumentPlayHandle::isFromTrack` into the cpp file and optimize the includes.
This commit is contained in:
@@ -171,9 +171,6 @@ void AudioFileProcessor::playNote( NotePlayHandle * _n,
|
||||
static_cast<SampleBuffer::LoopMode>( m_loopModel.value() ) ) )
|
||||
{
|
||||
applyRelease( _working_buffer, _n );
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer,
|
||||
frames + offset, _n );
|
||||
|
||||
emit isPlaying( ((handleState *)_n->m_pluginData)->frameIndex() );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -307,8 +307,6 @@ void BitInvader::playNote( NotePlayHandle * _n,
|
||||
}
|
||||
|
||||
applyRelease( _working_buffer, _n );
|
||||
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -508,7 +508,6 @@ void CarlaInstrument::play(sampleFrame* workingBuffer)
|
||||
|
||||
if (fHandle == nullptr)
|
||||
{
|
||||
instrumentTrack()->processAudioBuffer(workingBuffer, bufsize, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -556,8 +555,6 @@ void CarlaInstrument::play(sampleFrame* workingBuffer)
|
||||
workingBuffer[i][0] = buf1[i];
|
||||
workingBuffer[i][1] = buf2[i];
|
||||
}
|
||||
|
||||
instrumentTrack()->processAudioBuffer(workingBuffer, bufsize, nullptr);
|
||||
}
|
||||
|
||||
bool CarlaInstrument::handleMidiEvent(const MidiEvent& event, const TimePos&, f_cnt_t offset)
|
||||
|
||||
@@ -419,7 +419,6 @@ void FreeBoyInstrument::playNote(NotePlayHandle* nph, sampleFrame* workingBuffer
|
||||
}
|
||||
framesLeft -= count;
|
||||
}
|
||||
instrumentTrack()->processAudioBuffer(workingBuffer, frames + offset, nph);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -494,8 +494,6 @@ void GigInstrument::play( sampleFrame * _working_buffer )
|
||||
_working_buffer[i][0] *= m_gain.value();
|
||||
_working_buffer[i][1] *= m_gain.value();
|
||||
}
|
||||
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer, frames, nullptr );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -197,8 +197,6 @@ void KickerInstrument::playNote( NotePlayHandle * _n,
|
||||
_working_buffer[f+offset][1] *= fac;
|
||||
}
|
||||
}
|
||||
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -790,7 +790,6 @@ void Lb302Synth::play( sampleFrame * _working_buffer )
|
||||
const fpp_t frames = Engine::audioEngine()->framesPerPeriod();
|
||||
|
||||
process( _working_buffer, frames );
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer, frames, nullptr );
|
||||
// release_frame = 0; //removed for issue # 1432
|
||||
}
|
||||
|
||||
|
||||
@@ -197,8 +197,6 @@ void Lv2Instrument::play(sampleFrame *buf)
|
||||
|
||||
copyModelsToLmms();
|
||||
copyBuffersToLmms(buf, fpp);
|
||||
|
||||
instrumentTrack()->processAudioBuffer(buf, fpp, nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1040,8 +1040,6 @@ void MonstroInstrument::playNote( NotePlayHandle * _n,
|
||||
ms->renderOutput( frames, _working_buffer + offset );
|
||||
|
||||
//applyRelease( _working_buffer, _n ); // we have our own release
|
||||
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
|
||||
}
|
||||
|
||||
void MonstroInstrument::deleteNotePluginData( NotePlayHandle * _n )
|
||||
|
||||
@@ -561,8 +561,6 @@ void NesInstrument::playNote( NotePlayHandle * n, sampleFrame * workingBuffer )
|
||||
nes->renderOutput( workingBuffer + offset, frames );
|
||||
|
||||
applyRelease( workingBuffer, n );
|
||||
|
||||
instrumentTrack()->processAudioBuffer( workingBuffer, frames + offset, n );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -412,10 +412,6 @@ void OpulenzInstrument::play( sampleFrame * _working_buffer )
|
||||
}
|
||||
}
|
||||
emulatorMutex.unlock();
|
||||
|
||||
// Throw the data to the track...
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer, frameCount, nullptr );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -312,8 +312,6 @@ void OrganicInstrument::playNote( NotePlayHandle * _n,
|
||||
}
|
||||
|
||||
// -- --
|
||||
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -157,8 +157,6 @@ void PatmanInstrument::playNote( NotePlayHandle * _n,
|
||||
play_freq, m_loopedModel.value() ? SampleBuffer::LoopMode::On : SampleBuffer::LoopMode::Off ) )
|
||||
{
|
||||
applyRelease( _working_buffer, _n );
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer,
|
||||
frames + offset, _n );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -848,7 +848,6 @@ void Sf2Instrument::play( sampleFrame * _working_buffer )
|
||||
if( m_playingNotes.isEmpty() )
|
||||
{
|
||||
renderFrames( frames, _working_buffer );
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer, frames, nullptr );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -906,7 +905,6 @@ void Sf2Instrument::play( sampleFrame * _working_buffer )
|
||||
{
|
||||
renderFrames( frames - currentFrame, _working_buffer + currentFrame );
|
||||
}
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer, frames, nullptr );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -480,9 +480,6 @@ void SfxrInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffe
|
||||
delete[] pitchedBuffer;
|
||||
|
||||
applyRelease( _working_buffer, _n );
|
||||
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer, frameNum + offset, _n );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -429,8 +429,6 @@ void SidInstrument::playNote( NotePlayHandle * _n,
|
||||
_working_buffer[frame+offset][ch] = s;
|
||||
}
|
||||
}
|
||||
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -359,8 +359,6 @@ void MalletsInstrument::playNote( NotePlayHandle * _n,
|
||||
_working_buffer[frame][1] = ps->nextSampleRight() *
|
||||
( m_scalers[p] + add_scale );
|
||||
}
|
||||
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -380,8 +380,6 @@ void TripleOscillator::playNote( NotePlayHandle * _n,
|
||||
|
||||
applyFadeIn(_working_buffer, _n);
|
||||
applyRelease( _working_buffer, _n );
|
||||
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -409,8 +409,6 @@ void VestigeInstrument::play( sampleFrame * _buf )
|
||||
|
||||
m_plugin->process( nullptr, _buf );
|
||||
|
||||
instrumentTrack()->processAudioBuffer( _buf, frames, nullptr );
|
||||
|
||||
m_pluginMutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -251,8 +251,6 @@ void Vibed::playNote(NotePlayHandle* n, sampleFrame* workingBuffer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
instrumentTrack()->processAudioBuffer(workingBuffer, frames + offset, n);
|
||||
}
|
||||
|
||||
void Vibed::deleteNotePluginData(NotePlayHandle* n)
|
||||
|
||||
@@ -445,8 +445,6 @@ void WatsynInstrument::playNote( NotePlayHandle * _n,
|
||||
}
|
||||
|
||||
applyRelease( _working_buffer, _n );
|
||||
|
||||
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -233,8 +233,6 @@ void Xpressive::playNote(NotePlayHandle* nph, sampleFrame* working_buffer) {
|
||||
const f_cnt_t offset = nph->noteOffset();
|
||||
|
||||
ps->renderOutput(frames, working_buffer + offset);
|
||||
|
||||
instrumentTrack()->processAudioBuffer(working_buffer, frames + offset, nph);
|
||||
}
|
||||
|
||||
void Xpressive::deleteNotePluginData(NotePlayHandle* nph) {
|
||||
|
||||
@@ -341,7 +341,6 @@ void ZynAddSubFxInstrument::play( sampleFrame * _buf )
|
||||
m_plugin->processAudio( _buf );
|
||||
}
|
||||
m_pluginMutex.unlock();
|
||||
instrumentTrack()->processAudioBuffer( _buf, Engine::audioEngine()->framesPerPeriod(), nullptr );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user