Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 746:771ec060c1d2
Merge from branch audio-source-refactor. Pull out auditioning effect wrapper and time stretch wrapper from play source; corresponding changes to plugin memory management etc.
author | Chris Cannam |
---|---|
date | Fri, 03 Apr 2020 12:14:05 +0100 |
parents | 7b1d30af4b38 48001ed9143b |
children | baa7d3a85317 |
comparison
equal
deleted
inserted
replaced
743:7b1d30af4b38 | 746:771ec060c1d2 |
---|---|
80 #include "system/System.h" | 80 #include "system/System.h" |
81 | 81 |
82 #include <bqaudioio/SystemPlaybackTarget.h> | 82 #include <bqaudioio/SystemPlaybackTarget.h> |
83 #include <bqaudioio/SystemAudioIO.h> | 83 #include <bqaudioio/SystemAudioIO.h> |
84 #include <bqaudioio/AudioFactory.h> | 84 #include <bqaudioio/AudioFactory.h> |
85 #include <bqaudioio/ResamplerWrapper.h> | |
86 | 85 |
87 #include <QApplication> | 86 #include <QApplication> |
88 #include <QMessageBox> | 87 #include <QMessageBox> |
89 #include <QGridLayout> | 88 #include <QGridLayout> |
90 #include <QLabel> | 89 #include <QLabel> |
149 m_timeRulerLayer(nullptr), | 148 m_timeRulerLayer(nullptr), |
150 m_audioMode(audioMode), | 149 m_audioMode(audioMode), |
151 m_midiMode(midiMode), | 150 m_midiMode(midiMode), |
152 m_playSource(nullptr), | 151 m_playSource(nullptr), |
153 m_recordTarget(nullptr), | 152 m_recordTarget(nullptr), |
154 m_resamplerWrapper(nullptr), | |
155 m_playTarget(nullptr), | 153 m_playTarget(nullptr), |
156 m_audioIO(nullptr), | 154 m_audioIO(nullptr), |
157 m_oscQueue(nullptr), | 155 m_oscQueue(nullptr), |
158 m_oscQueueStarter(nullptr), | 156 m_oscQueueStarter(nullptr), |
159 m_oscScript(nullptr), | 157 m_oscScript(nullptr), |
2570 SVCERR << "createAudioIO: Preferred playback device = \"" | 2568 SVCERR << "createAudioIO: Preferred playback device = \"" |
2571 << preference.playbackDevice << "\"" << endl; | 2569 << preference.playbackDevice << "\"" << endl; |
2572 SVCERR << "createAudioIO: Preferred record device = \"" | 2570 SVCERR << "createAudioIO: Preferred record device = \"" |
2573 << preference.recordDevice << "\"" << endl; | 2571 << preference.recordDevice << "\"" << endl; |
2574 | 2572 |
2575 if (!m_resamplerWrapper) { | 2573 breakfastquay::ApplicationPlaybackSource *source = |
2576 m_resamplerWrapper = new breakfastquay::ResamplerWrapper(m_playSource); | 2574 m_playSource->getApplicationPlaybackSource(); |
2577 m_playSource->setResamplerWrapper(m_resamplerWrapper); | |
2578 } | |
2579 | 2575 |
2580 std::string errorString; | 2576 std::string errorString; |
2581 | 2577 |
2582 if (m_audioMode == AUDIO_PLAYBACK_AND_RECORD) { | 2578 if (m_audioMode == AUDIO_PLAYBACK_AND_RECORD) { |
2583 m_audioIO = breakfastquay::AudioFactory:: | 2579 m_audioIO = breakfastquay::AudioFactory:: |
2584 createCallbackIO(m_recordTarget, m_resamplerWrapper, | 2580 createCallbackIO(m_recordTarget, source, preference, errorString); |
2585 preference, errorString); | |
2586 if (m_audioIO) { | 2581 if (m_audioIO) { |
2587 SVCERR << "MainWindowBase::createAudioIO: Suspending on creation" << endl; | 2582 SVCERR << "MainWindowBase::createAudioIO: Suspending on creation" << endl; |
2588 m_audioIO->suspend(); // start in suspended state | 2583 m_audioIO->suspend(); // start in suspended state |
2589 m_playSource->setSystemPlaybackTarget(m_audioIO); | 2584 m_playSource->setSystemPlaybackTarget(m_audioIO); |
2590 } else { | 2585 } else { |
2595 } | 2590 } |
2596 } | 2591 } |
2597 | 2592 |
2598 if (!m_audioIO) { | 2593 if (!m_audioIO) { |
2599 m_playTarget = breakfastquay::AudioFactory:: | 2594 m_playTarget = breakfastquay::AudioFactory:: |
2600 createCallbackPlayTarget(m_resamplerWrapper, | 2595 createCallbackPlayTarget(source, preference, errorString); |
2601 preference, errorString); | |
2602 if (m_playTarget) { | 2596 if (m_playTarget) { |
2603 SVCERR << "MainWindowBase::createAudioIO: Suspending on creation" << endl; | 2597 SVCERR << "MainWindowBase::createAudioIO: Suspending on creation" << endl; |
2604 m_playTarget->suspend(); // start in suspended state | 2598 m_playTarget->suspend(); // start in suspended state |
2605 m_playSource->setSystemPlaybackTarget(m_playTarget); | 2599 m_playSource->setSystemPlaybackTarget(m_playTarget); |
2606 } | 2600 } |
2650 MainWindowBase::deleteAudioIO() | 2644 MainWindowBase::deleteAudioIO() |
2651 { | 2645 { |
2652 // First prevent this trying to call target. | 2646 // First prevent this trying to call target. |
2653 if (m_playSource) { | 2647 if (m_playSource) { |
2654 m_playSource->setSystemPlaybackTarget(nullptr); | 2648 m_playSource->setSystemPlaybackTarget(nullptr); |
2655 m_playSource->setResamplerWrapper(nullptr); | |
2656 } | 2649 } |
2657 | 2650 |
2658 // Then delete the breakfastquay::System object. | 2651 // Then delete the breakfastquay::System object. |
2659 // Only one of these two exists! | 2652 // Only one of these two exists! |
2660 delete m_audioIO; | 2653 delete m_audioIO; |
2661 delete m_playTarget; | 2654 delete m_playTarget; |
2662 | 2655 |
2663 // And the breakfastquay resampler wrapper. We need to | |
2664 // delete/recreate this if the channel count changes, which is one | |
2665 // of the use cases for recreateAudioIO() calling this | |
2666 delete m_resamplerWrapper; | |
2667 | |
2668 m_audioIO = nullptr; | 2656 m_audioIO = nullptr; |
2669 m_playTarget = nullptr; | 2657 m_playTarget = nullptr; |
2670 m_resamplerWrapper = nullptr; | |
2671 } | 2658 } |
2672 | 2659 |
2673 void | 2660 void |
2674 MainWindowBase::recreateAudioIO() | 2661 MainWindowBase::recreateAudioIO() |
2675 { | 2662 { |