comparison audioio/AudioGenerator.h @ 22:7f32bb07629a

* Add editing for auralisation plugin parameters and programs * Rename and reorganise the sample plugin sample set
author Chris Cannam
date Thu, 23 Mar 2006 15:49:41 +0000
parents ebe07d3560e6
children dd2084d32652
comparison
equal deleted inserted replaced
21:ebe07d3560e6 22:7f32bb07629a
21 class NoteModel; 21 class NoteModel;
22 class DenseTimeValueModel; 22 class DenseTimeValueModel;
23 class SparseOneDimensionalModel; 23 class SparseOneDimensionalModel;
24 class RealTimePluginInstance; 24 class RealTimePluginInstance;
25 25
26 #include <QObject>
26 #include <QMutex> 27 #include <QMutex>
27 28
28 #include <set> 29 #include <set>
29 #include <map> 30 #include <map>
30 31
31 class AudioGenerator 32 class AudioGenerator : public QObject
32 { 33 {
34 Q_OBJECT
35
33 public: 36 public:
34 AudioGenerator(ViewManager *); 37 AudioGenerator(ViewManager *);
35 virtual ~AudioGenerator(); 38 virtual ~AudioGenerator();
36 39
37 /** 40 /**
39 * know how to play. This doesn't guarantee that a specific 42 * know how to play. This doesn't guarantee that a specific
40 * AudioGenerator will actually produce sounds for it (for 43 * AudioGenerator will actually produce sounds for it (for
41 * example, it may turn out that a vital plugin is missing). 44 * example, it may turn out that a vital plugin is missing).
42 */ 45 */
43 static bool canPlay(const Model *model); 46 static bool canPlay(const Model *model);
47
48 static QString getDefaultPlayPluginId(const Model *model);
49 static QString getDefaultPlayPluginConfiguration(const Model *model);
44 50
45 /** 51 /**
46 * Add a data model to be played from and initialise any necessary 52 * Add a data model to be played from and initialise any necessary
47 * audio generation code. Returns true if the model will be 53 * audio generation code. Returns true if the model will be
48 * played. (The return value test here is stricter than that for 54 * played. (The return value test here is stricter than that for
83 * Mix a single model into an output buffer. 89 * Mix a single model into an output buffer.
84 */ 90 */
85 virtual size_t mixModel(Model *model, size_t startFrame, size_t frameCount, 91 virtual size_t mixModel(Model *model, size_t startFrame, size_t frameCount,
86 float **buffer, size_t fadeIn = 0, size_t fadeOut = 0); 92 float **buffer, size_t fadeIn = 0, size_t fadeOut = 0);
87 93
94 protected slots:
95 void playPluginIdChanged(const Model *, QString);
96 void playPluginConfigurationChanged(const Model *, QString);
97
88 protected: 98 protected:
89 ViewManager *m_viewManager; 99 ViewManager *m_viewManager;
90 size_t m_sourceSampleRate; 100 size_t m_sourceSampleRate;
91 size_t m_targetChannelCount; 101 size_t m_targetChannelCount;
92 102
100 return n1.frame < n2.frame; 110 return n1.frame < n2.frame;
101 } 111 }
102 }; 112 };
103 }; 113 };
104 114
105 typedef std::map<Model *, RealTimePluginInstance *> PluginMap; 115 typedef std::map<const Model *, RealTimePluginInstance *> PluginMap;
106 116
107 typedef std::set<NoteOff, NoteOff::Comparator> NoteOffSet; 117 typedef std::set<NoteOff, NoteOff::Comparator> NoteOffSet;
108 typedef std::map<Model *, NoteOffSet> NoteOffMap; 118 typedef std::map<const Model *, NoteOffSet> NoteOffMap;
109 119
110 QMutex m_mutex; 120 QMutex m_mutex;
111 PluginMap m_synthMap; 121 PluginMap m_synthMap;
112 NoteOffMap m_noteOffs; 122 NoteOffMap m_noteOffs;
113 123
124 virtual RealTimePluginInstance *loadPluginFor(const Model *model);
114 virtual RealTimePluginInstance *loadPlugin(QString id, QString program); 125 virtual RealTimePluginInstance *loadPlugin(QString id, QString program);
115 126
116 virtual size_t mixDenseTimeValueModel 127 virtual size_t mixDenseTimeValueModel
117 (DenseTimeValueModel *model, size_t startFrame, size_t frameCount, 128 (DenseTimeValueModel *model, size_t startFrame, size_t frameCount,
118 float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut); 129 float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut);