Mercurial > hg > sonic-visualiser
changeset 46:47bff9f88882
* Add --no-audio option to avoid opening any audio output device
author | Chris Cannam |
---|---|
date | Thu, 05 Oct 2006 11:01:36 +0000 |
parents | 6b6bca31ad53 |
children | 5c6d38edb163 |
files | main/MainWindow.cpp main/MainWindow.h main/main.cpp |
diffstat | 3 files changed, 21 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/main/MainWindow.cpp Thu Oct 05 11:00:59 2006 +0000 +++ b/main/MainWindow.cpp Thu Oct 05 11:01:36 2006 +0000 @@ -93,12 +93,13 @@ using std::set; -MainWindow::MainWindow() : +MainWindow::MainWindow(bool withAudioOutput) : m_document(0), m_paneStack(0), m_viewManager(0), m_panner(0), m_timeRulerLayer(0), + m_audioOutput(withAudioOutput), m_playSource(0), m_playTarget(0), m_recentFiles("RecentFiles"), @@ -3220,7 +3221,7 @@ updateDescriptionLabel(); m_panLayer->setModel(model); if (model) m_viewManager->setMainModelSampleRate(model->getSampleRate()); - if (model && !m_playTarget) createPlayTarget(); + if (model && !m_playTarget && m_audioOutput) createPlayTarget(); } void
--- a/main/MainWindow.h Thu Oct 05 11:00:59 2006 +0000 +++ b/main/MainWindow.h Thu Oct 05 11:01:36 2006 +0000 @@ -55,7 +55,7 @@ Q_OBJECT public: - MainWindow(); + MainWindow(bool withAudioOutput = true); virtual ~MainWindow(); enum AudioFileOpenMode { @@ -215,6 +215,7 @@ WaveformLayer *m_panLayer; Layer *m_timeRulerLayer; + bool m_audioOutput; AudioCallbackPlaySource *m_playSource; AudioCallbackPlayTarget *m_playTarget;
--- a/main/main.cpp Thu Oct 05 11:00:59 2006 +0000 +++ b/main/main.cpp Thu Oct 05 11:01:36 2006 +0000 @@ -78,6 +78,8 @@ { SVApplication application(argc, argv); + QStringList args = application.arguments(); + signal(SIGINT, signalHandler); signal(SIGTERM, signalHandler); @@ -88,6 +90,9 @@ svSystemSpecificInitialisation(); + bool audioOutput = true; + if (args.contains("--no-audio")) audioOutput = false; + QApplication::setOrganizationName("sonic-visualiser"); QApplication::setOrganizationDomain("sonicvisualiser.org"); QApplication::setApplicationName("sonic-visualiser"); @@ -112,7 +117,7 @@ qRegisterMetaType<size_t>("size_t"); qRegisterMetaType<PropertyContainer::PropertyName>("PropertyContainer::PropertyName"); - MainWindow gui; + MainWindow gui(audioOutput); application.setMainWindow(&gui); QDesktopWidget *desktop = QApplication::desktop(); @@ -134,8 +139,16 @@ gui.show(); - if (argc > 1) { - QString path = argv[1]; + QString path; + for (QStringList::iterator i = args.begin(); i != args.end(); ++i) { + if (i == args.begin()) continue; + if (!i->startsWith('-')) { + path = *i; + break; + } + } + + if (!path.isEmpty()) { bool success = false; if (path.endsWith(".sv")) { success = gui.openSessionFile(path);