comparison base/AudioPlaySource.h @ 1040:a1cd5abcb38b cxx11

Introduce and use a samplerate type
author Chris Cannam
date Wed, 04 Mar 2015 12:01:04 +0000
parents 6a94bb528e9d
children ca43c4b7719c
comparison
equal deleted inserted replaced
1039:b14064bd1f97 1040:a1cd5abcb38b
13 COPYING included with this distribution for more information. 13 COPYING included with this distribution for more information.
14 */ 14 */
15 15
16 #ifndef _AUDIO_PLAY_SOURCE_H_ 16 #ifndef _AUDIO_PLAY_SOURCE_H_
17 #define _AUDIO_PLAY_SOURCE_H_ 17 #define _AUDIO_PLAY_SOURCE_H_
18
19 #include "BaseTypes.h"
18 20
19 struct Auditionable { 21 struct Auditionable {
20 virtual ~Auditionable() { } 22 virtual ~Auditionable() { }
21 }; 23 };
22 24
35 37
36 /** 38 /**
37 * Start playing from the given frame. If playback is already 39 * Start playing from the given frame. If playback is already
38 * under way, reseek to the given frame and continue. 40 * under way, reseek to the given frame and continue.
39 */ 41 */
40 virtual void play(int startFrame) = 0; 42 virtual void play(sv_frame_t startFrame) = 0;
41 43
42 /** 44 /**
43 * Stop playback. 45 * Stop playback.
44 */ 46 */
45 virtual void stop() = 0; 47 virtual void stop() = 0;
51 53
52 /** 54 /**
53 * Return the frame number that is currently expected to be coming 55 * Return the frame number that is currently expected to be coming
54 * out of the speakers. (i.e. compensating for playback latency.) 56 * out of the speakers. (i.e. compensating for playback latency.)
55 */ 57 */
56 virtual int getCurrentPlayingFrame() = 0; 58 virtual sv_frame_t getCurrentPlayingFrame() = 0;
57 59
58 /** 60 /**
59 * Return the current (or thereabouts) output levels in the range 61 * Return the current (or thereabouts) output levels in the range
60 * 0.0 -> 1.0, for metering purposes. 62 * 0.0 -> 1.0, for metering purposes.
61 */ 63 */
63 65
64 /** 66 /**
65 * Return the sample rate of the source material -- any material 67 * Return the sample rate of the source material -- any material
66 * that wants to play at a different rate will sound wrong. 68 * that wants to play at a different rate will sound wrong.
67 */ 69 */
68 virtual int getSourceSampleRate() const = 0; 70 virtual sv_samplerate_t getSourceSampleRate() const = 0;
69 71
70 /** 72 /**
71 * Return the sample rate set by the target audio device (or the 73 * Return the sample rate set by the target audio device (or the
72 * source sample rate if the target hasn't set one). If the 74 * source sample rate if the target hasn't set one). If the
73 * source and target sample rates differ, resampling will occur. 75 * source and target sample rates differ, resampling will occur.
74 */ 76 */
75 virtual int getTargetSampleRate() const = 0; 77 virtual sv_samplerate_t getTargetSampleRate() const = 0;
76 78
77 /** 79 /**
78 * Get the block size of the target audio device. This may be an 80 * Get the block size of the target audio device. This may be an
79 * estimate or upper bound, if the target has a variable block 81 * estimate or upper bound, if the target has a variable block
80 * size; the source should behave itself even if this value turns 82 * size; the source should behave itself even if this value turns