AppEasy Core SDK  1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
IzPlatformAudio.h
Go to the documentation of this file.
00001 // 
00002 //
00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine
00004 //
00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk
00006 //
00007 // For updates, tutorials and more details check out www.appeasymobile.com
00008 //
00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin.
00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support
00011 //
00012 //
00013 
00014 #if !defined(_CIZ_PLATFORM_AUDIO_H_)
00015 #define _CIZ_PLATFORM_AUDIO_H_
00016 
00017 #include "CzPlatform.h"
00018 
00019 class CzScene;
00020 
00021 enum eCzAudioCodec
00022 {
00023     Audio_Codec_None, 
00024     Audio_Codec_Aac, 
00025     Audio_Codec_Aacplus, 
00026     Audio_Codec_Amr, 
00027     Audio_Codec_Midi, 
00028     Audio_Codec_Mp3, 
00029     Audio_Codec_Mp4, 
00030     Audio_Codec_Pcm, 
00031     Audio_Codec_Qcp, 
00032     Audio_Codec_Spf, 
00033 };
00034 
00035 #define PLATFORM_AUDIO      PLATFORM->getAudio()
00036 
00037 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00038 //
00039 // IzPlatformAudio
00040 //
00041 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00042 class IzPlatformAudio
00043 {
00044     // Properties
00045 protected:
00046     bool                    Initialised;                ///< Platform system initialised state
00047     bool                    SoundOn;                    ///< Sound on flag (will not play sound effects if off)
00048     bool                    MusicOn;                    ///< Music flag (will not play music if off(
00049 public:
00050     bool                    isInitialised() const               { return Initialised; }
00051     bool                    isSoundOn() const                   { return SoundOn; }
00052     virtual void            setSoundOn(bool on) = 0;
00053     bool                    isMusicOn() const                   { return MusicOn; }
00054     virtual void            setMusicOn(bool on) = 0;
00055     // Properties end
00056 public:
00057     virtual int             Init() = 0;
00058     virtual void            Release() = 0;
00059     virtual void            Update() = 0;
00060 
00061     virtual bool            InitSound(void* memory_file, int memory_file_size, CzSoundData& sound_data, CzSoundSpec& sound_spec) = 0;
00062     virtual CzSoundInst     PlaySound(unsigned int name_hash, CzScene* scene, float volume, float pitch, float pan, bool looped) = 0;
00063     virtual CzSoundInst     PlaySound(CzSoundSpec sound_spec, float volume, float pitch, float pan, bool looped) = 0;
00064     virtual void            StopSound(CzSoundInst sound_inst) = 0;
00065     virtual void            PauseSound(CzSoundInst sound_inst) = 0;
00066     virtual void            ResumeSound(CzSoundInst sound_inst) = 0;
00067     virtual void            setSoundVolume(CzSoundInst sound_inst, float volume) = 0;
00068     virtual void            setSoundPitch(CzSoundInst sound_inst, float pitch) = 0;
00069     virtual void            setSoundPan(CzSoundInst sound_inst, float pan) = 0;
00070     virtual void            StopAllSounds() = 0;
00071     virtual void            PauseAllSounds() = 0;
00072     virtual void            ResumeAllSounds() = 0;
00073     virtual bool            isSoundPlaying(CzSoundInst sound_inst) const = 0;
00074 
00075     virtual bool            isMusicCodecSupported(eCzAudioCodec codec) = 0;
00076     virtual void            setGlobalSoundVolume(float vol) = 0;
00077     virtual void            setMusicVolume(float vol) = 0;
00078     virtual bool            PlayMusic(const char* name, int repeat_count = 0) = 0;
00079     virtual bool            PlayMusic(void* buffer, uint32 buffer_length, uint32 repeat_count) = 0;
00080     virtual void            StopMusic() = 0;
00081     virtual void            PauseMusic() = 0;
00082     virtual void            ResumeMusic() = 0;
00083     virtual bool            isMusicPlaying() = 0;
00084 
00085     virtual void            DeleteSoundData(CzSoundData data) = 0;
00086     virtual void            DeleteSoundSpec(CzSoundSpec spec) = 0;
00087 };
00088 
00089 #endif  // _CIZ_PLATFORM_AUDIO_H_