Mercurial > hg > svapp
comparison audioio/AudioGenerator.cpp @ 307:6eb15c3aee0a tonioni
More toward using clip mixer
author | Chris Cannam |
---|---|
date | Tue, 07 Jan 2014 13:10:35 +0000 |
parents | 9716c75499ef |
children | 289d65722123 |
comparison
equal
deleted
inserted
replaced
306:64382d824bfe | 307:6eb15c3aee0a |
---|---|
25 #include "data/model/FlexiNoteModel.h" | 25 #include "data/model/FlexiNoteModel.h" |
26 #include "data/model/DenseTimeValueModel.h" | 26 #include "data/model/DenseTimeValueModel.h" |
27 #include "data/model/SparseOneDimensionalModel.h" | 27 #include "data/model/SparseOneDimensionalModel.h" |
28 #include "data/model/NoteData.h" | 28 #include "data/model/NoteData.h" |
29 | 29 |
30 #include "ClipMixer.h" | |
31 | |
30 #include <iostream> | 32 #include <iostream> |
31 #include <cmath> | 33 #include <cmath> |
32 | 34 |
33 #include <QDir> | 35 #include <QDir> |
34 #include <QFile> | 36 #include <QFile> |
113 if (dtvm) { | 115 if (dtvm) { |
114 m_sourceSampleRate = model->getSampleRate(); | 116 m_sourceSampleRate = model->getSampleRate(); |
115 return true; | 117 return true; |
116 } | 118 } |
117 } | 119 } |
118 /*!!! | 120 |
119 RealTimePluginInstance *plugin = loadPluginFor(model); | 121 ClipMixer *mixer = makeClipMixerFor(model); |
120 if (plugin) { | 122 if (mixer) { |
121 QMutexLocker locker(&m_mutex); | 123 QMutexLocker locker(&m_mutex); |
122 m_synthMap[model] = plugin; | 124 m_clipMixerMap[model] = mixer; |
123 return true; | 125 return true; |
124 } | 126 } |
125 */ | 127 |
126 return false; | 128 return false; |
127 } | 129 } |
128 | 130 |
129 void | 131 void |
130 AudioGenerator::playSampleIdChanged(const Playable *playable, QString) | 132 AudioGenerator::playSampleIdChanged(const Playable *playable, QString) |
135 << playable << " is not a supported model type" | 137 << playable << " is not a supported model type" |
136 << endl; | 138 << endl; |
137 return; | 139 return; |
138 } | 140 } |
139 | 141 |
140 if (m_synthMap.find(model) == m_synthMap.end()) return; | 142 if (m_clipMixerMap.find(model) == m_clipMixerMap.end()) return; |
141 /*!!! | 143 |
142 RealTimePluginInstance *plugin = loadPluginFor(model); | 144 ClipMixer *mixer = makeClipMixerFor(model); |
143 if (plugin) { | 145 if (mixer) { |
144 QMutexLocker locker(&m_mutex); | 146 QMutexLocker locker(&m_mutex); |
145 delete m_synthMap[model]; | 147 m_clipMixerMap[model] = mixer; |
146 m_synthMap[model] = plugin; | 148 return true; |
147 } | 149 } |
148 */ | |
149 } | 150 } |
150 /*!!! | 151 /*!!! |
151 void | 152 void |
152 AudioGenerator::playPluginConfigurationChanged(const Playable *playable, | 153 AudioGenerator::playPluginConfigurationChanged(const Playable *playable, |
153 QString configurationXml) | 154 QString configurationXml) |
178 { | 179 { |
179 if (m_sampleDir != "") { | 180 if (m_sampleDir != "") { |
180 plugin->configure("sampledir", m_sampleDir.toStdString()); | 181 plugin->configure("sampledir", m_sampleDir.toStdString()); |
181 } | 182 } |
182 } | 183 } |
183 | 184 */ |
184 RealTimePluginInstance * | 185 ClipMixer * |
185 AudioGenerator::loadPluginFor(const Model *model) | 186 AudioGenerator::makeClipMixerFor(const Model *model) |
186 { | 187 { |
187 QString pluginId, configurationXml; | 188 QString sampleId; |
188 | 189 |
189 const Playable *playable = model; | 190 const Playable *playable = model; |
190 if (!playable || !playable->canPlay()) return 0; | 191 if (!playable || !playable->canPlay()) return 0; |
191 | 192 |
192 PlayParameters *parameters = | 193 PlayParameters *parameters = |
193 PlayParameterRepository::getInstance()->getPlayParameters(playable); | 194 PlayParameterRepository::getInstance()->getPlayParameters(playable); |
194 if (parameters) { | 195 if (parameters) { |
195 pluginId = parameters->getPlaySampleId(); | 196 sampleId = parameters->getPlaySampleId(); |
196 configurationXml = parameters->getPlayPluginConfiguration(); | 197 } |
197 } | 198 |
198 | 199 std::cerr << "AudioGenerator::loadPluginFor(" << model << "): sample id = " << sampleId << std::endl; |
199 std::cerr << "AudioGenerator::loadPluginFor(" << model << "): id = " << pluginId << std::endl; | 200 |
200 | 201 if (sampleId == "") { |
201 if (pluginId == "") { | 202 SVDEBUG << "AudioGenerator::loadPluginFor(" << model << "): no sample, skipping" << endl; |
202 SVDEBUG << "AudioGenerator::loadPluginFor(" << model << "): parameters contain empty plugin ID, skipping" << endl; | |
203 return 0; | 203 return 0; |
204 } | 204 } |
205 | |
206 | |
207 | |
208 | |
209 | |
205 | 210 |
206 RealTimePluginInstance *plugin = loadPlugin(pluginId, ""); | 211 RealTimePluginInstance *plugin = loadPlugin(pluginId, ""); |
207 if (!plugin) return 0; | 212 if (!plugin) return 0; |
208 | 213 |
209 std::cerr << "AudioGenerator::loadPluginFor(" << model << "): loaded plugin " | 214 std::cerr << "AudioGenerator::loadPluginFor(" << model << "): loaded plugin " |