comparison data/model/NoteData.h @ 996:0d3d1ec7dfde

Add MIDI channel to note data and MIDI writer
author Chris Cannam
date Mon, 13 Oct 2014 10:55:43 +0100
parents 59e7fe1b1003
children cc27f35aa75c
comparison
equal deleted inserted replaced
995:952005e25266 996:0d3d1ec7dfde
21 21
22 struct NoteData 22 struct NoteData
23 { 23 {
24 NoteData(int _start, int _dur, int _mp, int _vel) : 24 NoteData(int _start, int _dur, int _mp, int _vel) :
25 start(_start), duration(_dur), midiPitch(_mp), frequency(0), 25 start(_start), duration(_dur), midiPitch(_mp), frequency(0),
26 isMidiPitchQuantized(true), velocity(_vel) { }; 26 isMidiPitchQuantized(true), velocity(_vel), channel(0) { };
27 27
28 int start; // audio sample frame 28 int start; // audio sample frame
29 int duration; // in audio sample frames 29 int duration; // in audio sample frames
30 int midiPitch; // 0-127 30 int midiPitch; // 0-127
31 float frequency; // Hz, to be used if isMidiPitchQuantized false 31 float frequency; // Hz, to be used if isMidiPitchQuantized false
32 bool isMidiPitchQuantized; 32 bool isMidiPitchQuantized;
33 int velocity; // MIDI-style 0-127 33 int velocity; // MIDI-style 0-127
34 int channel; // MIDI 0-15
34 35
35 float getFrequency() const { 36 float getFrequency() const {
36 if (isMidiPitchQuantized) { 37 if (isMidiPitchQuantized) {
37 return Pitch::getFrequencyForPitch(midiPitch); 38 return Pitch::getFrequencyForPitch(midiPitch);
38 } else { 39 } else {