comparison audio/AudioCallbackPlaySource.h @ 739:ddfac001b543 audio-source-refactor

Introduce EffectWrapper for the auditioning effect
author Chris Cannam
date Thu, 19 Mar 2020 16:14:02 +0000
parents 48001ed9143b
children 6508d9d216c7
comparison
equal deleted inserted replaced
738:48001ed9143b 739:ddfac001b543
45 class AudioGenerator; 45 class AudioGenerator;
46 class PlayParameters; 46 class PlayParameters;
47 class RealTimePluginInstance; 47 class RealTimePluginInstance;
48 class AudioCallbackPlayTarget; 48 class AudioCallbackPlayTarget;
49 class TimeStretchWrapper; 49 class TimeStretchWrapper;
50 class EffectWrapper;
50 51
51 /** 52 /**
52 * AudioCallbackPlaySource manages audio data supply to callback-based 53 * AudioCallbackPlaySource manages audio data supply to callback-based
53 * audio APIs such as JACK or CoreAudio. It maintains one ring buffer 54 * audio APIs such as JACK or CoreAudio. It maintains one ring buffer
54 * per channel, filled during playback by a non-realtime thread, and 55 * per channel, filled during playback by a non-realtime thread, and
288 * setAuditioningEffect (depending on real-time constraints). 289 * setAuditioningEffect (depending on real-time constraints).
289 * 290 *
290 * Pass a null pointer to remove the current auditioning plugin, 291 * Pass a null pointer to remove the current auditioning plugin,
291 * if any. 292 * if any.
292 */ 293 */
293 virtual void setAuditioningEffect(Auditionable *plugin) override; 294 virtual void setAuditioningEffect(std::shared_ptr<Auditionable> plugin)
295 override;
294 296
295 /** 297 /**
296 * Specify that only the given set of models should be played. 298 * Specify that only the given set of models should be played.
297 */ 299 */
298 void setSoloModelSet(std::set<ModelId>s); 300 void setSoloModelSet(std::set<ModelId>s);
368 sv_frame_t m_lastModelEndFrame; 370 sv_frame_t m_lastModelEndFrame;
369 int m_ringBufferSize; 371 int m_ringBufferSize;
370 float m_outputLeft; 372 float m_outputLeft;
371 float m_outputRight; 373 float m_outputRight;
372 bool m_levelsSet; 374 bool m_levelsSet;
373 RealTimePluginInstance *m_auditioningPlugin;
374 bool m_auditioningPluginBypassed;
375 bool m_auditioningPluginFailed;
376 Scavenger<RealTimePluginInstance> m_pluginScavenger; 375 Scavenger<RealTimePluginInstance> m_pluginScavenger;
377 sv_frame_t m_playStartFrame; 376 sv_frame_t m_playStartFrame;
378 bool m_playStartFramePassed; 377 bool m_playStartFramePassed;
379 RealTime m_playStartedAt; 378 RealTime m_playStartedAt;
380 379
406 // which will be count or fewer. Return in the frame argument the 405 // which will be count or fewer. Return in the frame argument the
407 // new buffered frame position (which may be earlier than the 406 // new buffered frame position (which may be earlier than the
408 // frame argument passed in, in the case of looping). 407 // frame argument passed in, in the case of looping).
409 sv_frame_t mixModels(sv_frame_t &frame, sv_frame_t count, float **buffers); 408 sv_frame_t mixModels(sv_frame_t &frame, sv_frame_t count, float **buffers);
410 409
411 // Called from getSourceSamples.
412 void applyAuditioningEffect(sv_frame_t count, float *const *buffers);
413
414 // Ranges of current selections, if play selection is active 410 // Ranges of current selections, if play selection is active
415 std::vector<RealTime> m_rangeStarts; 411 std::vector<RealTime> m_rangeStarts;
416 std::vector<RealTime> m_rangeDurations; 412 std::vector<RealTime> m_rangeDurations;
417 void rebuildRangeLists(); 413 void rebuildRangeLists();
418 414
434 QMutex m_mutex; 430 QMutex m_mutex;
435 QWaitCondition m_condition; 431 QWaitCondition m_condition;
436 FillThread *m_fillThread; 432 FillThread *m_fillThread;
437 breakfastquay::ResamplerWrapper *m_resamplerWrapper; 433 breakfastquay::ResamplerWrapper *m_resamplerWrapper;
438 TimeStretchWrapper *m_timeStretchWrapper; 434 TimeStretchWrapper *m_timeStretchWrapper;
435 EffectWrapper *m_auditioningEffectWrapper;
439 void checkWrappers(); 436 void checkWrappers();
440 }; 437 };
441 438
442 #endif 439 #endif
443 440