Sync with trunk (r48545)
[reactos.git] / base / applications / sndrec32 / audio_producer.hpp
1 /* PROJECT: ReactOS sndrec32
2 * LICENSE: GPL - See COPYING in the top level directory
3 * FILE: base/applications/sndrec32/audio_producer.hpp
4 * PURPOSE: Audio producer
5 * PROGRAMMERS: Marco Pagliaricci (irc: rendar)
6 */
7
8 #ifndef _AUDIOAUDBUF__H_
9 #define _AUDIOAUDBUF__H_
10
11
12
13 #include "audio_def.hpp"
14 #include "audio_producer.hpp"
15
16
17
18
19
20
21 _AUDIO_NAMESPACE_START_
22
23
24
25
26
27 class audio_producer
28 {
29
30
31 protected:
32
33
34 unsigned int bytes_played_;
35
36
37
38
39
40 public:
41
42
43 //
44 // Ctors
45 //
46
47 audio_producer ( ) : bytes_played_( 0 ), play_finished ( 0 )
48 { }
49
50
51
52
53
54
55
56
57
58 //
59 // Dtor
60 //
61
62 virtual ~audio_producer( void )
63 { }
64
65
66
67
68 //
69 // Public Functions
70 //
71
72
73 //reads N bytes from the buffer
74 virtual unsigned int read( BYTE *, unsigned int ) = 0;
75
76 virtual bool finished ( void ) = 0;
77
78
79
80
81 unsigned int bytes_played( void ) const
82 {
83 return bytes_played_;
84 }
85
86
87 void set_position( unsigned int pos )
88 {
89 bytes_played_ = pos;
90 }
91
92 void set_position_start( void )
93 {
94 bytes_played_ = 0 ;
95 }
96
97
98
99 void forward( unsigned int bytes )
100 {
101 bytes_played_ += bytes ;
102 }
103
104
105 void backward( unsigned int bytes )
106 {
107 bytes_played_ += bytes ;
108 }
109
110 void ( * play_finished )( void );
111
112
113
114
115 };
116
117
118
119
120 _AUDIO_NAMESPACE_END_
121
122
123
124
125
126
127 #endif //ifdef _AUDIOAUDBUF__H_