Mercurial > hg > svcore
diff data/fileio/MIDIFileWriter.cpp @ 1069:32ab6c48efaa
Merge from branch tonioni
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2015 09:11:34 +0100 |
parents | c7e9afcbf070 |
children | 50210da3997c |
line wrap: on
line diff
--- a/data/fileio/MIDIFileWriter.cpp Mon Mar 02 17:21:34 2015 +0000 +++ b/data/fileio/MIDIFileWriter.cpp Mon Apr 20 09:11:34 2015 +0100 @@ -37,7 +37,7 @@ using namespace MIDIConstants; MIDIFileWriter::MIDIFileWriter(QString path, const NoteExportable *exportable, - int sampleRate, float tempo) : + sv_samplerate_t sampleRate, float tempo) : m_path(path), m_exportable(exportable), m_sampleRate(sampleRate), @@ -89,8 +89,8 @@ MIDIByte upper; MIDIByte lower; - upper = (number & 0xFF00) >> 8; - lower = (number & 0x00FF); + upper = MIDIByte((number & 0xFF00) >> 8); + lower = MIDIByte( number & 0x00FF); string rv; rv += upper; @@ -106,10 +106,10 @@ MIDIByte upper2; MIDIByte lower2; - upper1 = (number & 0xff000000) >> 24; - lower1 = (number & 0x00ff0000) >> 16; - upper2 = (number & 0x0000ff00) >> 8; - lower2 = (number & 0x000000ff); + upper1 = MIDIByte((number & 0xff000000) >> 24); + lower1 = MIDIByte((number & 0x00ff0000) >> 16); + upper2 = MIDIByte((number & 0x0000ff00) >> 8); + lower2 = MIDIByte((number & 0x000000ff)); string rv; rv += upper1; @@ -344,8 +344,8 @@ for (NoteList::const_iterator i = notes.begin(); i != notes.end(); ++i) { - int frame = i->start; - int duration = i->duration; + sv_frame_t frame = i->start; + sv_frame_t duration = i->duration; int pitch = i->midiPitch; int velocity = i->velocity; int channel = i->channel; @@ -358,12 +358,12 @@ // Convert frame to MIDI time - double seconds = double(frame) / double(m_sampleRate); + double seconds = double(frame) / m_sampleRate; double quarters = (seconds * m_tempo) / 60.0; unsigned long midiTime = int(quarters * m_timingDivision + 0.5); // Get the sounding time for the matching NOTE_OFF - seconds = double(frame + duration) / double(m_sampleRate); + seconds = double(frame + duration) / m_sampleRate; quarters = (seconds * m_tempo) / 60.0; unsigned long endTime = int(quarters * m_timingDivision + 0.5);