annotate base/AudioPlaySource.h @ 290:92e8dbde73cd

* Revert revision 713. We do like QStrings after all.
author Chris Cannam
date Fri, 24 Aug 2007 11:41:48 +0000
parents d3ac9f953ebf
children a1b6d2e33cab
rev   line source
Chris@49 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@52 4 Sonic Visualiser
Chris@52 5 An audio file viewer and annotation editor.
Chris@52 6 Centre for Digital Music, Queen Mary, University of London.
Chris@52 7 This file copyright 2006 Chris Cannam.
Chris@0 8
Chris@52 9 This program is free software; you can redistribute it and/or
Chris@52 10 modify it under the terms of the GNU General Public License as
Chris@52 11 published by the Free Software Foundation; either version 2 of the
Chris@52 12 License, or (at your option) any later version. See the file
Chris@52 13 COPYING included with this distribution for more information.
Chris@0 14 */
Chris@0 15
Chris@0 16 #ifndef _AUDIO_PLAY_SOURCE_H_
Chris@0 17 #define _AUDIO_PLAY_SOURCE_H_
Chris@0 18
Chris@0 19 /**
Chris@0 20 * Simple interface for audio playback. This should be all that the
Chris@0 21 * ViewManager needs to know about to synchronise with playback by
Chris@0 22 * sample frame, but it doesn't provide enough to determine what is
Chris@0 23 * actually being played or how. See the audioio directory for a
Chris@0 24 * concrete subclass.
Chris@0 25 */
Chris@0 26
Chris@0 27 class AudioPlaySource
Chris@0 28 {
Chris@0 29 public:
Chris@27 30 virtual ~AudioPlaySource() { }
Chris@27 31
Chris@0 32 /**
Chris@0 33 * Start playing from the given frame. If playback is already
Chris@0 34 * under way, reseek to the given frame and continue.
Chris@0 35 */
Chris@0 36 virtual void play(size_t startFrame) = 0;
Chris@0 37
Chris@0 38 /**
Chris@0 39 * Stop playback.
Chris@0 40 */
Chris@0 41 virtual void stop() = 0;
Chris@0 42
Chris@0 43 /**
Chris@0 44 * Return whether playback is currently supposed to be happening.
Chris@0 45 */
Chris@0 46 virtual bool isPlaying() const = 0;
Chris@0 47
Chris@0 48 /**
Chris@0 49 * Return the frame number that is currently expected to be coming
Chris@0 50 * out of the speakers. (i.e. compensating for playback latency.)
Chris@0 51 */
Chris@0 52 virtual size_t getCurrentPlayingFrame() = 0;
Chris@0 53
Chris@0 54 /**
Chris@0 55 * Return the current (or thereabouts) output levels in the range
Chris@0 56 * 0.0 -> 1.0, for metering purposes.
Chris@0 57 */
Chris@0 58 virtual bool getOutputLevels(float &left, float &right) = 0;
Chris@40 59
Chris@40 60 /**
Chris@249 61 * Return the sample rate of the source material -- any material
Chris@249 62 * that wants to play at a different rate will sound wrong.
Chris@249 63 */
Chris@249 64 virtual size_t getSourceSampleRate() const = 0;
Chris@249 65
Chris@249 66 /**
Chris@40 67 * Return the sample rate set by the target audio device (or the
Chris@249 68 * source sample rate if the target hasn't set one). If the
Chris@249 69 * source and target sample rates differ, resampling will occur.
Chris@40 70 */
Chris@40 71 virtual size_t getTargetSampleRate() const = 0;
Chris@249 72
Chris@0 73 };
Chris@0 74
Chris@0 75 #endif