Mercurial > hg > svcore
comparison plugin/LADSPAPluginInstance.cpp @ 51:c2913298cf94
* Make RealTimePluginInstances also provide the PluginInstance interface
author | Chris Cannam |
---|---|
date | Mon, 20 Mar 2006 13:48:58 +0000 |
parents | 39ae3dee27b9 |
children | d397ea0a79f5 |
comparison
equal
deleted
inserted
replaced
50:080ad875395a | 51:c2913298cf94 |
---|---|
60 connectPorts(); | 60 connectPorts(); |
61 activate(); | 61 activate(); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 LADSPAPluginInstance::LADSPAPluginInstance(RealTimePluginFactory *factory, | 65 std::string |
66 int clientId, | 66 LADSPAPluginInstance::getName() const |
67 QString identifier, | 67 { |
68 int position, | 68 return m_descriptor->Label; |
69 unsigned long sampleRate, | 69 } |
70 size_t blockSize, | 70 |
71 sample_t **inputBuffers, | 71 std::string |
72 sample_t **outputBuffers, | 72 LADSPAPluginInstance::getDescription() const |
73 const LADSPA_Descriptor* descriptor) : | 73 { |
74 RealTimePluginInstance(factory, identifier), | 74 return m_descriptor->Name; |
75 m_client(clientId), | 75 } |
76 m_position(position), | 76 |
77 m_instanceCount(0), | 77 std::string |
78 m_descriptor(descriptor), | 78 LADSPAPluginInstance::getMaker() const |
79 m_blockSize(blockSize), | 79 { |
80 m_inputBuffers(inputBuffers), | 80 return m_descriptor->Maker; |
81 m_outputBuffers(outputBuffers), | 81 } |
82 m_ownBuffers(false), | 82 |
83 m_sampleRate(sampleRate), | 83 int |
84 m_latencyPort(0), | 84 LADSPAPluginInstance::getPluginVersion() const |
85 m_run(false), | 85 { |
86 m_bypassed(false) | 86 return 1; |
87 { | 87 } |
88 init(); | 88 |
89 | 89 std::string |
90 instantiate(sampleRate); | 90 LADSPAPluginInstance::getCopyright() const |
91 if (isOK()) { | 91 { |
92 connectPorts(); | 92 return m_descriptor->Copyright; |
93 activate(); | 93 } |
94 } | 94 |
95 } | 95 LADSPAPluginInstance::ParameterList |
96 | 96 LADSPAPluginInstance::getParameterDescriptors() const |
97 { | |
98 ParameterList list; | |
99 LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory); | |
100 | |
101 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { | |
102 | |
103 ParameterDescriptor pd; | |
104 unsigned int pn = m_controlPortsIn[i].first; | |
105 | |
106 pd.name = m_descriptor->PortNames[pn]; | |
107 pd.description = pd.name; | |
108 pd.minValue = f->getPortMinimum(m_descriptor, pn); | |
109 pd.maxValue = f->getPortMaximum(m_descriptor, pn); | |
110 pd.defaultValue = f->getPortDefault(m_descriptor, pn); | |
111 pd.isQuantized = false; | |
112 | |
113 list.push_back(pd); | |
114 } | |
115 | |
116 return list; | |
117 } | |
118 | |
119 float | |
120 LADSPAPluginInstance::getParameter(std::string name) const | |
121 { | |
122 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { | |
123 if (name == m_descriptor->PortNames[m_controlPortsIn[i].first]) { | |
124 return getParameterValue(i); | |
125 } | |
126 } | |
127 | |
128 return 0.0; | |
129 } | |
130 | |
131 void | |
132 LADSPAPluginInstance::setParameter(std::string name, float value) | |
133 { | |
134 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { | |
135 if (name == m_descriptor->PortNames[m_controlPortsIn[i].first]) { | |
136 setParameterValue(i, value); | |
137 break; | |
138 } | |
139 } | |
140 } | |
97 | 141 |
98 void | 142 void |
99 LADSPAPluginInstance::init(int idealChannelCount) | 143 LADSPAPluginInstance::init(int idealChannelCount) |
100 { | 144 { |
101 #ifdef DEBUG_LADSPA | 145 #ifdef DEBUG_LADSPA |