comparison framework/MainWindowBase.cpp @ 468:56acd9368532 bqaudioio

Initial work toward switching to bqaudioio library (so as to get I/O, not just O)
author Chris Cannam
date Tue, 04 Aug 2015 13:27:42 +0100
parents 549f77216048
children 4480b031fe38 f93820d36cb0 82d7e5cf7517
comparison
equal deleted inserted replaced
466:45054b36ddbf 468:56acd9368532
45 #include "widgets/MIDIFileImportDialog.h" 45 #include "widgets/MIDIFileImportDialog.h"
46 #include "widgets/CSVFormatDialog.h" 46 #include "widgets/CSVFormatDialog.h"
47 #include "widgets/ModelDataTableDialog.h" 47 #include "widgets/ModelDataTableDialog.h"
48 #include "widgets/InteractiveFileFinder.h" 48 #include "widgets/InteractiveFileFinder.h"
49 49
50 #include "audioio/AudioCallbackPlaySource.h" 50 #include "audio/AudioCallbackPlaySource.h"
51 #include "audioio/AudioCallbackPlayTarget.h" 51 #include "audio/PlaySpeedRangeMapper.h"
52 #include "audioio/AudioTargetFactory.h"
53 #include "audioio/PlaySpeedRangeMapper.h"
54 #include "data/fileio/DataFileReaderFactory.h" 52 #include "data/fileio/DataFileReaderFactory.h"
55 #include "data/fileio/PlaylistFileReader.h" 53 #include "data/fileio/PlaylistFileReader.h"
56 #include "data/fileio/WavFileWriter.h" 54 #include "data/fileio/WavFileWriter.h"
57 #include "data/fileio/MIDIFileWriter.h" 55 #include "data/fileio/MIDIFileWriter.h"
58 #include "data/fileio/BZipFileDevice.h" 56 #include "data/fileio/BZipFileDevice.h"
72 #include "base/Exceptions.h" 70 #include "base/Exceptions.h"
73 #include "base/ResourceFinder.h" 71 #include "base/ResourceFinder.h"
74 72
75 #include "data/osc/OSCQueue.h" 73 #include "data/osc/OSCQueue.h"
76 #include "data/midi/MIDIInput.h" 74 #include "data/midi/MIDIInput.h"
75
76 #include <bqaudioio/SystemPlaybackTarget.h>
77 #include <bqaudioio/AudioFactory.h>
77 78
78 #include <QApplication> 79 #include <QApplication>
79 #include <QMessageBox> 80 #include <QMessageBox>
80 #include <QGridLayout> 81 #include <QGridLayout>
81 #include <QLabel> 82 #include <QLabel>
266 } 267 }
267 268
268 MainWindowBase::~MainWindowBase() 269 MainWindowBase::~MainWindowBase()
269 { 270 {
270 SVDEBUG << "MainWindowBase::~MainWindowBase" << endl; 271 SVDEBUG << "MainWindowBase::~MainWindowBase" << endl;
271 if (m_playTarget) m_playTarget->shutdown(); 272 delete m_playTarget;
272 // delete m_playTarget;
273 delete m_playSource; 273 delete m_playSource;
274 delete m_viewManager; 274 delete m_viewManager;
275 delete m_oscQueue; 275 delete m_oscQueue;
276 delete m_oscQueueStarter; 276 delete m_oscQueueStarter;
277 delete m_midiInput; 277 delete m_midiInput;
2162 void 2162 void
2163 MainWindowBase::createPlayTarget() 2163 MainWindowBase::createPlayTarget()
2164 { 2164 {
2165 if (m_playTarget) return; 2165 if (m_playTarget) return;
2166 2166
2167 //!!! how to handle preferences
2168 /*
2167 QSettings settings; 2169 QSettings settings;
2168 settings.beginGroup("Preferences"); 2170 settings.beginGroup("Preferences");
2169 QString targetName = settings.value("audio-target", "").toString(); 2171 QString targetName = settings.value("audio-target", "").toString();
2170 settings.endGroup(); 2172 settings.endGroup();
2171
2172 AudioTargetFactory *factory = AudioTargetFactory::getInstance(); 2173 AudioTargetFactory *factory = AudioTargetFactory::getInstance();
2173 2174
2174 factory->setDefaultCallbackTarget(targetName); 2175 factory->setDefaultCallbackTarget(targetName);
2175 m_playTarget = factory->createCallbackTarget(m_playSource); 2176 */
2177
2178 m_playTarget =
2179 breakfastquay::AudioFactory::createCallbackPlayTarget(m_playSource);
2180
2181 m_playSource->setSystemPlaybackTarget(m_playTarget);
2176 2182
2177 if (!m_playTarget) { 2183 if (!m_playTarget) {
2178 emit hideSplash(); 2184 emit hideSplash();
2179 2185
2180 if (factory->isAutoCallbackTarget(targetName)) { 2186 // if (factory->isAutoCallbackTarget(targetName)) {
2181 QMessageBox::warning 2187 QMessageBox::warning
2182 (this, tr("Couldn't open audio device"), 2188 (this, tr("Couldn't open audio device"),
2183 tr("<b>No audio available</b><p>Could not open an audio device for playback.<p>Automatic audio device detection failed. Audio playback will not be available during this session.</p>"), 2189 tr("<b>No audio available</b><p>Could not open an audio device for playback.<p>Automatic audio device detection failed. Audio playback will not be available during this session.</p>"),
2184 QMessageBox::Ok); 2190 QMessageBox::Ok);
2191 /*
2185 } else { 2192 } else {
2186 QMessageBox::warning 2193 QMessageBox::warning
2187 (this, tr("Couldn't open audio device"), 2194 (this, tr("Couldn't open audio device"),
2188 tr("<b>No audio available</b><p>Failed to open your preferred audio device (\"%1\").<p>Audio playback will not be available during this session.</p>") 2195 tr("<b>No audio available</b><p>Failed to open your preferred audio device (\"%1\").<p>Audio playback will not be available during this session.</p>")
2189 .arg(factory->getCallbackTargetDescription(targetName)), 2196 .arg(factory->getCallbackTargetDescription(targetName)),
2190 QMessageBox::Ok); 2197 QMessageBox::Ok);
2191 } 2198 }
2199 */
2192 } 2200 }
2193 } 2201 }
2194 2202
2195 WaveFileModel * 2203 WaveFileModel *
2196 MainWindowBase::getMainModel() 2204 MainWindowBase::getMainModel()