comparison data/model/NoteData.h @ 852:d6bd5751b8f6 tonioni_multi_transform

Add NoteExportable base class, use it in MIDI export (and also elsewhere in playback)
author Chris Cannam
date Mon, 02 Dec 2013 17:11:20 +0000
parents
children 1f98e28f70c6
comparison
equal deleted inserted replaced
850:dba8a02b0413 852:d6bd5751b8f6
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
13 */
14
15 #ifndef NOTE_DATA_H
16 #define NOTE_DATA_H
17
18 #include <vector>
19
20 struct NoteData
21 {
22 NoteData(size_t _start, size_t _dur, int _mp, int _vel) :
23 start(_start), duration(_dur), midiPitch(_mp), frequency(0),
24 isMidiPitchQuantized(true), velocity(_vel) { };
25
26 size_t start; // audio sample frame
27 size_t duration; // in audio sample frames
28 int midiPitch; // 0-127
29 int frequency; // Hz, to be used if isMidiPitchQuantized false
30 bool isMidiPitchQuantized;
31 int velocity; // MIDI-style 0-127
32 };
33
34 typedef std::vector<NoteData> NoteList;
35
36 class NoteExportable
37 {
38 public:
39 virtual NoteList getNotes() const = 0;
40 virtual NoteList getNotes(size_t startFrame, size_t endFrame) const = 0;
41 };
42
43 #endif