diff runner/MIDIFeatureWriter.cpp @ 140:9b94545a7fdc midi

More of MIDIFeatureWriter
author Chris Cannam
date Mon, 13 Oct 2014 12:00:22 +0100
parents 65a488d8c1bb
children d7a91e07ca57
line wrap: on
line diff
--- a/runner/MIDIFeatureWriter.cpp	Mon Oct 13 11:43:24 2014 +0100
+++ b/runner/MIDIFeatureWriter.cpp	Mon Oct 13 12:00:22 2014 +0100
@@ -60,12 +60,42 @@
 			 const Plugin::FeatureList& features,
 			 std::string summaryType)
 {
-    QString filename = getOutputFilename(trackId, transform.getIdentifier());
+    QString transformId = transform.getIdentifier();
+
+    QString filename = getOutputFilename(trackId, transformId);
     if (filename == "") {
-	throw FailedToOpenOutputStream(trackId, transform.getIdentifier());
+	throw FailedToOpenOutputStream(trackId, transformId);
     }
 
-    //!!! implement!
+    if (m_rates.find(filename) == m_rates.end()) {
+        // If the output is FixedSampleRate, we draw the sample rate
+        // from the output descriptor; otherwise from the transform
+        float sampleRate;
+        if (output.sampleType == Plugin::OutputDescriptor::FixedSampleRate) {
+            sampleRate = output.sampleRate;
+        } else {
+            sampleRate = transform.getSampleRate();
+        }
+        m_rates[filename] = sampleRate;
+    }
+
+    if (m_fileTransforms[filename].find(transformId) == 
+        m_fileTransforms[filename].end()) {
+
+        // This transform is new to the file, give it a channel number
+
+        int channel = m_nextChannels[filename];
+        m_nextChannels[filename] = channel + 1;
+
+        m_fileTransforms[filename].insert(transformId);
+        m_channels[transformId] = channel;
+    }
+
+    NoteList notes = m_notes[filename];
+
+    
+
+    m_notes[filename] = notes;
 }
 
 void