Mercurial > hg > svcore
comparison data/model/NoteData.h @ 865:9196cff56abe tonioni
SV file compatibility etc for sample stuff
author | Chris Cannam |
---|---|
date | Tue, 07 Jan 2014 15:49:39 +0000 |
parents | 1f98e28f70c6 |
children | 59e7fe1b1003 |
comparison
equal
deleted
inserted
replaced
864:6d07bcc844a1 | 865:9196cff56abe |
---|---|
15 #ifndef NOTE_DATA_H | 15 #ifndef NOTE_DATA_H |
16 #define NOTE_DATA_H | 16 #define NOTE_DATA_H |
17 | 17 |
18 #include <vector> | 18 #include <vector> |
19 | 19 |
20 #include "base/Pitch.h" | |
21 | |
20 struct NoteData | 22 struct NoteData |
21 { | 23 { |
22 NoteData(size_t _start, size_t _dur, int _mp, int _vel) : | 24 NoteData(size_t _start, size_t _dur, int _mp, int _vel) : |
23 start(_start), duration(_dur), midiPitch(_mp), frequency(0), | 25 start(_start), duration(_dur), midiPitch(_mp), frequency(0), |
24 isMidiPitchQuantized(true), velocity(_vel) { }; | 26 isMidiPitchQuantized(true), velocity(_vel) { }; |
25 | 27 |
26 size_t start; // audio sample frame | 28 size_t start; // audio sample frame |
27 size_t duration; // in audio sample frames | 29 size_t duration; // in audio sample frames |
28 int midiPitch; // 0-127 | 30 int midiPitch; // 0-127 |
29 //!!! float: -> what else would this change? | 31 float frequency; // Hz, to be used if isMidiPitchQuantized false |
30 int frequency; // Hz, to be used if isMidiPitchQuantized false | |
31 bool isMidiPitchQuantized; | 32 bool isMidiPitchQuantized; |
32 int velocity; // MIDI-style 0-127 | 33 int velocity; // MIDI-style 0-127 |
34 | |
35 float getFrequency() const { | |
36 if (isMidiPitchQuantized) { | |
37 return Pitch::getFrequencyForPitch(midiPitch); | |
38 } else { | |
39 return frequency; | |
40 } | |
41 } | |
33 }; | 42 }; |
34 | 43 |
35 typedef std::vector<NoteData> NoteList; | 44 typedef std::vector<NoteData> NoteList; |
36 | 45 |
37 class NoteExportable | 46 class NoteExportable |