comparison data/model/NoteData.h @ 1038:cc27f35aa75c cxx11

Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author Chris Cannam
date Tue, 03 Mar 2015 15:18:24 +0000
parents 0d3d1ec7dfde
children 48e9f538e6e9
comparison
equal deleted inserted replaced
1037:bf0e5944289b 1038:cc27f35aa75c
19 19
20 #include "base/Pitch.h" 20 #include "base/Pitch.h"
21 21
22 struct NoteData 22 struct NoteData
23 { 23 {
24 NoteData(int _start, int _dur, int _mp, int _vel) : 24 NoteData(sv_frame_t _start, sv_frame_t _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), channel(0) { }; 26 isMidiPitchQuantized(true), velocity(_vel), channel(0) { };
27 27
28 int start; // audio sample frame 28 sv_frame_t start; // audio sample frame
29 int duration; // in audio sample frames 29 sv_frame_t 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 int channel; // MIDI 0-15
35 35
36 float getFrequency() const { 36 float getFrequency() const {
37 if (isMidiPitchQuantized) { 37 if (isMidiPitchQuantized) {
38 return Pitch::getFrequencyForPitch(midiPitch); 38 return float(Pitch::getFrequencyForPitch(midiPitch));
39 } else { 39 } else {
40 return frequency; 40 return frequency;
41 } 41 }
42 } 42 }
43 }; 43 };
46 46
47 class NoteExportable 47 class NoteExportable
48 { 48 {
49 public: 49 public:
50 virtual NoteList getNotes() const = 0; 50 virtual NoteList getNotes() const = 0;
51 virtual NoteList getNotesWithin(int startFrame, int endFrame) const = 0; 51 virtual NoteList getNotesWithin(sv_frame_t startFrame, sv_frame_t endFrame) const = 0;
52 }; 52 };
53 53
54 #endif 54 #endif