| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#ifndef _OPENCITY_AUDIOMANAGER_H_ |
| 22 |
#define _OPENCITY_AUDIOMANAGER_H_ 1 |
| 23 |
|
| 24 |
#include "main.h" |
| 25 |
|
| 26 |
#define OC_AUDIO_FREQUENCY 44100 // CD quality |
| 27 |
#define OC_AUDIO_FORMAT AUDIO_S16SYS // host system signed byte order |
| 28 |
#define OC_AUDIO_CHANNELS 2 // 2 channels for stereo |
| 29 |
#define OC_AUDIO_CHUNK_SIZE 4096 // mixer's sample chunk size |
| 30 |
|
| 31 |
#define OC_AUDIO_MIX_CHANNELS 8 // total number of mix channels |
| 32 |
#define OC_AUDIO_RESERVED_CHANNELS 4 // reserved channels for sound effects |
| 33 |
|
| 34 |
#define OC_AUDIO_VOLUME_MIN 0 |
| 35 |
#define OC_AUDIO_VOLUME_MAX MIX_MAX_VOLUME |
| 36 |
|
| 37 |
#define OC_MAX_FILENAME_LENGTH 255 |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
class AudioManager { |
| 45 |
public: |
| 46 |
|
| 47 |
enum AUDIO_CHANNEL { |
| 48 |
AUDIO_CENTER_CHANNEL = -1, |
| 49 |
AUDIO_LEFT_CHANNEL = 0, |
| 50 |
AUDIO_LEFT_HALF_CHANNEL = 1, |
| 51 |
AUDIO_RIGHT_CHANNEL = 3, |
| 52 |
AUDIO_RIGHT_HALF_CHANNEL = 2 |
| 53 |
}; |
| 54 |
|
| 55 |
AudioManager(); |
| 56 |
~AudioManager(); |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
OPENCITY_ERR_CODE OpenAudio(void); |
| 63 |
OPENCITY_ERR_CODE CloseAudio(void); |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
OPENCITY_ERR_CODE |
| 69 |
LoadMusicList( |
| 70 |
const string& csrFilename, |
| 71 |
const string& csrPrefix = "" ); |
| 72 |
|
| 73 |
const uint & |
| 74 |
GetNumberMusic(void) const; |
| 75 |
|
| 76 |
bool |
| 77 |
PlayingMusic(void) const; |
| 78 |
|
| 79 |
OPENCITY_ERR_CODE |
| 80 |
PlayMusic( |
| 81 |
const uint & rcuiMusicIndex, |
| 82 |
const int & rciLoops = 1 ); |
| 83 |
|
| 84 |
OPENCITY_ERR_CODE |
| 85 |
PlayNextMusic( |
| 86 |
const int & rciLoops = 1 ); |
| 87 |
|
| 88 |
OPENCITY_ERR_CODE |
| 89 |
PlayPreviousMusic( |
| 90 |
const int & rciLoops = 1 ); |
| 91 |
|
| 92 |
void |
| 93 |
StopMusic(void) const; |
| 94 |
|
| 95 |
void |
| 96 |
ToggleRandomMusic(void); |
| 97 |
|
| 98 |
void |
| 99 |
ToggleMusic(void); |
| 100 |
|
| 101 |
void |
| 102 |
VolumeMusic( const int & rciVol ) const; |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
OPENCITY_ERR_CODE |
| 111 |
LoadSoundList( |
| 112 |
const string & csrFilename, |
| 113 |
const string& csrPrefix = "" ); |
| 114 |
|
| 115 |
const uint & |
| 116 |
GetNumberSound(void) const; |
| 117 |
|
| 118 |
OPENCITY_ERR_CODE |
| 119 |
PlaySound( |
| 120 |
const uint & rcuiSoundIndex, |
| 121 |
const AUDIO_CHANNEL & enumChannel = AUDIO_CENTER_CHANNEL ); |
| 122 |
|
| 123 |
void |
| 124 |
ToggleSound(void); |
| 125 |
|
| 126 |
void |
| 127 |
VolumeSound( const int & rciVol ) const; |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
private: |
| 132 |
bool boolAudioDeviceInitialized; |
| 133 |
bool boolMusicEnabled; |
| 134 |
bool boolSoundEnabled; |
| 135 |
uint uiNumberSound; |
| 136 |
uint uiNumberMusic; |
| 137 |
uint uiCurrentMusic; |
| 138 |
}; |
| 139 |
|
| 140 |
#endif |
| 141 |
|