changeset 494:ffb9df50a761 2.0-integration

Merge from recording branch
author Chris Cannam
date Mon, 12 Oct 2015 14:06:39 +0100
parents cb24473eadc5 (current diff) 6e484c58ca25 (diff)
children e8e9a6a59438
files
diffstat 6 files changed, 56 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/bq.pro	Mon Oct 12 14:06:18 2015 +0100
+++ b/bq.pro	Mon Oct 12 14:06:39 2015 +0100
@@ -12,6 +12,7 @@
 mac* {
     INCLUDEPATH += sv-dependency-builds/osx/include
     LIBS += -Lsv-dependency-builds/osx/lib
+    DEFINES += HAVE_POSIX_MEMALIGN LACK_SINCOS
 }
 
 exists(config.pri) {
@@ -23,7 +24,7 @@
     CONFIG += release
     DEFINES += NDEBUG BUILD_RELEASE NO_TIMING
 
-    DEFINES += HAVE_BZ2 HAVE_FFTW3 HAVE_FFTW3F HAVE_SNDFILE HAVE_SAMPLERATE HAVE_VAMP HAVE_VAMPHOSTSDK HAVE_RUBBERBAND HAVE_DATAQUAY HAVE_LIBLO HAVE_MAD HAVE_ID3TAG HAVE_PORTAUDIO
+    DEFINES += HAVE_BZ2 HAVE_FFTW3 HAVE_FFTW3F HAVE_SNDFILE HAVE_LIBSAMPLERATE HAVE_VAMP HAVE_VAMPHOSTSDK HAVE_RUBBERBAND HAVE_DATAQUAY HAVE_LIBLO HAVE_MAD HAVE_ID3TAG HAVE_PORTAUDIO
 
     LIBS += -lbz2 -lrubberband -lvamp-hostsdk -lfftw3 -lfftw3f -lsndfile -lFLAC -logg -lvorbis -lvorbisenc -lvorbisfile -logg -lmad -lid3tag -lportaudio -lsamplerate -lz -lsord-0 -lserd-0 -llo
 
--- a/deploy/osx/copy-qt.sh	Mon Oct 12 14:06:18 2015 +0100
+++ b/deploy/osx/copy-qt.sh	Mon Oct 12 14:06:39 2015 +0100
@@ -9,7 +9,7 @@
 	exit 2
 fi
 
-frameworks="QtCore QtNetwork QtGui QtXml QtWidgets QtPrintSupport"
+frameworks="QtCore QtNetwork QtGui QtXml QtSvg QtWidgets QtPrintSupport"
 
 plugins="dds gif icns ico jp2 jpeg mng tga tiff wbmp webp cocoa minimal offscreen"
 
--- a/deploy/osx/paths.sh	Mon Oct 12 14:06:18 2015 +0100
+++ b/deploy/osx/paths.sh	Mon Oct 12 14:06:39 2015 +0100
@@ -9,7 +9,7 @@
 	exit 2
 fi
 
-frameworks="QtCore QtNetwork QtGui QtXml QtWidgets QtPrintSupport"
+frameworks="QtCore QtNetwork QtGui QtXml QtSvg QtWidgets QtPrintSupport"
 
 echo
 echo "I expect you to have already copied these frameworks from the Qt installation to"
--- a/src/MainWindow.cpp	Mon Oct 12 14:06:18 2015 +0100
+++ b/src/MainWindow.cpp	Mon Oct 12 14:06:39 2015 +0100
@@ -67,6 +67,7 @@
 #include "plugin/api/dssi.h"
 
 #include <bqaudioio/SystemPlaybackTarget.h>
+#include <bqaudioio/SystemAudioIO.h>
 
 #include <QApplication>
 #include <QMessageBox>
@@ -299,6 +300,8 @@
     connect(this, SIGNAL(audioFileLoaded()), this, SLOT(analyseNewMainModel()));
     m_activityLog->hide();
 
+    setAudioRecordMode(RecordReplaceSession);
+    
     newSession();
 
     settings.beginGroup("MainWindow");
@@ -414,7 +417,7 @@
     menu->addAction(action);
     toolbar->addAction(action);
 
-    action = new QAction(tr("Save Session to Audio &Path"), this);
+    action = new QAction(tr("Save Session to Audio File &Path"), this);
     action->setShortcut(tr("Ctrl+Alt+S"));
     action->setStatusTip(tr("Save the current session into a %1 session file with the same filename as the audio but a .ton extension.").arg(QApplication::applicationName()));
     connect(action, SIGNAL(triggered()), this, SLOT(saveSessionInAudioPath()));
@@ -442,6 +445,14 @@
     menu->addAction(action);
 
     menu->addSeparator();
+    
+    action = new QAction(tr("Browse Recorded Audio"), this);
+    action->setStatusTip(tr("Open the Recorded Audio folder in the system file browser"));
+    connect(action, SIGNAL(triggered()), this, SLOT(browseRecordedAudio()));
+    menu->addAction(action);
+
+    menu->addSeparator();
+
     action = new QAction(il.load("exit"), tr("&Quit"), this);
     action->setShortcut(tr("Ctrl+Q"));
     action->setStatusTip(tr("Exit %1").arg(QApplication::applicationName()));
@@ -1020,6 +1031,17 @@
     connect(ffwdEndAction, SIGNAL(triggered()), this, SLOT(ffwdEnd()));
     connect(this, SIGNAL(canPlay(bool)), ffwdEndAction, SLOT(setEnabled(bool)));
 
+    QAction *recordAction = toolbar->addAction(il.load("record"),
+                                               tr("Record"));
+    recordAction->setCheckable(true);
+    recordAction->setShortcut(tr("Ctrl+Space"));
+    recordAction->setStatusTip(tr("Record a new audio file"));
+    connect(recordAction, SIGNAL(triggered()), this, SLOT(record()));
+    connect(m_recordTarget, SIGNAL(recordStatusChanged(bool)),
+	    recordAction, SLOT(setChecked(bool)));
+    connect(this, SIGNAL(canRecord(bool)),
+            recordAction, SLOT(setEnabled(bool)));
+
     toolbar = addToolBar(tr("Play Mode Toolbar"));
 
     QAction *psAction = toolbar->addAction(il.load("playselection"),
@@ -1071,10 +1093,12 @@
     m_keyReference->registerShortcut(psAction);
     m_keyReference->registerShortcut(plAction);
     m_keyReference->registerShortcut(playAction);
+    m_keyReference->registerShortcut(recordAction);
     m_keyReference->registerShortcut(m_rwdAction);
     m_keyReference->registerShortcut(m_ffwdAction);
     m_keyReference->registerShortcut(rwdStartAction);
     m_keyReference->registerShortcut(ffwdEndAction);
+    m_keyReference->registerShortcut(recordAction);
     m_keyReference->registerShortcut(oneLeftAction);
     m_keyReference->registerShortcut(oneRightAction);
     m_keyReference->registerShortcut(selectOneLeftAction);
@@ -1095,6 +1119,8 @@
     menu->addAction(selectOneLeftAction);
     menu->addAction(selectOneRightAction);
     menu->addSeparator();
+    menu->addAction(recordAction);
+    menu->addSeparator();
 
     m_rightButtonPlaybackMenu->addAction(playAction);
     m_rightButtonPlaybackMenu->addAction(psAction);
@@ -1111,6 +1137,8 @@
     m_rightButtonPlaybackMenu->addAction(selectOneLeftAction);
     m_rightButtonPlaybackMenu->addAction(selectOneRightAction);
     m_rightButtonPlaybackMenu->addSeparator();
+    m_rightButtonPlaybackMenu->addAction(recordAction);
+    m_rightButtonPlaybackMenu->addSeparator();
 
     QAction *fastAction = menu->addAction(tr("Speed Up"));
     fastAction->setShortcut(tr("Ctrl+PgUp"));
@@ -1361,7 +1389,7 @@
     bool haveMainModel =
 	(getMainModel() != 0);
     bool havePlayTarget =
-	(m_playTarget != 0);
+	(m_playTarget != 0 || m_audioIO != 0);
     bool haveCurrentPane =
         (currentPane != 0);
     bool haveCurrentLayer =
@@ -1400,6 +1428,10 @@
     emit canExportNotes(haveNotes);
     emit canSnapNotes(haveSelection && haveNotes);
 
+    cerr << "haveWaveform = " << haveWaveform << endl;
+    cerr << "haveMainModel = " << haveMainModel << endl;
+    cerr << "havePlayTarget = " << havePlayTarget << endl;
+    
     emit canPlayWaveform(haveWaveform && haveMainModel && havePlayTarget);
     emit canPlayPitch(havePitchTrack && haveMainModel && havePlayTarget);
     emit canPlayNotes(haveNotes && haveMainModel && havePlayTarget);
@@ -2319,6 +2351,17 @@
 }
 
 void
+MainWindow::browseRecordedAudio()
+{
+    if (!m_recordTarget) return;
+
+    QString path = m_recordTarget->getRecordFolder();
+    if (path == "") return;
+
+    openLocalFolder(path);
+}
+
+void
 MainWindow::doubleClickSelectInvoked(sv_frame_t frame)
 {
     sv_frame_t f0, f1;
@@ -2917,7 +2960,7 @@
 
     MainWindowBase::mainModelChanged(model);
 
-    if (m_playTarget) {
+    if (m_playTarget || m_audioIO) {
         connect(m_fader, SIGNAL(valueChanged(float)),
                 this, SLOT(mainModelGainChanged(float)));
     }
@@ -2928,6 +2971,8 @@
 {
     if (m_playTarget) {
         m_playTarget->setOutputGain(gain);
+    } else if (m_audioIO) {
+        m_audioIO->setOutputGain(gain);
     }
 }
 
@@ -3028,6 +3073,7 @@
     }
    
     updateLayerStatuses();
+    documentRestored();
 }
 
 void
--- a/src/MainWindow.h	Mon Oct 12 14:06:18 2015 +0100
+++ b/src/MainWindow.h	Mon Oct 12 14:06:39 2015 +0100
@@ -52,6 +52,7 @@
     virtual void exportPitchLayer();
     virtual void exportNoteLayer();
     virtual void importPitchLayer();
+    virtual void browseRecordedAudio();
     virtual void newSession();
     virtual void closeSession();
 
--- a/src/main.cpp	Mon Oct 12 14:06:18 2015 +0100
+++ b/src/main.cpp	Mon Oct 12 14:06:39 2015 +0100
@@ -209,6 +209,8 @@
 
     InteractiveFileFinder::getInstance()->setApplicationSessionExtension("ton");
 
+    QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
+
     QSplashScreen *splash = 0;
     // If we had a splash screen, we would show it here