Mercurial > hg > svcore
changeset 385:9b35a1731c3d
* Tolerable fixes to #1903062 and #1903046
author | Chris Cannam |
---|---|
date | Wed, 27 Feb 2008 18:04:10 +0000 |
parents | 9867f99e0bb7 |
children | e6d11871e4c9 |
files | plugin/DSSIPluginInstance.cpp plugin/DSSIPluginInstance.h plugin/LADSPAPluginInstance.cpp plugin/LADSPAPluginInstance.h plugin/RealTimePluginInstance.h |
diffstat | 5 files changed, 17 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/plugin/DSSIPluginInstance.cpp Fri Feb 15 15:15:29 2008 +0000 +++ b/plugin/DSSIPluginInstance.cpp Wed Feb 27 18:04:10 2008 +0000 @@ -972,11 +972,13 @@ } void -DSSIPluginInstance::run(const Vamp::RealTime &blockTime) +DSSIPluginInstance::run(const Vamp::RealTime &blockTime, size_t count) { static snd_seq_event_t localEventBuffer[EVENT_BUFFER_SIZE]; int evCount = 0; + if (count == 0) count = m_blockSize; + bool needLock = false; if (m_descriptor->select_program) needLock = true; @@ -998,7 +1000,7 @@ m_eventBuffer.skip(m_eventBuffer.getReadSpace()); m_haveLastEventSendTime = false; if (m_descriptor->LADSPA_Plugin->run) { - m_descriptor->LADSPA_Plugin->run(m_instanceHandle, m_blockSize); + m_descriptor->LADSPA_Plugin->run(m_instanceHandle, count); } else { for (size_t ch = 0; ch < m_audioPortsOut.size(); ++ch) { memset(m_outputBuffers[ch], 0, m_blockSize * sizeof(sample_t)); @@ -1039,7 +1041,7 @@ std::cerr << "Type: " << int(ev->type) << ", pitch: " << int(ev->data.note.note) << ", velocity: " << int(ev->data.note.velocity) << std::endl; #endif - if (frameOffset >= int(m_blockSize)) break; + if (frameOffset >= int(count)) break; if (frameOffset < 0) { frameOffset = 0; if (ev->type == SND_SEQ_EVENT_NOTEON) { @@ -1085,11 +1087,11 @@ << std::endl; #endif - m_descriptor->run_synth(m_instanceHandle, m_blockSize, + m_descriptor->run_synth(m_instanceHandle, count, localEventBuffer, evCount); #ifdef DEBUG_DSSI_PROCESS -// for (int i = 0; i < m_blockSize; ++i) { +// for (int i = 0; i < count; ++i) { // std::cout << m_outputBuffers[0][i] << " "; // if (i % 8 == 0) std::cout << std::endl; // }
--- a/plugin/DSSIPluginInstance.h Fri Feb 15 15:15:29 2008 +0000 +++ b/plugin/DSSIPluginInstance.h Wed Feb 27 18:04:10 2008 +0000 @@ -54,7 +54,7 @@ virtual int getPluginVersion() const; virtual std::string getCopyright() const; - virtual void run(const Vamp::RealTime &); + virtual void run(const Vamp::RealTime &, size_t count = 0); virtual unsigned int getParameterCount() const; virtual void setParameterValue(unsigned int parameter, float value);
--- a/plugin/LADSPAPluginInstance.cpp Fri Feb 15 15:15:29 2008 +0000 +++ b/plugin/LADSPAPluginInstance.cpp Wed Feb 27 18:04:10 2008 +0000 @@ -529,14 +529,16 @@ } void -LADSPAPluginInstance::run(const Vamp::RealTime &) +LADSPAPluginInstance::run(const Vamp::RealTime &, size_t count) { if (!m_descriptor || !m_descriptor->run) return; + if (count == 0) count = m_blockSize; + for (std::vector<LADSPA_Handle>::iterator hi = m_instanceHandles.begin(); hi != m_instanceHandles.end(); ++hi) { - m_descriptor->run(*hi, m_blockSize); + m_descriptor->run(*hi, count); } m_run = true;
--- a/plugin/LADSPAPluginInstance.h Fri Feb 15 15:15:29 2008 +0000 +++ b/plugin/LADSPAPluginInstance.h Wed Feb 27 18:04:10 2008 +0000 @@ -50,7 +50,7 @@ virtual int getPluginVersion() const; virtual std::string getCopyright() const; - virtual void run(const Vamp::RealTime &rt); + virtual void run(const Vamp::RealTime &rt, size_t count = 0); virtual unsigned int getParameterCount() const; virtual void setParameterValue(unsigned int parameter, float value);
--- a/plugin/RealTimePluginInstance.h Fri Feb 15 15:15:29 2008 +0000 +++ b/plugin/RealTimePluginInstance.h Wed Feb 27 18:04:10 2008 +0000 @@ -86,9 +86,11 @@ /** * Run for one block, starting at the given time. The start time * may be of interest to synths etc that may have queued events - * waiting. Other plugins can ignore it. + * waiting. Other plugins can ignore it. The count, if zero, + * defaults to our fixed buffer size. */ - virtual void run(const Vamp::RealTime &blockStartTime) = 0; + virtual void run(const Vamp::RealTime &blockStartTime, + size_t count = 0) = 0; virtual size_t getBufferSize() const = 0;