diff data/fileio/MIDIFileReader.cpp @ 742:c10cb8782576 coreaudio_tests

Merge from branch "default"
author Chris Cannam
date Sun, 01 Jul 2012 11:53:00 +0100
parents 1424aa29ae95
children e802e550a1f2
line wrap: on
line diff
--- a/data/fileio/MIDIFileReader.cpp	Mon Nov 29 12:45:39 2010 +0000
+++ b/data/fileio/MIDIFileReader.cpp	Sun Jul 01 11:53:00 2012 +0100
@@ -52,7 +52,7 @@
 
 using namespace MIDIConstants;
 
-//#define MIDI_DEBUG 1
+//#define MIDI_SVDEBUG 1
 
 
 MIDIFileReader::MIDIFileReader(QString path,
@@ -278,7 +278,7 @@
     m_error = "";
 
 #ifdef MIDI_DEBUG
-    cerr << "MIDIFileReader::open() : fileName = " << m_fileName.c_str() << endl;
+    SVDEBUG << "MIDIFileReader::open() : fileName = " << m_fileName.c_str() << endl;
 #endif
 
     // Open the file
@@ -315,7 +315,7 @@
 	for (unsigned int j = 0; j < m_numberOfTracks; ++j) {
 
 #ifdef MIDI_DEBUG
-	    cerr << "Parsing Track " << j << endl;
+	    SVDEBUG << "Parsing Track " << j << endl;
 #endif
 
 	    if (!skipToNextTrack()) {
@@ -350,7 +350,7 @@
 
     } catch (MIDIException e) {
 
-        cerr << "MIDIFileReader::open() - caught exception - " << e.what() << endl;
+        SVDEBUG << "MIDIFileReader::open() - caught exception - " << e.what() << endl;
 	m_error = e.what();
     }
     
@@ -392,14 +392,14 @@
 {
     if (midiHeader.size() < 14) {
 #ifdef MIDI_DEBUG
-        cerr << "MIDIFileReader::parseHeader() - file header undersized" << endl;
+        SVDEBUG << "MIDIFileReader::parseHeader() - file header undersized" << endl;
 #endif
         return false;
     }
 
     if (midiHeader.compare(0, 4, MIDI_FILE_HEADER) != 0) {
 #ifdef MIDI_DEBUG
-	cerr << "MIDIFileReader::parseHeader()"
+	SVDEBUG << "MIDIFileReader::parseHeader()"
 	     << "- file header not found or malformed"
 	     << endl;
 #endif
@@ -408,7 +408,7 @@
 
     if (midiBytesToLong(midiHeader.substr(4,4)) != 6L) {
 #ifdef MIDI_DEBUG
-        cerr << "MIDIFileReader::parseHeader()"
+        SVDEBUG << "MIDIFileReader::parseHeader()"
 	     << " - header length incorrect"
 	     << endl;
 #endif
@@ -498,7 +498,7 @@
 	    data1 = midiByte;
 
 #ifdef MIDI_DEBUG
-	    cerr << "using running status (byte " << int(midiByte) << " found)" << endl;
+	    SVDEBUG << "using running status (byte " << int(midiByte) << " found)" << endl;
 #endif
         } else {
 #ifdef MIDI_DEBUG
@@ -611,7 +611,7 @@
                         MIDI_END_OF_EXCLUSIVE)
                 {
 #ifdef MIDI_DEBUG
-                    cerr << "MIDIFileReader::parseTrack() - "
+                    SVDEBUG << "MIDIFileReader::parseTrack() - "
                               << "malformed or unsupported SysEx type"
                               << endl;
 #endif
@@ -631,14 +631,14 @@
 
             case MIDI_END_OF_EXCLUSIVE:
 #ifdef MIDI_DEBUG
-                cerr << "MIDIFileReader::parseTrack() - "
+                SVDEBUG << "MIDIFileReader::parseTrack() - "
                           << "Found a stray MIDI_END_OF_EXCLUSIVE" << endl;
 #endif
                 break;
 
             default:
 #ifdef MIDI_DEBUG
-                cerr << "MIDIFileReader::parseTrack()" 
+                SVDEBUG << "MIDIFileReader::parseTrack()" 
                           << " - Unsupported MIDI Event Code:  "
                           << (int)eventCode << endl;
 #endif
@@ -787,15 +787,15 @@
     double seconds = (60.0 * quarters) / tempo;
 
 /*
-    std::cerr << "MIDIFileReader::getTimeForMIDITime(" << midiTime << ")"
-	      << std::endl;
-    std::cerr << "timing division = " << td << std::endl;
+    SVDEBUG << "MIDIFileReader::getTimeForMIDITime(" << midiTime << ")"
+	      << endl;
+    SVDEBUG << "timing division = " << td << endl;
     std::cerr << "nearest tempo event (of " << m_tempoMap.size() << ") is at " << tempoMIDITime << " ("
 	      << tempoRealTime << ")" << std::endl;
     std::cerr << "quarters since then = " << quarters << std::endl;
     std::cerr << "tempo = " << tempo << " quarters per minute" << std::endl;
     std::cerr << "seconds since then = " << seconds << std::endl;
-    std::cerr << "resulting time = " << (tempoRealTime + RealTime::fromSeconds(seconds)) << std::endl;
+    SVDEBUG << "resulting time = " << (tempoRealTime + RealTime::fromSeconds(seconds)) << endl;
 */
 
     return tempoRealTime + RealTime::fromSeconds(seconds);
@@ -1033,7 +1033,7 @@
 		    Note note(startFrame, (*i)->getPitch(),
 			      endFrame - startFrame, level, noteLabel);
 
-//		    std::cerr << "Adding note " << startFrame << "," << (endFrame-startFrame) << " : " << int((*i)->getPitch()) << std::endl;
+//		    SVDEBUG << "Adding note " << startFrame << "," << (endFrame-startFrame) << " : " << int((*i)->getPitch()) << endl;
 
 		    model->addPoint(note);
 		    break;