comparison plugin/DSSIPluginInstance.cpp @ 117:c30728d5625c sv1-v0.9rc1

* Make vertical scale alignment modes work in note layer as well as time-value layer, and several significant fixes to it * Make it possible to draw notes properly on the note layer * Show units (and frequencies etc in note layer's case) in the time-value and note layer description boxes * Minor fix to item edit dialog layout * Some minor menu rearrangement * Comment out a lot of debug output * Add SV website and reference URLs to Help menu, and add code to (attempt to) open them in the user's preferred browser
author Chris Cannam
date Fri, 12 May 2006 14:40:43 +0000
parents 97e085895524
children 71f869dac40b
comparison
equal deleted inserted replaced
116:a08718723b20 117:c30728d5625c
23 23
24 #include "DSSIPluginInstance.h" 24 #include "DSSIPluginInstance.h"
25 #include "PluginIdentifier.h" 25 #include "PluginIdentifier.h"
26 #include "LADSPAPluginFactory.h" 26 #include "LADSPAPluginFactory.h"
27 27
28 #define DEBUG_DSSI 1 28 //#define DEBUG_DSSI 1
29 //#define DEBUG_DSSI_PROCESS 1 29 //#define DEBUG_DSSI_PROCESS 1
30 30
31 #define EVENT_BUFFER_SIZE 1023 31 #define EVENT_BUFFER_SIZE 1023
32 32
33 #ifdef DEBUG_DSSI 33 #ifdef DEBUG_DSSI
159 } 159 }
160 160
161 float 161 float
162 DSSIPluginInstance::getParameter(std::string name) const 162 DSSIPluginInstance::getParameter(std::string name) const
163 { 163 {
164 #ifdef DEBUG_DSSI
164 std::cerr << "DSSIPluginInstance::getParameter(" << name << ")" << std::endl; 165 std::cerr << "DSSIPluginInstance::getParameter(" << name << ")" << std::endl;
166 #endif
165 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { 167 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) {
166 if (name == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) { 168 if (name == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) {
169 #ifdef DEBUG_DSSI
167 std::cerr << "Matches port " << i << std::endl; 170 std::cerr << "Matches port " << i << std::endl;
171 #endif
168 float v = getParameterValue(i); 172 float v = getParameterValue(i);
173 #ifdef DEBUG_DSSI
169 std::cerr << "Returning " << v << std::endl; 174 std::cerr << "Returning " << v << std::endl;
175 #endif
170 return v; 176 return v;
171 } 177 }
172 } 178 }
173 179
174 return 0.0; 180 return 0.0;
175 } 181 }
176 182
177 void 183 void
178 DSSIPluginInstance::setParameter(std::string name, float value) 184 DSSIPluginInstance::setParameter(std::string name, float value)
179 { 185 {
186 #ifdef DEBUG_DSSI
180 std::cerr << "DSSIPluginInstance::setParameter(" << name << ", " << value << ")" << std::endl; 187 std::cerr << "DSSIPluginInstance::setParameter(" << name << ", " << value << ")" << std::endl;
188 #endif
181 189
182 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { 190 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) {
183 if (name == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) { 191 if (name == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) {
184 setParameterValue(i, value); 192 setParameterValue(i, value);
185 break; 193 break;
368 m_groupMap[m_identifier].insert(this); 376 m_groupMap[m_identifier].insert(this);
369 } 377 }
370 378
371 DSSIPluginInstance::~DSSIPluginInstance() 379 DSSIPluginInstance::~DSSIPluginInstance()
372 { 380 {
381 #ifdef DEBUG_DSSI
373 std::cerr << "DSSIPluginInstance::~DSSIPluginInstance" << std::endl; 382 std::cerr << "DSSIPluginInstance::~DSSIPluginInstance" << std::endl;
383 #endif
374 384
375 if (m_threads.find(m_instanceHandle) != m_threads.end()) { 385 if (m_threads.find(m_instanceHandle) != m_threads.end()) {
376 386
377 for (std::set<NonRTPluginThread *>::iterator i = 387 for (std::set<NonRTPluginThread *>::iterator i =
378 m_threads[m_instanceHandle].begin(); 388 m_threads[m_instanceHandle].begin();
652 662
653 void 663 void
654 DSSIPluginInstance::connectPorts() 664 DSSIPluginInstance::connectPorts()
655 { 665 {
656 if (!m_descriptor || !m_descriptor->LADSPA_Plugin->connect_port) return; 666 if (!m_descriptor || !m_descriptor->LADSPA_Plugin->connect_port) return;
667 #ifdef DEBUG_DSSI
657 std::cerr << "DSSIPluginInstance::connectPorts: " << m_audioPortsIn.size() 668 std::cerr << "DSSIPluginInstance::connectPorts: " << m_audioPortsIn.size()
658 << " audio ports in, " << m_audioPortsOut.size() << " out, " 669 << " audio ports in, " << m_audioPortsOut.size() << " out, "
659 << m_outputBufferCount << " output buffers" << std::endl; 670 << m_outputBufferCount << " output buffers" << std::endl;
671 #endif
660 672
661 assert(sizeof(LADSPA_Data) == sizeof(float)); 673 assert(sizeof(LADSPA_Data) == sizeof(float));
662 assert(sizeof(sample_t) == sizeof(float)); 674 assert(sizeof(sample_t) == sizeof(float));
663 675
664 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); 676 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory);
689 if (f) { 701 if (f) {
690 float defaultValue = f->getPortDefault 702 float defaultValue = f->getPortDefault
691 (m_descriptor->LADSPA_Plugin, m_controlPortsIn[i].first); 703 (m_descriptor->LADSPA_Plugin, m_controlPortsIn[i].first);
692 *m_controlPortsIn[i].second = defaultValue; 704 *m_controlPortsIn[i].second = defaultValue;
693 m_backupControlPortsIn[i] = defaultValue; 705 m_backupControlPortsIn[i] = defaultValue;
706 #ifdef DEBUG_DSSI
694 std::cerr << "DSSIPluginInstance::connectPorts: set control port " << i << " to default value " << defaultValue << std::endl; 707 std::cerr << "DSSIPluginInstance::connectPorts: set control port " << i << " to default value " << defaultValue << std::endl;
708 #endif
695 } 709 }
696 } 710 }
697 711
698 for (unsigned int i = 0; i < m_controlPortsOut.size(); ++i) { 712 for (unsigned int i = 0; i < m_controlPortsOut.size(); ++i) {
699 m_descriptor->LADSPA_Plugin->connect_port 713 m_descriptor->LADSPA_Plugin->connect_port