Mercurial > hg > svapp
comparison audioio/AudioGenerator.h @ 275:6c6950bd7d53
Refactor to combine the two synthetic playback methods, with a single separate method to extract the basic note data from model
author | Chris Cannam |
---|---|
date | Mon, 15 Apr 2013 17:23:14 +0100 |
parents | e81c1ea227ee |
children | cba1e2a3d14b |
comparison
equal
deleted
inserted
replaced
274:eb9a16538173 | 275:6c6950bd7d53 |
---|---|
26 #include <QObject> | 26 #include <QObject> |
27 #include <QMutex> | 27 #include <QMutex> |
28 | 28 |
29 #include <set> | 29 #include <set> |
30 #include <map> | 30 #include <map> |
31 #include <vector> | |
31 | 32 |
32 class AudioGenerator : public QObject | 33 class AudioGenerator : public QObject |
33 { | 34 { |
34 Q_OBJECT | 35 Q_OBJECT |
35 | 36 |
99 size_t m_targetChannelCount; | 100 size_t m_targetChannelCount; |
100 | 101 |
101 bool m_soloing; | 102 bool m_soloing; |
102 std::set<Model *> m_soloModelSet; | 103 std::set<Model *> m_soloModelSet; |
103 | 104 |
105 struct NoteData { | |
106 | |
107 NoteData(size_t _start, size_t _dur, int _mp, int _vel) : | |
108 start(_start), duration(_dur), midiPitch(_mp), frequency(0), | |
109 isMidiPitchQuantized(true), velocity(_vel) { }; | |
110 | |
111 size_t start; // audio sample frame | |
112 size_t duration; // in audio sample frames | |
113 int midiPitch; // 0-127 | |
114 int frequency; // Hz, to be used if isMidiPitchQuantized false | |
115 bool isMidiPitchQuantized; | |
116 int velocity; // MIDI-style 0-127 | |
117 }; | |
118 | |
119 typedef std::vector<NoteData> NoteList; | |
120 | |
104 struct NoteOff { | 121 struct NoteOff { |
122 | |
123 NoteOff(int _p, size_t _f) : pitch(_p), frame(_f) { } | |
105 | 124 |
106 int pitch; | 125 int pitch; |
107 size_t frame; | 126 size_t frame; |
108 | 127 |
109 struct Comparator { | 128 struct Comparator { |
130 | 149 |
131 virtual size_t mixDenseTimeValueModel | 150 virtual size_t mixDenseTimeValueModel |
132 (DenseTimeValueModel *model, size_t startFrame, size_t frameCount, | 151 (DenseTimeValueModel *model, size_t startFrame, size_t frameCount, |
133 float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut); | 152 float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut); |
134 | 153 |
135 virtual size_t mixSparseOneDimensionalModel | 154 virtual size_t mixSyntheticNoteModel |
136 (SparseOneDimensionalModel *model, size_t startFrame, size_t frameCount, | 155 (Model *model, size_t startFrame, size_t frameCount, |
137 float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut); | 156 float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut); |
138 | 157 |
139 virtual size_t mixNoteModel | 158 NoteList getNotes(Model *model, size_t startFrame, size_t endFrame); |
140 (NoteModel *model, size_t startFrame, size_t frameCount, | |
141 float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut); | |
142 | 159 |
143 static const size_t m_pluginBlockSize; | 160 static const size_t m_pluginBlockSize; |
144 }; | 161 }; |
145 | 162 |
146 #endif | 163 #endif |