comparison audioio/AudioCallbackPlaySource.h @ 235:1fcee2a1c03e sonification

Add queueExampleNote method to AudioCallbackPlaySource, providing a way to add a note to a special model which is mixed in outside of the normal playback flow. Currently mixing & generation happen in the play thread, which doesn't work very well -- buffer pending.
author Chris Cannam
date Fri, 24 Jun 2011 16:44:02 +0100
parents 0b3aa9b702bb
children e8961a95b3d6
comparison
equal deleted inserted replaced
234:a98f1638c5ec 235:1fcee2a1c03e
36 namespace RubberBand { 36 namespace RubberBand {
37 class RubberBandStretcher; 37 class RubberBandStretcher;
38 } 38 }
39 39
40 class Model; 40 class Model;
41 class NoteModel;
41 class ViewManagerBase; 42 class ViewManagerBase;
42 class AudioGenerator; 43 class AudioGenerator;
43 class PlayParameters; 44 class PlayParameters;
44 class RealTimePluginInstance; 45 class RealTimePluginInstance;
45 class AudioCallbackPlayTarget; 46 class AudioCallbackPlayTarget;
223 * 224 *
224 * Pass a null pointer to remove the current auditioning plugin, 225 * Pass a null pointer to remove the current auditioning plugin,
225 * if any. 226 * if any.
226 */ 227 */
227 void setAuditioningEffect(Auditionable *plugin); 228 void setAuditioningEffect(Auditionable *plugin);
229
230 /**
231 * Request spontaneous playback of a single short note of the
232 * given pitch.
233 */
234 void queueExampleNote(int midiPitch);
228 235
229 /** 236 /**
230 * Specify that only the given set of models should be played. 237 * Specify that only the given set of models should be played.
231 */ 238 */
232 void setSoloModelSet(std::set<Model *>s); 239 void setSoloModelSet(std::set<Model *>s);
303 bool m_auditioningPluginBypassed; 310 bool m_auditioningPluginBypassed;
304 Scavenger<RealTimePluginInstance> m_pluginScavenger; 311 Scavenger<RealTimePluginInstance> m_pluginScavenger;
305 size_t m_playStartFrame; 312 size_t m_playStartFrame;
306 bool m_playStartFramePassed; 313 bool m_playStartFramePassed;
307 RealTime m_playStartedAt; 314 RealTime m_playStartedAt;
315 NoteModel *m_exampleNotes;
316 size_t m_examplePlaybackFrame;
308 317
309 RingBuffer<float> *getWriteRingBuffer(size_t c) { 318 RingBuffer<float> *getWriteRingBuffer(size_t c) {
310 if (m_writeBuffers && c < m_writeBuffers->size()) { 319 if (m_writeBuffers && c < m_writeBuffers->size()) {
311 return (*m_writeBuffers)[c]; 320 return (*m_writeBuffers)[c];
312 } else { 321 } else {
343 // which will be count or fewer. Return in the frame argument the 352 // which will be count or fewer. Return in the frame argument the
344 // new buffered frame position (which may be earlier than the 353 // new buffered frame position (which may be earlier than the
345 // frame argument passed in, in the case of looping). 354 // frame argument passed in, in the case of looping).
346 size_t mixModels(size_t &frame, size_t count, float **buffers); 355 size_t mixModels(size_t &frame, size_t count, float **buffers);
347 356
357 // Called from getSourceSamples, thus in play thread rather than
358 // fill thread. Return the number of frames written, which will
359 // be count or fewer.
360 size_t mixExampleModel(size_t count, float **buffers);
361
348 // Called from getSourceSamples. 362 // Called from getSourceSamples.
349 void applyAuditioningEffect(size_t count, float **buffers); 363 void applyAuditioningEffect(size_t count, float **buffers);
350 364
351 // Ranges of current selections, if play selection is active 365 // Ranges of current selections, if play selection is active
352 std::vector<RealTime> m_rangeStarts; 366 std::vector<RealTime> m_rangeStarts;