comparison audioio/AudioCallbackPlaySource.cpp @ 42:c0ae41c72421

* Bypass auditioning plugin on xrun
author Chris Cannam
date Wed, 04 Oct 2006 11:54:32 +0000
parents fbd7a497fd89
children 0739be123304
comparison
equal deleted inserted replaced
41:fbd7a497fd89 42:c0ae41c72421
52 m_exiting(false), 52 m_exiting(false),
53 m_lastModelEndFrame(0), 53 m_lastModelEndFrame(0),
54 m_outputLeft(0.0), 54 m_outputLeft(0.0),
55 m_outputRight(0.0), 55 m_outputRight(0.0),
56 m_auditioningPlugin(0), 56 m_auditioningPlugin(0),
57 m_auditioningPluginBypassed(false),
57 m_timeStretcher(0), 58 m_timeStretcher(0),
58 m_fillThread(0), 59 m_fillThread(0),
59 m_converter(0), 60 m_converter(0),
60 m_crapConverter(0), 61 m_crapConverter(0),
61 m_resampleQuality(Preferences::getInstance()->getResampleQuality()) 62 m_resampleQuality(Preferences::getInstance()->getResampleQuality())
399 setResampleQuality(Preferences::getInstance()->getResampleQuality()); 400 setResampleQuality(Preferences::getInstance()->getResampleQuality());
400 } 401 }
401 } 402 }
402 403
403 void 404 void
405 AudioCallbackPlaySource::audioProcessingOverload()
406 {
407 RealTimePluginInstance *ap = m_auditioningPlugin;
408 if (ap && m_playing && !m_auditioningPluginBypassed) {
409 m_auditioningPluginBypassed = true;
410 emit audioOverloadPluginDisabled();
411 }
412 }
413
414 void
404 AudioCallbackPlaySource::setTargetBlockSize(size_t size) 415 AudioCallbackPlaySource::setTargetBlockSize(size_t size)
405 { 416 {
406 // std::cerr << "AudioCallbackPlaySource::setTargetBlockSize() -> " << size << std::endl; 417 // std::cerr << "AudioCallbackPlaySource::setTargetBlockSize() -> " << size << std::endl;
407 assert(size < m_ringBufferSize); 418 assert(size < m_ringBufferSize);
408 m_blockSize = size; 419 m_blockSize = size;
646 void 657 void
647 AudioCallbackPlaySource::setAuditioningPlugin(RealTimePluginInstance *plugin) 658 AudioCallbackPlaySource::setAuditioningPlugin(RealTimePluginInstance *plugin)
648 { 659 {
649 RealTimePluginInstance *formerPlugin = m_auditioningPlugin; 660 RealTimePluginInstance *formerPlugin = m_auditioningPlugin;
650 m_auditioningPlugin = plugin; 661 m_auditioningPlugin = plugin;
662 m_auditioningPluginBypassed = false;
651 if (formerPlugin) m_pluginScavenger.claim(formerPlugin); 663 if (formerPlugin) m_pluginScavenger.claim(formerPlugin);
652 } 664 }
653 665
654 size_t 666 size_t
655 AudioCallbackPlaySource::getTargetSampleRate() const 667 AudioCallbackPlaySource::getTargetSampleRate() const
868 } 880 }
869 881
870 void 882 void
871 AudioCallbackPlaySource::applyAuditioningEffect(size_t count, float **buffers) 883 AudioCallbackPlaySource::applyAuditioningEffect(size_t count, float **buffers)
872 { 884 {
885 if (m_auditioningPluginBypassed) return;
873 RealTimePluginInstance *plugin = m_auditioningPlugin; 886 RealTimePluginInstance *plugin = m_auditioningPlugin;
874 if (!plugin) return; 887 if (!plugin) return;
875 888
876 if (plugin->getAudioInputCount() != getTargetChannelCount()) { 889 if (plugin->getAudioInputCount() != getTargetChannelCount()) {
877 std::cerr << "plugin input count " << plugin->getAudioInputCount() 890 std::cerr << "plugin input count " << plugin->getAudioInputCount()