-
Notifications
You must be signed in to change notification settings - Fork 1
/
SoundSystem.h
executable file
·75 lines (56 loc) · 1.83 KB
/
SoundSystem.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
63
64
65
66
67
68
69
70
71
72
73
74
75
//****************************************************************************
//
// File: SoundSystem.h
// Programmer: T.J. Eason
// Project: Game Engine
// Description: Wrapper class for playing audio files using DirectMusic
// Date: 2-24-10
// Revision 1: 3-25-10
// Reference: DirectX Manual
//
// ****************************************************************************
#ifndef SOUND_SYSTEM_H
#define SOUND_SYSTEM_H
// Sound system class
class SoundSystem
{
public:
SoundSystem( float scale = 1.0f );
virtual ~SoundSystem();
void UpdateListener( D3DXVECTOR3 forward, D3DXVECTOR3 position, D3DXVECTOR3 velocity );
void GarbageCollection();
void SetVolume( long volume );
IDirectMusicLoader8 *GetLoader();
IDirectMusicPerformance8 *GetPerformance();
private:
float m_scale; // Unit scale in meters/unit
IDirectMusicLoader8 *m_loader; // DirectMusic loader
IDirectMusicPerformance8 *m_performance; // DirectMusic performance
IDirectSound3DListener8 *m_listener; // DirectSound 3D listener
};
// Sound class
class Sound
{
public:
Sound( char *filename );
virtual ~Sound();
void Play( bool loop = false, unsigned long flags = DMUS_SEGF_AUTOTRANSITION );
IDirectMusicSegment8 *GetSegment();
private:
IDirectMusicSegment8 *m_segment;
};
// Audio path 3D class
class AudioPath3D
{
public:
AudioPath3D();
virtual ~AudioPath3D();
void SetPosition( D3DXVECTOR3 position );
void SetVelocity( D3DXVECTOR3 velocity );
void SetMode( unsigned long mode );
void Play( IDirectMusicSegment8 *segment, bool loop =false, unsigned long flags = DMUS_SEGF_SECONDARY );
private:
IDirectMusicAudioPath8 *m_audioPath; // DirectMusic audo path for 3D playback
IDirectSound3DBuffer8 *m_soundBuffer; // Pointer to audio path's sound buffer
};
#endif