ReactOS 0.4.16-dev-197-g92996da
audio_waveout.hpp
Go to the documentation of this file.
1/* PROJECT: ReactOS sndrec32
2 * LICENSE: GPL - See COPYING in the top level directory
3 * FILE: base/applications/sndrec32/audio_waveout.hpp
4 * PURPOSE: Windows MM wave out abstraction
5 * PROGRAMMERS: Marco Pagliaricci (irc: rendar)
6 */
7
8#ifndef _AUDIOWAVEOUT__H_
9#define _AUDIOWAVEOUT__H_
10
11#include "audio_format.hpp"
12#include "audio_producer.hpp"
13
15
17{
25};
26
28{
29 friend class audio_buffer;
30
31 private:
34
35 protected:
39
42
43 /* Audio Playing Thread id */
45
47 float buf_secs;
48
49 /* The temporary buffers for the audio data outgoing to the waveout
50 device and its size, and its total number */
51
52 /* base address for entire memory */
54
55 /* size in bytes for the entire memory */
56 unsigned int mb_size;
57
58 /* number of little buffers */
59 unsigned int buffers;
60
61 /* Protected Functions */
62
63 void init_(void);
64 void alloc_buffers_mem_(unsigned int, float);
65 void free_buffers_mem_(void);
66
67 void init_headers_(void);
68 void prep_headers_(void);
69 void unprep_headers_(void);
70
71 public:
72 /* Ctors */
74 audio_producer &a_buf) : wave_headers(0),
75 aud_info(aud_fmt),
76 audio_buf(a_buf),
78 main_buffer(0),
79 mb_size(0),
81 {
82 /* Initializing internal wavein data */
83 init_();
84 }
85
86 /* Dtor */
88 {
89 }
90
91 /* Public Functions */
92
93 void open(void);
94 void play(void);
95 void pause(void);
96 void stop(void);
97 void close(void);
98
100 {
101 return status;
102 }
103
104 BYTE *buf(void)
105 {
106 return main_buffer;
107 }
108
109 unsigned int bufsz(void)
110 {
111 return mb_size;
112 }
113
114 unsigned int samplevalue_max(void)
115 {
116 if (aud_info.bits() == 16)
117 return (unsigned int)65535;
118 else if (aud_info.bits() == 8)
119 return (unsigned int)255;
120 else
121 return 0;
122 }
123
124 unsigned tot_samples_buf(void)
125 {
127 }
128
129 unsigned int nsample(unsigned int nsamp)
130 {
131 unsigned int svalue;
132
133 if (aud_info.bits() == 16)
134 svalue = (unsigned int)abs(*((short *)(main_buffer + aud_info.bytes_in_samples(nsamp))));
135 else if (aud_info.bits() == 8)
136 svalue = (unsigned int)((ptrdiff_t) *(main_buffer + aud_info.bytes_in_samples(nsamp)));
137 else
138 svalue = 0;
139
140 return svalue;
141 }
142};
143
145
146#endif /* _AUDIOWAVEOUT__H_ */
#define _AUDIO_DEFAULT_WAVEOUTBUFFERS
Definition: audio_def.hpp:18
#define _AUDIO_NAMESPACE_START_
Definition: audio_def.hpp:24
#define _AUDIO_NAMESPACE_END_
Definition: audio_def.hpp:25
audio_waveout_status
@ WAVEOUT_NOTREADY
@ WAVEOUT_PAUSED
@ WAVEOUT_PLAYING
@ WAVEOUT_ERR
@ WAVEOUT_FLUSHING
@ WAVEOUT_STOP
@ WAVEOUT_READY
unsigned short int bits(void) const
unsigned int bytes_in_samples(unsigned int samples) const
unsigned int samples_in_bytes(unsigned int bytes) const
HANDLE wakeup_playthread
void play(void)
unsigned int bufsz(void)
static DWORD WINAPI playing_procedure(LPVOID)
unsigned int mb_size
void stop(void)
audio_waveout_status current_status(void)
WAVEHDR * wave_headers
audio_producer & audio_buf
void open(void)
void init_(void)
void init_headers_(void)
friend class audio_buffer
BYTE * buf(void)
void alloc_buffers_mem_(unsigned int, float)
const audio_format & aud_info
unsigned int buffers
void close(void)
void unprep_headers_(void)
void prep_headers_(void)
unsigned tot_samples_buf(void)
void free_buffers_mem_(void)
WAVEFORMATEX wave_format
void pause(void)
unsigned int nsample(unsigned int nsamp)
audio_waveout_status status
HWAVEOUT waveout_handle
audio_waveout(const audio_format &aud_fmt, audio_producer &a_buf)
unsigned int samplevalue_max(void)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
#define abs(i)
Definition: fconv.c:206
unsigned long DWORD
Definition: ntddk_ex.h:95
const GLuint * buffers
Definition: glext.h:5916
Definition: ps.c:97
#define WINAPI
Definition: msvc.h:6
unsigned char BYTE
Definition: xxhash.c:193