Mercurial > hg > svapp
comparison audioio/AudioGenerator.h @ 436:72c662fe7ea3 cxx11
Further dedicated-types fixes
author | Chris Cannam |
---|---|
date | Tue, 10 Mar 2015 17:02:52 +0000 |
parents | 2484e6f95c06 |
children |
comparison
equal
deleted
inserted
replaced
435:618d5816b04d | 436:72c662fe7ea3 |
---|---|
29 #include <QMutex> | 29 #include <QMutex> |
30 | 30 |
31 #include <set> | 31 #include <set> |
32 #include <map> | 32 #include <map> |
33 #include <vector> | 33 #include <vector> |
34 | |
35 #include "base/BaseTypes.h" | |
34 | 36 |
35 class AudioGenerator : public QObject | 37 class AudioGenerator : public QObject |
36 { | 38 { |
37 Q_OBJECT | 39 Q_OBJECT |
38 | 40 |
72 /** | 74 /** |
73 * Return the internal processing block size. The frameCount | 75 * Return the internal processing block size. The frameCount |
74 * argument to all mixModel calls must be a multiple of this | 76 * argument to all mixModel calls must be a multiple of this |
75 * value. | 77 * value. |
76 */ | 78 */ |
77 virtual int getBlockSize() const; | 79 virtual sv_frame_t getBlockSize() const; |
78 | 80 |
79 /** | 81 /** |
80 * Mix a single model into an output buffer. | 82 * Mix a single model into an output buffer. |
81 */ | 83 */ |
82 virtual int mixModel(Model *model, int startFrame, int frameCount, | 84 virtual sv_frame_t mixModel(Model *model, sv_frame_t startFrame, sv_frame_t frameCount, |
83 float **buffer, int fadeIn = 0, int fadeOut = 0); | 85 float **buffer, sv_frame_t fadeIn = 0, sv_frame_t fadeOut = 0); |
84 | 86 |
85 /** | 87 /** |
86 * Specify that only the given set of models should be played. | 88 * Specify that only the given set of models should be played. |
87 */ | 89 */ |
88 virtual void setSoloModelSet(std::set<Model *>s); | 90 virtual void setSoloModelSet(std::set<Model *>s); |
95 | 97 |
96 protected slots: | 98 protected slots: |
97 void playClipIdChanged(const Playable *, QString); | 99 void playClipIdChanged(const Playable *, QString); |
98 | 100 |
99 protected: | 101 protected: |
100 int m_sourceSampleRate; | 102 sv_samplerate_t m_sourceSampleRate; |
101 int m_targetChannelCount; | 103 int m_targetChannelCount; |
102 int m_waveType; | 104 int m_waveType; |
103 | 105 |
104 bool m_soloing; | 106 bool m_soloing; |
105 std::set<Model *> m_soloModelSet; | 107 std::set<Model *> m_soloModelSet; |
106 | 108 |
107 struct NoteOff { | 109 struct NoteOff { |
108 | 110 |
109 NoteOff(float _freq, int _frame) : frequency(_freq), frame(_frame) { } | 111 NoteOff(float _freq, sv_frame_t _frame) : frequency(_freq), frame(_frame) { } |
110 | 112 |
111 float frequency; | 113 float frequency; |
112 int frame; | 114 sv_frame_t frame; |
113 | 115 |
114 struct Comparator { | 116 struct Comparator { |
115 bool operator()(const NoteOff &n1, const NoteOff &n2) const { | 117 bool operator()(const NoteOff &n1, const NoteOff &n2) const { |
116 return n1.frame < n2.frame; | 118 return n1.frame < n2.frame; |
117 } | 119 } |
141 ClipMixer *makeClipMixerFor(const Model *model); | 143 ClipMixer *makeClipMixerFor(const Model *model); |
142 ContinuousSynth *makeSynthFor(const Model *model); | 144 ContinuousSynth *makeSynthFor(const Model *model); |
143 | 145 |
144 static void initialiseSampleDir(); | 146 static void initialiseSampleDir(); |
145 | 147 |
146 virtual int mixDenseTimeValueModel | 148 virtual sv_frame_t mixDenseTimeValueModel |
147 (DenseTimeValueModel *model, int startFrame, int frameCount, | 149 (DenseTimeValueModel *model, sv_frame_t startFrame, sv_frame_t frameCount, |
148 float **buffer, float gain, float pan, int fadeIn, int fadeOut); | 150 float **buffer, float gain, float pan, sv_frame_t fadeIn, sv_frame_t fadeOut); |
149 | 151 |
150 virtual int mixClipModel | 152 virtual sv_frame_t mixClipModel |
151 (Model *model, int startFrame, int frameCount, | 153 (Model *model, sv_frame_t startFrame, sv_frame_t frameCount, |
152 float **buffer, float gain, float pan); | 154 float **buffer, float gain, float pan); |
153 | 155 |
154 virtual int mixContinuousSynthModel | 156 virtual sv_frame_t mixContinuousSynthModel |
155 (Model *model, int startFrame, int frameCount, | 157 (Model *model, sv_frame_t startFrame, sv_frame_t frameCount, |
156 float **buffer, float gain, float pan); | 158 float **buffer, float gain, float pan); |
157 | 159 |
158 static const int m_processingBlockSize; | 160 static const sv_frame_t m_processingBlockSize; |
159 | 161 |
160 float **m_channelBuffer; | 162 float **m_channelBuffer; |
161 int m_channelBufSiz; | 163 sv_frame_t m_channelBufSiz; |
162 int m_channelBufCount; | 164 int m_channelBufCount; |
163 }; | 165 }; |
164 | 166 |
165 #endif | 167 #endif |
166 | 168 |