Mercurial > hg > svapp
comparison audioio/AudioCallbackPlaySource.cpp @ 204:5ee9e6bc21eb
* Use a mutex when setting auditioning plugin; lifecycle management too fragile otherwise
author | Chris Cannam |
---|---|
date | Fri, 08 Oct 2010 11:19:57 +0100 |
parents | d9c21e7bff21 |
children | fe83e6e68683 |
comparison
equal
deleted
inserted
replaced
203:aafbb79e93d4 | 204:5ee9e6bc21eb |
---|---|
960 { | 960 { |
961 RealTimePluginInstance *plugin = dynamic_cast<RealTimePluginInstance *>(a); | 961 RealTimePluginInstance *plugin = dynamic_cast<RealTimePluginInstance *>(a); |
962 if (a && !plugin) { | 962 if (a && !plugin) { |
963 std::cerr << "WARNING: AudioCallbackPlaySource::setAuditioningEffect: auditionable object " << a << " is not a real-time plugin instance" << std::endl; | 963 std::cerr << "WARNING: AudioCallbackPlaySource::setAuditioningEffect: auditionable object " << a << " is not a real-time plugin instance" << std::endl; |
964 } | 964 } |
965 RealTimePluginInstance *formerPlugin = m_auditioningPlugin; | 965 |
966 m_mutex.lock(); | |
966 m_auditioningPlugin = plugin; | 967 m_auditioningPlugin = plugin; |
967 m_auditioningPluginBypassed = false; | 968 m_auditioningPluginBypassed = false; |
968 if (formerPlugin) m_pluginScavenger.claim(formerPlugin); | 969 m_mutex.unlock(); |
969 } | 970 } |
970 | 971 |
971 void | 972 void |
972 AudioCallbackPlaySource::setSoloModelSet(std::set<Model *> s) | 973 AudioCallbackPlaySource::setSoloModelSet(std::set<Model *> s) |
973 { | 974 { |
1247 AudioCallbackPlaySource::applyAuditioningEffect(size_t count, float **buffers) | 1248 AudioCallbackPlaySource::applyAuditioningEffect(size_t count, float **buffers) |
1248 { | 1249 { |
1249 if (m_auditioningPluginBypassed) return; | 1250 if (m_auditioningPluginBypassed) return; |
1250 RealTimePluginInstance *plugin = m_auditioningPlugin; | 1251 RealTimePluginInstance *plugin = m_auditioningPlugin; |
1251 if (!plugin) return; | 1252 if (!plugin) return; |
1252 | 1253 |
1253 if (plugin->getAudioInputCount() != getTargetChannelCount()) { | 1254 if (plugin->getAudioInputCount() != getTargetChannelCount()) { |
1254 // std::cerr << "plugin input count " << plugin->getAudioInputCount() | 1255 // std::cerr << "plugin input count " << plugin->getAudioInputCount() |
1255 // << " != our channel count " << getTargetChannelCount() | 1256 // << " != our channel count " << getTargetChannelCount() |
1256 // << std::endl; | 1257 // << std::endl; |
1257 return; | 1258 return; |