comparison audio/AudioCallbackPlaySource.cpp @ 737:497d80d3b9c4

More useful error reporting in cases where auditioning plugin fails
author Chris Cannam
date Wed, 05 Feb 2020 12:33:24 +0000
parents ce698f8d0831
children 48001ed9143b 75390b1ebd2c
comparison
equal deleted inserted replaced
736:4b58b8f44be7 737:497d80d3b9c4
73 m_outputLeft(0.0), 73 m_outputLeft(0.0),
74 m_outputRight(0.0), 74 m_outputRight(0.0),
75 m_levelsSet(false), 75 m_levelsSet(false),
76 m_auditioningPlugin(nullptr), 76 m_auditioningPlugin(nullptr),
77 m_auditioningPluginBypassed(false), 77 m_auditioningPluginBypassed(false),
78 m_auditioningPluginFailed(false),
78 m_playStartFrame(0), 79 m_playStartFrame(0),
79 m_playStartFramePassed(false), 80 m_playStartFramePassed(false),
80 m_timeStretcher(nullptr), 81 m_timeStretcher(nullptr),
81 m_monoStretcher(nullptr), 82 m_monoStretcher(nullptr),
82 m_stretchRatio(1.0), 83 m_stretchRatio(1.0),
1010 } 1011 }
1011 1012
1012 m_mutex.lock(); 1013 m_mutex.lock();
1013 m_auditioningPlugin = plugin; 1014 m_auditioningPlugin = plugin;
1014 m_auditioningPluginBypassed = false; 1015 m_auditioningPluginBypassed = false;
1016 m_auditioningPluginFailed = false;
1015 m_mutex.unlock(); 1017 m_mutex.unlock();
1018
1019 SVDEBUG << "AudioCallbackPlaySource::setAuditioningEffect: set plugin to "
1020 << plugin << " and bypassed to " << m_auditioningPluginBypassed
1021 << endl;
1016 } 1022 }
1017 1023
1018 void 1024 void
1019 AudioCallbackPlaySource::setSoloModelSet(std::set<ModelId> s) 1025 AudioCallbackPlaySource::setSoloModelSet(std::set<ModelId> s)
1020 { 1026 {
1362 AudioCallbackPlaySource::applyAuditioningEffect(sv_frame_t count, float *const *buffers) 1368 AudioCallbackPlaySource::applyAuditioningEffect(sv_frame_t count, float *const *buffers)
1363 { 1369 {
1364 if (m_auditioningPluginBypassed) return; 1370 if (m_auditioningPluginBypassed) return;
1365 RealTimePluginInstance *plugin = m_auditioningPlugin; 1371 RealTimePluginInstance *plugin = m_auditioningPlugin;
1366 if (!plugin) return; 1372 if (!plugin) return;
1373
1374 if ((int)plugin->getAudioInputCount() != getTargetChannelCount()) {
1375 if (!m_auditioningPluginFailed) {
1376 SVCERR << "AudioCallbackPlaySource::applyAuditioningEffect: "
1377 << "Can't run plugin: plugin input count "
1378 << plugin->getAudioInputCount()
1379 << " != our channel count " << getTargetChannelCount()
1380 << " (future errors for this plugin will be suppressed)"
1381 << endl;
1382 m_auditioningPluginFailed = true;
1383 }
1384 return;
1385 }
1386 if ((int)plugin->getAudioOutputCount() != getTargetChannelCount()) {
1387 if (!m_auditioningPluginFailed) {
1388 SVCERR << "AudioCallbackPlaySource::applyAuditioningEffect: "
1389 << "Can't run plugin: plugin output count "
1390 << plugin->getAudioOutputCount()
1391 << " != our channel count " << getTargetChannelCount()
1392 << " (future errors for this plugin will be suppressed)"
1393 << endl;
1394 m_auditioningPluginFailed = true;
1395 }
1396 return;
1397 }
1398 if ((int)plugin->getBufferSize() < count) {
1399 if (!m_auditioningPluginFailed) {
1400 SVCERR << "AudioCallbackPlaySource::applyAuditioningEffect: "
1401 << "Can't run plugin: plugin buffer size "
1402 << plugin->getBufferSize()
1403 << " < our block size " << count
1404 << " (future errors for this plugin will be suppressed)"
1405 << endl;
1406 m_auditioningPluginFailed = true;
1407 }
1408 return;
1409 }
1367 1410
1368 if ((int)plugin->getAudioInputCount() != getTargetChannelCount()) {
1369 // cout << "plugin input count " << plugin->getAudioInputCount()
1370 // << " != our channel count " << getTargetChannelCount()
1371 // << endl;
1372 return;
1373 }
1374 if ((int)plugin->getAudioOutputCount() != getTargetChannelCount()) {
1375 // cout << "plugin output count " << plugin->getAudioOutputCount()
1376 // << " != our channel count " << getTargetChannelCount()
1377 // << endl;
1378 return;
1379 }
1380 if ((int)plugin->getBufferSize() < count) {
1381 // cout << "plugin buffer size " << plugin->getBufferSize()
1382 // << " < our block size " << count
1383 // << endl;
1384 return;
1385 }
1386
1387 float **ib = plugin->getAudioInputBuffers(); 1411 float **ib = plugin->getAudioInputBuffers();
1388 float **ob = plugin->getAudioOutputBuffers(); 1412 float **ob = plugin->getAudioOutputBuffers();
1389 1413
1390 for (int c = 0; c < getTargetChannelCount(); ++c) { 1414 for (int c = 0; c < getTargetChannelCount(); ++c) {
1391 for (int i = 0; i < count; ++i) { 1415 for (int i = 0; i < count; ++i) {