comparison audioio/AudioGenerator.h @ 234:a98f1638c5ec sonification

Refactor mixNoteModel and mixSparseOneDimensionalModel into a single mixSparseModel -- attempting to clear the decks a bit for asynchronous example-note playing
author Chris Cannam
date Fri, 24 Jun 2011 15:39:00 +0100
parents e81c1ea227ee
children 1fcee2a1c03e
comparison
equal deleted inserted replaced
233:8aace2d9f1c2 234:a98f1638c5ec
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 Note {
106 int pitch;
107 size_t frame;
108 size_t duration; // 0 -> "anything" (short example note)
109 int velocity;
110 };
111 typedef std::vector<Note> Notes;
112
104 struct NoteOff { 113 struct NoteOff {
105 114
106 int pitch; 115 int pitch;
107 size_t frame; 116 size_t frame;
108 117
126 virtual RealTimePluginInstance *loadPluginFor(const Model *model); 135 virtual RealTimePluginInstance *loadPluginFor(const Model *model);
127 virtual RealTimePluginInstance *loadPlugin(QString id, QString program); 136 virtual RealTimePluginInstance *loadPlugin(QString id, QString program);
128 static void initialiseSampleDir(); 137 static void initialiseSampleDir();
129 static void setSampleDir(RealTimePluginInstance *plugin); 138 static void setSampleDir(RealTimePluginInstance *plugin);
130 139
140 virtual Notes getNotesFromModel
141 (Model *model, size_t startFrame, size_t frameCount);
142
131 virtual size_t mixDenseTimeValueModel 143 virtual size_t mixDenseTimeValueModel
132 (DenseTimeValueModel *model, size_t startFrame, size_t frameCount, 144 (DenseTimeValueModel *model, size_t startFrame, size_t frameCount,
133 float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut); 145 float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut);
134 146
135 virtual size_t mixSparseOneDimensionalModel 147 virtual size_t mixSparseModel
136 (SparseOneDimensionalModel *model, size_t startFrame, size_t frameCount, 148 (Model *model, size_t startFrame, size_t frameCount,
137 float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut);
138
139 virtual size_t mixNoteModel
140 (NoteModel *model, size_t startFrame, size_t frameCount,
141 float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut); 149 float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut);
142 150
143 static const size_t m_pluginBlockSize; 151 static const size_t m_pluginBlockSize;
144 }; 152 };
145 153