From 1d3ca2e40908ababd16fe8b1c9070198f9b75c82 Mon Sep 17 00:00:00 2001 From: Paweł Kołodziejski Date: Wed, 6 Dec 2006 19:27:02 +0000 Subject: first phase of objectisation of agi engine svn-id: r24808 --- engines/agi/sound.h | 68 +++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 38 deletions(-) (limited to 'engines/agi/sound.h') 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 { @@ -45,15 +49,6 @@ namespace Agi { #define ENV_RELEASE 7500 /**< envelope release rate */ #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. */ @@ -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 */ -- cgit v1.2.3