changeset 366:6439ca6e7de1

switching of sonification and spectrogram via command line argument
author matthiasm
date Tue, 15 Jul 2014 18:12:48 +0100
parents fec4dafd9093
children 3c8dccd0cafe
files .hgsubstate src/MainWindow.cpp src/main.cpp
diffstat 3 files changed, 115 insertions(+), 81 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Tue Jul 15 15:42:46 2014 +0100
+++ b/.hgsubstate	Tue Jul 15 18:12:48 2014 +0100
@@ -4,4 +4,4 @@
 553a5f65ef64811747a6613f759622d655db63c1 sv-dependency-builds
 d8bde801ebd40d722df379eee3b40729d3b78380 svapp
 178ffa964096f32ace219b21e0fb2e7e71bde1a2 svcore
-24f18a7dd26d0cb175adfa807b606ace84795327 svgui
+ec0906aef9bf5542603135efa6078f66715490b9 svgui
--- a/src/MainWindow.cpp	Tue Jul 15 15:42:46 2014 +0100
+++ b/src/MainWindow.cpp	Tue Jul 15 18:12:48 2014 +0100
@@ -256,41 +256,44 @@
     connect(m_gainAudio, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
     connect(m_gainAudio, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
 
-    m_gainPitch = new AudioDial(frame);
-    m_gainPitch->setMeterColor(Qt::darkRed);
-    m_gainPitch->setMinimum(-50);
-    m_gainPitch->setMaximum(50);
-    m_gainPitch->setValue(0);
-    m_gainPitch->setDefaultValue(0);
-    m_gainPitch->setFixedWidth(24);
-    m_gainPitch->setFixedHeight(24);
-    m_gainPitch->setNotchesVisible(true);
-    m_gainPitch->setPageStep(10);
-    m_gainPitch->setObjectName(tr("Pitch Track Gain"));
-    m_gainPitch->setRangeMapper(new LinearRangeMapper(-50, 50, -25, 25, tr("dB")));
-    m_gainPitch->setShowToolTip(true);
-    connect(m_gainPitch, SIGNAL(valueChanged(int)),
-            this, SLOT(pitchGainChanged(int)));
-    connect(m_gainPitch, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
-    connect(m_gainPitch, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
-
-    m_gainNotes = new AudioDial(frame);
-    m_gainNotes->setMeterColor(Qt::darkRed);
-    m_gainNotes->setMinimum(-50);
-    m_gainNotes->setMaximum(50);
-    m_gainNotes->setValue(0);
-    m_gainNotes->setDefaultValue(0);
-    m_gainNotes->setFixedWidth(24);
-    m_gainNotes->setFixedHeight(24);
-    m_gainNotes->setNotchesVisible(true);
-    m_gainNotes->setPageStep(10);
-    m_gainNotes->setObjectName(tr("Note Gain"));
-    m_gainNotes->setRangeMapper(new LinearRangeMapper(-50, 50, -25, 25, tr("dB")));
-    m_gainNotes->setShowToolTip(true);
-    connect(m_gainNotes, SIGNAL(valueChanged(int)),
-            this, SLOT(notesGainChanged(int)));
-    connect(m_gainNotes, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
-    connect(m_gainNotes, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
+    if (m_withSonification)
+    {   
+        m_gainPitch = new AudioDial(frame);
+        m_gainPitch->setMeterColor(Qt::darkRed);
+        m_gainPitch->setMinimum(-50);
+        m_gainPitch->setMaximum(50);
+        m_gainPitch->setValue(0);
+        m_gainPitch->setDefaultValue(0);
+        m_gainPitch->setFixedWidth(24);
+        m_gainPitch->setFixedHeight(24);
+        m_gainPitch->setNotchesVisible(true);
+        m_gainPitch->setPageStep(10);
+        m_gainPitch->setObjectName(tr("Pitch Track Gain"));
+        m_gainPitch->setRangeMapper(new LinearRangeMapper(-50, 50, -25, 25, tr("dB")));
+        m_gainPitch->setShowToolTip(true);
+        connect(m_gainPitch, SIGNAL(valueChanged(int)),
+                this, SLOT(pitchGainChanged(int)));
+        connect(m_gainPitch, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
+        connect(m_gainPitch, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
+
+        m_gainNotes = new AudioDial(frame);
+        m_gainNotes->setMeterColor(Qt::darkRed);
+        m_gainNotes->setMinimum(-50);
+        m_gainNotes->setMaximum(50);
+        m_gainNotes->setValue(0);
+        m_gainNotes->setDefaultValue(0);
+        m_gainNotes->setFixedWidth(24);
+        m_gainNotes->setFixedHeight(24);
+        m_gainNotes->setNotchesVisible(true);
+        m_gainNotes->setPageStep(10);
+        m_gainNotes->setObjectName(tr("Note Gain"));
+        m_gainNotes->setRangeMapper(new LinearRangeMapper(-50, 50, -25, 25, tr("dB")));
+        m_gainNotes->setShowToolTip(true);
+        connect(m_gainNotes, SIGNAL(valueChanged(int)),
+                this, SLOT(notesGainChanged(int)));
+        connect(m_gainNotes, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
+        connect(m_gainNotes, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
+    }
     // End of Gain controls
 
     // Pan controls
@@ -313,41 +316,47 @@
     connect(m_panAudio, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
     connect(m_panAudio, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
 
-    m_panPitch = new AudioDial(frame);
-    m_panPitch->setMeterColor(Qt::darkGreen);
-    m_panPitch->setMinimum(-100);
-    m_panPitch->setMaximum(100);
-    m_panPitch->setValue(100);
-    m_panPitch->setDefaultValue(100);
-    m_panPitch->setFixedWidth(24);
-    m_panPitch->setFixedHeight(24);
-    m_panPitch->setNotchesVisible(true);
-    m_panPitch->setPageStep(10);
-    m_panPitch->setObjectName(tr("Pitch Track Pan"));
-    m_panPitch->setRangeMapper(new LinearRangeMapper(-100, 100, -100, 100, tr("")));
-    m_panPitch->setShowToolTip(true);
-    connect(m_panPitch, SIGNAL(valueChanged(int)),
-            this, SLOT(pitchPanChanged(int)));
-    connect(m_panPitch, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
-    connect(m_panPitch, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
-
-    m_panNotes = new AudioDial(frame);
-    m_panNotes->setMeterColor(Qt::darkGreen);
-    m_panNotes->setMinimum(-100);
-    m_panNotes->setMaximum(100);
-    m_panNotes->setValue(100);
-    m_panNotes->setDefaultValue(100);
-    m_panNotes->setFixedWidth(24);
-    m_panNotes->setFixedHeight(24);
-    m_panNotes->setNotchesVisible(true);
-    m_panNotes->setPageStep(10);
-    m_panNotes->setObjectName(tr("Note Pan"));
-    m_panNotes->setRangeMapper(new LinearRangeMapper(-100, 100, -100, 100, tr("")));
-    m_panNotes->setShowToolTip(true);
-    connect(m_panNotes, SIGNAL(valueChanged(int)),
-            this, SLOT(notesPanChanged(int)));
-    connect(m_panNotes, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
-    connect(m_panNotes, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
+
+
+    if (m_withSonification)
+    {   
+        m_panPitch = new AudioDial(frame);
+        m_panPitch->setMeterColor(Qt::darkGreen);
+        m_panPitch->setMinimum(-100);
+        m_panPitch->setMaximum(100);
+        m_panPitch->setValue(100);
+        m_panPitch->setDefaultValue(100);
+        m_panPitch->setFixedWidth(24);
+        m_panPitch->setFixedHeight(24);
+        m_panPitch->setNotchesVisible(true);
+        m_panPitch->setPageStep(10);
+        m_panPitch->setObjectName(tr("Pitch Track Pan"));
+        m_panPitch->setRangeMapper(new LinearRangeMapper(-100, 100, -100, 100, tr("")));
+        m_panPitch->setShowToolTip(true);
+        connect(m_panPitch, SIGNAL(valueChanged(int)),
+                this, SLOT(pitchPanChanged(int)));
+        connect(m_panPitch, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
+        connect(m_panPitch, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
+
+        m_panNotes = new AudioDial(frame);
+        m_panNotes->setMeterColor(Qt::darkGreen);
+        m_panNotes->setMinimum(-100);
+        m_panNotes->setMaximum(100);
+        m_panNotes->setValue(100);
+        m_panNotes->setDefaultValue(100);
+        m_panNotes->setFixedWidth(24);
+        m_panNotes->setFixedHeight(24);
+        m_panNotes->setNotchesVisible(true);
+        m_panNotes->setPageStep(10);
+        m_panNotes->setObjectName(tr("Note Pan"));
+        m_panNotes->setRangeMapper(new LinearRangeMapper(-100, 100, -100, 100, tr("")));
+        m_panNotes->setShowToolTip(true);
+        connect(m_panNotes, SIGNAL(valueChanged(int)),
+                this, SLOT(notesPanChanged(int)));
+        connect(m_panNotes, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
+        connect(m_panNotes, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));    
+    }
+    
     // End of Pan controls
 
     layout->setSpacing(4);
@@ -1171,14 +1180,18 @@
     connect(m_showPitch, SIGNAL(triggered()), this, SLOT(showPitchToggled()));
     connect(this, SIGNAL(canPlay(bool)), m_showPitch, SLOT(setEnabled(bool)));
 
-    m_playPitch = toolbar->addAction(il.load("speaker"), tr("Play Pitch Track"));
+    if (!m_withSonification) 
+    {
+        m_playPitch = new QAction(tr("Play Pitch Track"), this);
+    } else {
+        m_playPitch = toolbar->addAction(il.load("speaker"), tr("Play Pitch Track"));
+        toolbar->addWidget(m_gainPitch);
+        toolbar->addWidget(m_panPitch);
+    }
     m_playPitch->setCheckable(true);
     connect(m_playPitch, SIGNAL(triggered()), this, SLOT(playPitchToggled()));
     connect(this, SIGNAL(canPlayPitch(bool)), m_playPitch, SLOT(setEnabled(bool)));
 
-    toolbar->addWidget(m_gainPitch);
-    toolbar->addWidget(m_panPitch);
-
     // Notes
     spacer = new QLabel;
     spacer->setFixedWidth(40);
@@ -1189,25 +1202,35 @@
     connect(m_showNotes, SIGNAL(triggered()), this, SLOT(showNotesToggled()));
     connect(this, SIGNAL(canPlay(bool)), m_showNotes, SLOT(setEnabled(bool)));
 
-    m_playNotes = toolbar->addAction(il.load("speaker"), tr("Play Notes"));
+    if (!m_withSonification) 
+    {
+        m_playNotes = new QAction(tr("Play Notes"), this);
+    } else {
+        m_playNotes = toolbar->addAction(il.load("speaker"), tr("Play Notes"));
+        toolbar->addWidget(m_gainNotes);
+        toolbar->addWidget(m_panNotes);
+    }
     m_playNotes->setCheckable(true);
     connect(m_playNotes, SIGNAL(triggered()), this, SLOT(playNotesToggled()));
     connect(this, SIGNAL(canPlayNotes(bool)), m_playNotes, SLOT(setEnabled(bool)));
 
-    toolbar->addWidget(m_gainNotes);
-    toolbar->addWidget(m_panNotes);
-
     // Spectrogram
     spacer = new QLabel;
     spacer->setFixedWidth(40);
     toolbar->addWidget(spacer);
 
-    m_showSpect = toolbar->addAction(il.load("spectrogram"), tr("Show Spectrogram"));
+    if (!m_withSpectrogram)
+    {
+        m_showSpect = new QAction(tr("Show Spectrogram"), this);
+    } else {
+        m_showSpect = toolbar->addAction(il.load("spectrogram"), tr("Show Spectrogram"));
+    }
     m_showSpect->setCheckable(true);
     connect(m_showSpect, SIGNAL(triggered()), this, SLOT(showSpectToggled()));
     connect(this, SIGNAL(canPlay(bool)), m_showSpect, SLOT(setEnabled(bool)));
 
     Pane::registerShortcuts(*m_keyReference);
+
 }
 
 
@@ -3107,6 +3130,17 @@
                  QMessageBox::Ok);
         }
     }
+
+    if (!m_withSpectrogram) 
+    {
+        m_analyser->setVisible(Analyser::Spectrogram, false);
+    }
+
+    if (!m_withSonification) 
+    {
+        m_analyser->setAudible(Analyser::PitchTrack, false);
+        m_analyser->setAudible(Analyser::Notes, false);
+    }
 }
 
 void
--- a/src/main.cpp	Tue Jul 15 15:42:46 2014 +0100
+++ b/src/main.cpp	Tue Jul 15 18:12:48 2014 +0100
@@ -153,7 +153,7 @@
 
     if (args.contains("--help") || args.contains("-h") || args.contains("-?")) {
         std::cerr << QApplication::tr(
-            "\nTony is a program for interactive note and pitch analysis and annotation.\n\nUsage:\n\n  %1 [--no-audio] [--no-sonification] [--no-spectrogram] [<file> ...]\n\n  --no-audio: Do not attempt to open an audio output device\n  <file>: One or more Tony (.ton) and audio files may be provided.\n --no-sonification: Disable and hide sonification of pitch tracks and notes.\n --no-spectrogram: Disable spectrogram.").arg(argv[0]).toStdString() << std::endl;
+            "\nTony is a program for interactive note and pitch analysis and annotation.\n\nUsage:\n\n  %1 [--no-audio] [--no-sonification] [--no-spectrogram] [<file> ...]\n\n  --no-audio: Do not attempt to open an audio output device\n  --no-sonification: Disable sonification of pitch tracks and notes and hide their toggles.\n  --no-spectrogram: Disable spectrogram.\n  <file>: One or more Tony (.ton) and audio files may be provided.").arg(argv[0]).toStdString() << std::endl;
         exit(2);
     }