comparison plugin/DSSIPluginInstance.cpp @ 980:6e6da0636e5e tonioni

Merge from default branch
author Chris Cannam
date Tue, 09 Sep 2014 16:36:21 +0100
parents c598b1d880f2
children cc27f35aa75c
comparison
equal deleted inserted replaced
954:35b05cac32d0 980:6e6da0636e5e
62 int idealChannelCount, 62 int idealChannelCount,
63 const DSSI_Descriptor* descriptor) : 63 const DSSI_Descriptor* descriptor) :
64 RealTimePluginInstance(factory, identifier), 64 RealTimePluginInstance(factory, identifier),
65 m_client(clientId), 65 m_client(clientId),
66 m_position(position), 66 m_position(position),
67 m_instanceHandle(0),
67 m_descriptor(descriptor), 68 m_descriptor(descriptor),
68 m_programCacheValid(false), 69 m_programCacheValid(false),
69 m_eventBuffer(EVENT_BUFFER_SIZE), 70 m_eventBuffer(EVENT_BUFFER_SIZE),
70 m_blockSize(blockSize), 71 m_blockSize(blockSize),
71 m_idealChannelCount(idealChannelCount), 72 m_idealChannelCount(idealChannelCount),
144 DSSIPluginInstance::ParameterList 145 DSSIPluginInstance::ParameterList
145 DSSIPluginInstance::getParameterDescriptors() const 146 DSSIPluginInstance::getParameterDescriptors() const
146 { 147 {
147 ParameterList list; 148 ParameterList list;
148 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); 149 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory);
150 if (!f) return list;
149 151
150 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { 152 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) {
151 153
152 ParameterDescriptor pd; 154 ParameterDescriptor pd;
153 unsigned int pn = m_controlPortsIn[i].first; 155 unsigned int pn = m_controlPortsIn[i].first;
986 int evCount = 0; 988 int evCount = 0;
987 989
988 if (count == 0) count = m_blockSize; 990 if (count == 0) count = m_blockSize;
989 991
990 bool needLock = false; 992 bool needLock = false;
991 if (m_descriptor->select_program) needLock = true; 993 if (m_descriptor && m_descriptor->select_program) needLock = true;
992 994
993 if (needLock) { 995 if (needLock) {
994 if (!m_processLock.tryLock()) { 996 if (!m_processLock.tryLock()) {
995 for (size_t ch = 0; ch < m_audioPortsOut.size(); ++ch) { 997 for (size_t ch = 0; ch < m_audioPortsOut.size(); ++ch) {
996 memset(m_outputBuffers[ch], 0, m_blockSize * sizeof(sample_t)); 998 memset(m_outputBuffers[ch], 0, m_blockSize * sizeof(sample_t));
1005 } 1007 }
1006 1008
1007 if (!m_descriptor || !m_descriptor->run_synth) { 1009 if (!m_descriptor || !m_descriptor->run_synth) {
1008 m_eventBuffer.skip(m_eventBuffer.getReadSpace()); 1010 m_eventBuffer.skip(m_eventBuffer.getReadSpace());
1009 m_haveLastEventSendTime = false; 1011 m_haveLastEventSendTime = false;
1010 if (m_descriptor->LADSPA_Plugin->run) { 1012 if (m_descriptor && m_descriptor->LADSPA_Plugin->run) {
1011 m_descriptor->LADSPA_Plugin->run(m_instanceHandle, count); 1013 m_descriptor->LADSPA_Plugin->run(m_instanceHandle, count);
1012 } else { 1014 } else {
1013 for (size_t ch = 0; ch < m_audioPortsOut.size(); ++ch) { 1015 for (size_t ch = 0; ch < m_audioPortsOut.size(); ++ch) {
1014 memset(m_outputBuffers[ch], 0, m_blockSize * sizeof(sample_t)); 1016 memset(m_outputBuffers[ch], 0, m_blockSize * sizeof(sample_t));
1015 } 1017 }