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