-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSoundServer.h
executable file
·61 lines (39 loc) · 1.52 KB
/
SoundServer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*********************************************************************************
SoundServer - Written by Arnaud Carré (aka Leonard / OXYGENE)
Part of the "Leonard Homepage Articles".
PART 1: Using WaveOut API.
How to make a SoundServer under windows, to play various sound.
WARNING: This sample plays a 44.1Khz, 16bits, mono sound. Should be quite easy to modify ! :-)
Read the complete article on my web page:
http://leonard.oxg.free.fr
WARNING: You have to link this with the Windows MultiMedia library. (WINMM.LIB)
*********************************************************************************/
#ifndef __SOUNDSERVER__
#define __SOUNDSERVER__
#define REPLAY_RATE 44100
#define REPLAY_DEPTH 16
#define REPLAY_SAMPLELEN (REPLAY_DEPTH/8)
#define REPLAY_NBSOUNDBUFFER 2
typedef void (*USER_CALLBACK) (void *pBuffer,long bufferLen);
class CSoundServer
{
public:
CSoundServer();
~CSoundServer();
BOOL open( USER_CALLBACK pUserCallback,
long totalBufferedSoundLen=4000); // Buffered sound, in ms
void close(void);
BOOL IsRunning() { return m_pUserCallback != NULL; }
// Do *NOT* call this internal function:
void fillNextBuffer(void);
private:
HWND m_hWnd;
long m_bufferSize;
long m_currentBuffer;
HWAVEOUT m_hWaveOut;
WAVEHDR m_waveHeader[REPLAY_NBSOUNDBUFFER];
void * m_pSoundBuffer[REPLAY_NBSOUNDBUFFER];
volatile USER_CALLBACK m_pUserCallback;
};
#endif