changeset 1130:98898331dc2a tony-2.0-integration

Merge from the default branch
author Chris Cannam
date Mon, 12 Oct 2015 13:38:24 +0100
parents 815f82508f96 (current diff) 1cc96e03a903 (diff)
children db946591a391
files
diffstat 2 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/data/fileio/MIDIFileWriter.cpp	Thu Aug 20 15:33:13 2015 +0100
+++ b/data/fileio/MIDIFileWriter.cpp	Mon Oct 12 13:38:24 2015 +0100
@@ -27,9 +27,13 @@
 
 #include "base/Pitch.h"
 
+#include <QCoreApplication>
+
 #include <algorithm>
 #include <fstream>
 
+//#define DEBUG_MIDI_FILE_WRITER 1
+
 using std::ofstream;
 using std::string;
 using std::ios;
@@ -320,12 +324,9 @@
 
     MIDIEvent *event;
 
-    event = new MIDIEvent(0, MIDI_FILE_META_EVENT, MIDI_CUE_POINT,
-                          "Exported from Sonic Visualiser");
-    m_midiComposition[track].push_back(event);
-
-    event = new MIDIEvent(0, MIDI_FILE_META_EVENT, MIDI_CUE_POINT,
-                          "http://www.sonicvisualiser.org/");
+    event = new MIDIEvent
+        (0, MIDI_FILE_META_EVENT, MIDI_CUE_POINT,
+         ("Exported from " + qApp->applicationName()).toStdString());
     m_midiComposition[track].push_back(event);
 
     long tempoValue = long(60000000.0 / m_tempo + 0.01);
@@ -384,6 +385,10 @@
                               127); // loudest silence you can muster
 
         m_midiComposition[track].push_back(event);
+
+#ifdef DEBUG_MIDI_FILE_WRITER
+        cerr << "midiTime = " << midiTime << ", endTime = " << endTime << endl;
+#endif
     }
     
     // Now gnash through the MIDI events and turn the absolute times
@@ -404,6 +409,9 @@
         for (MIDITrack::iterator it = m_midiComposition[i].begin();
              it != m_midiComposition[i].end(); it++) {
             unsigned long deltaTime = (*it)->getTime() - lastMidiTime;
+#ifdef DEBUG_MIDI_FILE_WRITER
+            cerr << "time = " << (*it)->getTime() << ", lastMidiTime = " << lastMidiTime << ", deltaTime = " << deltaTime << endl;
+#endif
             lastMidiTime = (*it)->getTime();
             (*it)->setTime(deltaTime);
         }
--- a/transform/FeatureWriter.h	Thu Aug 20 15:33:13 2015 +0100
+++ b/transform/FeatureWriter.h	Mon Oct 12 13:38:24 2015 +0100
@@ -42,9 +42,11 @@
     virtual string getDescription() const = 0;
 
     struct Parameter { // parameter of the writer, not the plugin
+        Parameter() : hasArg(false), mandatory(false) { }
         string name;
         string description;
         bool hasArg;
+        bool mandatory;
     };
     typedef vector<Parameter> ParameterList;
     virtual ParameterList getSupportedParameters() const {