comparison data/fileio/MIDIFileWriter.cpp @ 1048:c7e9afcbf070 cxx11

More type fixes. We now build with -Wconversion, on this platform (64-bit Linux) at least.
author Chris Cannam
date Tue, 10 Mar 2015 17:23:45 +0000
parents cc27f35aa75c
children 50210da3997c
comparison
equal deleted inserted replaced
1047:26cf6d5251ec 1048:c7e9afcbf070
35 using std::ios; 35 using std::ios;
36 36
37 using namespace MIDIConstants; 37 using namespace MIDIConstants;
38 38
39 MIDIFileWriter::MIDIFileWriter(QString path, const NoteExportable *exportable, 39 MIDIFileWriter::MIDIFileWriter(QString path, const NoteExportable *exportable,
40 int sampleRate, float tempo) : 40 sv_samplerate_t sampleRate, float tempo) :
41 m_path(path), 41 m_path(path),
42 m_exportable(exportable), 42 m_exportable(exportable),
43 m_sampleRate(sampleRate), 43 m_sampleRate(sampleRate),
44 m_tempo(tempo), 44 m_tempo(tempo),
45 m_midiFile(0) 45 m_midiFile(0)
356 if (channel < 0) channel = 0; 356 if (channel < 0) channel = 0;
357 if (channel > 15) channel = 0; 357 if (channel > 15) channel = 0;
358 358
359 // Convert frame to MIDI time 359 // Convert frame to MIDI time
360 360
361 double seconds = double(frame) / double(m_sampleRate); 361 double seconds = double(frame) / m_sampleRate;
362 double quarters = (seconds * m_tempo) / 60.0; 362 double quarters = (seconds * m_tempo) / 60.0;
363 unsigned long midiTime = int(quarters * m_timingDivision + 0.5); 363 unsigned long midiTime = int(quarters * m_timingDivision + 0.5);
364 364
365 // Get the sounding time for the matching NOTE_OFF 365 // Get the sounding time for the matching NOTE_OFF
366 seconds = double(frame + duration) / double(m_sampleRate); 366 seconds = double(frame + duration) / m_sampleRate;
367 quarters = (seconds * m_tempo) / 60.0; 367 quarters = (seconds * m_tempo) / 60.0;
368 unsigned long endTime = int(quarters * m_timingDivision + 0.5); 368 unsigned long endTime = int(quarters * m_timingDivision + 0.5);
369 369
370 // At this point all the notes we insert have absolute times 370 // At this point all the notes we insert have absolute times
371 // in the delta time fields. We resolve these into delta 371 // in the delta time fields. We resolve these into delta