-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sound.h
62 lines (52 loc) · 1.33 KB
/
Sound.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
62
#pragma once
#pragma comment(lib, "dsound.lib")
#pragma comment(lib, "dxguid.lib")
#pragma comment(lib, "winmm.lib")
#include <windows.h>
#include <mmsystem.h>
#include <dsound.h>
#include <stdio.h>
class Sound
{
private:
struct WaveHeaderType
{
char chunkId[4];
unsigned long chunkSize;
char format[4];
char subChunkId[4];
unsigned long subChunkSize;
unsigned short audioFormat;
unsigned short numChannels;
unsigned long sampleRate;
unsigned long bytesPerSecond;
unsigned short blockAlign;
unsigned short bitsPerSample;
char dataChunkId[4];
unsigned long dataSize;
};
public:
Sound();
Sound(const Sound&);
~Sound();
bool Initialize(HWND);
void Shutdown();
bool PlayBGM(int);
void StopBGM();
void PlaySE(int);
private:
bool InitializeDirectSound(HWND);
void ShutdownDirectSound();
bool LoadWaveFile(char*, IDirectSoundBuffer8**);
void ShutdownWaveFile(IDirectSoundBuffer8**);
private:
IDirectSound8* m_DirectSound;
IDirectSoundBuffer* m_primaryBuffer;
IDirectSoundBuffer8** m_bgmBuffers;
int num_bgm;
int current_bgm;
IDirectSoundBuffer8** m_seBuffers;
int num_se;
int currentLaser;
int currentHit;
};