-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsound.h
More file actions
103 lines (90 loc) · 2.51 KB
/
Copy pathsound.h
File metadata and controls
103 lines (90 loc) · 2.51 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// sound.h
//
using namespace std;
#pragma once
#include <windef.h>
#include <minwindef.h>
#include "dsound.h"
#include <stdio.h>
typedef enum
{
SOUND_1_CLICK,
SOUND_3_JUMPEND,
SOUND_10_BOUM,
SOUND_11_TRESOR,
SOUND_13_ENDKO,
SOUND_14_ENDOK,
SOUND_16_HELICOHIGH,
SOUND_18_HELICOLOW,
SOUND_23_PLOUF,
SOUND_24_BLUP,
SOUND_29_JEEPHIGH,
SOUND_31_JEEPLOW,
SOUND_33_DOOR,
SOUND_41_RESSORT,
SOUND_42_STARTSHIELD,
SOUND_50_SUCETTE,
SOUND_51_GLU,
SOUND_57_DRINK,
SOUND_58_CHARGE,
SOUND_59_ELECTRO,
SOUND_60_PERSOTAKE,
SOUND_64_TIPLOUF,
SOUND_69_BLITZ,
SOUND_74_ANGEL,
SOUND_75_SCIE,
SOUND_76_SWITCHOFF,
SOUND_92_FOLLOW
}
Sound;
///////////////////////////////////////////////////////////////////////////
#define MAXSOUND 100
#define MAXVOLUME 20
#define MAXBLUPI 100
#define WIN32_LEAN_AND_MEAN
class CSound
{
public:
CSound();
~CSound();
BOOL Create(HWND hWnd);
void SetState(BOOL bState);
BOOL GetEnable();
void SetAudioVolume(int volume);
int GetAudioVolume();
void SetMidiVolume(int volume);
int GetMidiVolume();
void CacheAll();
BOOL Cache(int channel, char *pFilename);
void Flush(int channel);
BOOL Play (int channel, int volume=0, int pan=0);
BOOL StopSound(Sound channel);
BOOL PlayImage(int channel, POINT pos, int rank=-1);
BOOL PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename);
BOOL RestartMusic();
void SuspendMusic();
void StopMusic();
BOOL IsPlayingMusic();
void AdaptVolumeMusic();
void SetSuspendSkip(int nb);
protected:
BOOL CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, BOOL bStereo);
BOOL ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos);
BOOL CreateBufferFromWaveFile(int dwBuf, char *pFileName);
BOOL StopAllSounds();
BOOL PlaySoundDS(DWORD dwSound, DWORD dwFlags);
protected:
HWND m_hWnd;
BOOL m_bEnable;
BOOL m_bState;
BOOL m_bCDAudio;
LPDIRECTSOUND m_lpDS;
LPDIRECTSOUNDBUFFER m_lpDSB[MAXSOUND];
short m_channelBlupi[MAXBLUPI];
UINT m_MidiDeviceID;
char m_MIDIFilename[50];
int m_audioVolume;
int m_midiVolume;
int m_lastMidiVolume;
int m_nbSuspendSkip;
};