diff options
Diffstat (limited to 'engines/agi/sound.h')
-rw-r--r-- | engines/agi/sound.h | 68 |
1 files changed, 30 insertions, 38 deletions
diff --git a/engines/agi/sound.h b/engines/agi/sound.h index ac7afaafe4..90420ac673 100644 --- a/engines/agi/sound.h +++ b/engines/agi/sound.h @@ -25,7 +25,11 @@ #ifndef AGI_SOUND_H #define AGI_SOUND_H -#include "agi/agi.h" +#include "sound/audiostream.h" + +namespace Audio { +class Mixer; +} // End of namespace Audio namespace Agi { @@ -46,15 +50,6 @@ namespace Agi { #define NUM_CHANNELS 7 /**< number of sound channels */ /** - * AGI engine sound driver structure. - */ -struct sound_driver { - char *description; - int (*init) (int16 * buffer); - void (*deinit) (void); -}; - -/** * AGI sound resource structure. */ struct agi_sound { @@ -102,38 +97,18 @@ struct channel_info { uint32 env; }; -void decode_sound(int); -void unload_sound(int); -void play_sound(void); -int init_sound(void); -void deinit_sound(void); -void start_sound(int, int); -void stop_sound(void); -uint32 mix_sound(void); -int load_instruments(char *fname); - -extern struct sound_driver *snd; - -#endif /* AGI_SOUND_H */ - -} // End of namespace Agi +class AgiEngine; -#include "sound/audiostream.h" +class SoundMgr : public Audio::AudioStream { + AgiEngine *_vm; -namespace Audio { -class Mixer; -} // End of namespace Audio - -namespace Agi { - -class AGIMusic : public Audio::AudioStream { public: - AGIMusic(Audio::Mixer * pMixer); - ~AGIMusic(void); + SoundMgr(AgiEngine *agi, Audio::Mixer *pMixer); + ~SoundMgr(); virtual void setVolume(uint8 volume); // AudioStream API - int readBuffer(int16 * buffer, const int numSamples) { + int readBuffer(int16 *buffer, const int numSamples) { premixerCall(buffer, numSamples / 2); return numSamples; } @@ -152,10 +127,27 @@ public: } private: - Audio::Mixer * _mixer; + Audio::Mixer *_mixer; uint32 _sampleRate; - void premixerCall(int16 * buf, uint len); + void premixerCall(int16 *buf, uint len); + +public: + + void decode_sound(int); + void unload_sound(int); + void play_sound(); + int init_sound(); + void deinit_sound(); + void start_sound(int, int); + void stop_sound(); + void stop_note(int i); + void play_note(int i, int freq, int vol); + void play_agi_sound(); + uint32 mix_sound(); + int load_instruments(char *fname); }; } // End of namespace Agi + +#endif /* AGI_SOUND_H */ |