annotate audioio/AudioCallbackPlayTarget.h @ 201:de783e8ee5f0

* Hoist alignment model set/query up to Model, so any models can be aligned * Add Model::aboutToDelete and aboutToBeDeleted for management of models that are contained by or referred to by other models instead of only the document
author Chris Cannam
date Wed, 24 Oct 2007 15:21:38 +0000
parents cd5d7ff8ef38
children
rev   line source
Chris@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@0 4 Sonic Visualiser
Chris@0 5 An audio file viewer and annotation editor.
Chris@0 6 Centre for Digital Music, Queen Mary, University of London.
Chris@0 7 This file copyright 2006 Chris Cannam.
Chris@0 8
Chris@0 9 This program is free software; you can redistribute it and/or
Chris@0 10 modify it under the terms of the GNU General Public License as
Chris@0 11 published by the Free Software Foundation; either version 2 of the
Chris@0 12 License, or (at your option) any later version. See the file
Chris@0 13 COPYING included with this distribution for more information.
Chris@0 14 */
Chris@0 15
Chris@0 16 #ifndef _AUDIO_CALLBACK_PLAY_TARGET_H_
Chris@0 17 #define _AUDIO_CALLBACK_PLAY_TARGET_H_
Chris@0 18
Chris@0 19 #include <QObject>
Chris@0 20
Chris@0 21 class AudioCallbackPlaySource;
Chris@0 22
Chris@0 23 class AudioCallbackPlayTarget : public QObject
Chris@0 24 {
Chris@0 25 Q_OBJECT
Chris@0 26
Chris@0 27 public:
Chris@0 28 AudioCallbackPlayTarget(AudioCallbackPlaySource *source);
Chris@0 29 virtual ~AudioCallbackPlayTarget();
Chris@0 30
Chris@0 31 virtual bool isOK() const = 0;
Chris@0 32
Chris@0 33 float getOutputGain() const {
Chris@0 34 return m_outputGain;
Chris@0 35 }
Chris@0 36
Chris@0 37 public slots:
Chris@0 38 /**
Chris@0 39 * Set the playback gain (0.0 = silence, 1.0 = levels unmodified)
Chris@0 40 */
Chris@0 41 virtual void setOutputGain(float gain);
Chris@0 42
Chris@0 43 /**
Chris@0 44 * The main source model (providing the playback sample rate) has
Chris@0 45 * been changed. The target should query the source's sample
Chris@0 46 * rate, set its output sample rate accordingly, and call back on
Chris@0 47 * the source's setTargetSampleRate to indicate what sample rate
Chris@0 48 * it succeeded in setting at the output. If this differs from
Chris@0 49 * the model rate, the source will resample.
Chris@0 50 */
Chris@0 51 virtual void sourceModelReplaced() = 0;
Chris@0 52
Chris@0 53 protected:
Chris@0 54 AudioCallbackPlaySource *m_source;
Chris@0 55 float m_outputGain;
Chris@0 56 };
Chris@0 57
Chris@0 58 #endif
Chris@0 59