|
@@ -80,7 +80,8 @@
|
|
/*============================================================================= =====================
|
|
/*============================================================================= =====================
|
|
SoundEngine.h
|
|
SoundEngine.h
|
|
=============================================================================== ===================*/
|
|
=============================================================================== ===================*/
|
|
-
|
|
|
|
|
|
+//TODO: replace openal with opensl es
|
|
|
|
+/*
|
|
#ifndef SOUND_ENGINE_H
|
|
#ifndef SOUND_ENGINE_H
|
|
#define SOUND_ENGINE_H
|
|
#define SOUND_ENGINE_H
|
|
|
|
|
|
@@ -96,16 +97,16 @@ namespace SoundEngine {
|
|
//Sound Engine
|
|
//Sound Engine
|
|
//============================================================================= =====================
|
|
//============================================================================= =====================
|
|
|
|
|
|
-/*!
|
|
|
|
- @enum SoundEngine error codes
|
|
|
|
- @abstract These are the error codes returned from the SoundEngine API.
|
|
|
|
- @constant kSoundEngineErrUnitialized The SoundEngine has not been initialized. Use SoundEngine_Initialize().
|
|
|
|
- @constant kSoundEngineErrInvalidID The specified EffectID was not found. This can occur if the effect has not been loaded, or
|
|
|
|
- if an unloaded is trying to be accessed.
|
|
|
|
- @constant kSoundEngineErrFileNotFound The specified file was not found.
|
|
|
|
- @constant kSoundEngineErrInvalidFileFormat The format of the file is invalid. Effect data must be little-endian 8 or 16 bit LPCM.
|
|
|
|
- @constant kSoundEngineErrDeviceNotFound The output device was not found.
|
|
|
|
- */
|
|
|
|
|
|
+
|
|
|
|
+// @enum SoundEngine error codes
|
|
|
|
+// @abstract These are the error codes returned from the SoundEngine API.
|
|
|
|
+// @constant kSoundEngineErrUnitialized The SoundEngine has not been initialized. Use SoundEngine_Initialize().
|
|
|
|
+// @constant kSoundEngineErrInvalidID The specified EffectID was not found. This can occur if the effect has not been loaded, or
|
|
|
|
+// if an unloaded is trying to be accessed.
|
|
|
|
+// @constant kSoundEngineErrFileNotFound The specified file was not found.
|
|
|
|
+// @constant kSoundEngineErrInvalidFileFormat The format of the file is invalid. Effect data must be little-endian 8 or 16 bit LPCM.
|
|
|
|
+// @constant kSoundEngineErrDeviceNotFound The output device was not found.
|
|
|
|
+
|
|
|
|
|
|
enum {
|
|
enum {
|
|
kSoundEngineErrUnitialized = 1,
|
|
kSoundEngineErrUnitialized = 1,
|
|
@@ -115,103 +116,97 @@ namespace SoundEngine {
|
|
kSoundEngineErrDeviceNotFound = 5
|
|
kSoundEngineErrDeviceNotFound = 5
|
|
};
|
|
};
|
|
|
|
|
|
- /*!
|
|
|
|
- @function SoundEngine_Initialize
|
|
|
|
- @abstract Initializes and sets up the sound engine. Calling after a previous initialize will
|
|
|
|
- reset the state of the SoundEngine, with all previous effects and music tracks
|
|
|
|
- erased. Note: This is not required, loading an effect or background track will
|
|
|
|
- initialize as necessary.
|
|
|
|
- @param inMixerOutputRate
|
|
|
|
- & nbsp; A Float32 that represents the output sample rate of the mixer unit. Setting this to
|
|
|
|
- 0 will use the default rate (the sample rate of the device)
|
|
|
|
- @result A OSStatus indicating success or failure.
|
|
|
|
- */
|
|
|
|
|
|
+
|
|
|
|
+// @function SoundEngine_Initialize
|
|
|
|
+// @abstract Initializes and sets up the sound engine. Calling after a previous initialize will
|
|
|
|
+// reset the state of the SoundEngine, with all previous effects and music tracks
|
|
|
|
+// erased. Note: This is not required, loading an effect or background track will
|
|
|
|
+// initialize as necessary.
|
|
|
|
+// @param inMixerOutputRate
|
|
|
|
+// & nbsp; A Float32 that represents the output sample rate of the mixer unit. Setting this to
|
|
|
|
+// 0 will use the default rate (the sample rate of the device)
|
|
|
|
+// @result A OSStatus indicating success or failure.
|
|
|
|
+
|
|
OSStatus SoundEngine_Initialize(Float32 inMixerOutputRate);
|
|
OSStatus SoundEngine_Initialize(Float32 inMixerOutputRate);
|
|
|
|
|
|
- /*!
|
|
|
|
- @function SoundEngine_Teardown
|
|
|
|
- @abstract Tearsdown the sound engine.
|
|
|
|
- @result A OSStatus indicating success or failure.
|
|
|
|
- */
|
|
|
|
|
|
+// @function SoundEngine_Teardown
|
|
|
|
+// @abstract Tearsdown the sound engine.
|
|
|
|
+// @result A OSStatus indicating success or failure.
|
|
|
|
+
|
|
OSStatus SoundEngine_Teardown();
|
|
OSStatus SoundEngine_Teardown();
|
|
|
|
|
|
- /*!
|
|
|
|
- @function SoundEngine_SetMasterVolume
|
|
|
|
- @abstract Sets the overall volume of all sounds coming from the process
|
|
|
|
- @param inValue
|
|
|
|
- & nbsp; A Float32 that represents the level. The range is between 0.0 and 1.0 (inclusive).
|
|
|
|
- @result A OSStatus indicating success or failure.
|
|
|
|
- */
|
|
|
|
|
|
+// @function SoundEngine_SetMasterVolume
|
|
|
|
+// @abstract Sets the overall volume of all sounds coming from the process
|
|
|
|
+// @param inValue
|
|
|
|
+// & nbsp; A Float32 that represents the level. The range is between 0.0 and 1.0 (inclusive).
|
|
|
|
+// @result A OSStatus indicating success or failure.
|
|
|
|
+
|
|
OSStatus SoundEngine_SetMasterVolume(Float32 inValue);
|
|
OSStatus SoundEngine_SetMasterVolume(Float32 inValue);
|
|
- /*!
|
|
|
|
- @function SoundEngine_SetListenerPosition
|
|
|
|
- @abstract Sets the position of the listener in the 3D space
|
|
|
|
- @param inX
|
|
|
|
- & nbsp; A Float32 that represents the listener's position along the X axis.
|
|
|
|
- @param inY
|
|
|
|
- & nbsp; A Float32 that represents the listener's position along the Y axis.
|
|
|
|
- @param inZ
|
|
|
|
- & nbsp; A Float32 that represents the listener's position along the Z axis.
|
|
|
|
- @result A OSStatus indicating success or failure.
|
|
|
|
- */
|
|
|
|
|
|
+
|
|
|
|
+// @function SoundEngine_SetListenerPosition
|
|
|
|
+// @abstract Sets the position of the listener in the 3D space
|
|
|
|
+// @param inX
|
|
|
|
+// & nbsp; A Float32 that represents the listener's position along the X axis.
|
|
|
|
+// @param inY
|
|
|
|
+// & nbsp; A Float32 that represents the listener's position along the Y axis.
|
|
|
|
+// @param inZ
|
|
|
|
+// & nbsp; A Float32 that represents the listener's position along the Z axis.
|
|
|
|
+// @result A OSStatus indicating success or failure.
|
|
|
|
+
|
|
OSStatus SoundEngine_SetListenerPosition(Float32 inX, Float32 inY, Float32 inZ);
|
|
OSStatus SoundEngine_SetListenerPosition(Float32 inX, Float32 inY, Float32 inZ);
|
|
|
|
|
|
- /*!
|
|
|
|
- @function SoundEngine_SetListenerGain
|
|
|
|
- @abstract Sets the gain of the listener. Must be >= 0.0
|
|
|
|
- @param inValue
|
|
|
|
- & nbsp; A Float32 that represents the listener's gain
|
|
|
|
- @result A OSStatus indicating success or failure.
|
|
|
|
- */
|
|
|
|
|
|
+
|
|
|
|
+// @function SoundEngine_SetListenerGain
|
|
|
|
+// @abstract Sets the gain of the listener. Must be >= 0.0
|
|
|
|
+// @param inValue
|
|
|
|
+// & nbsp; A Float32 that represents the listener's gain
|
|
|
|
+// @result A OSStatus indicating success or failure.
|
|
|
|
+
|
|
OSStatus SoundEngine_SetListenerGain(Float32 inValue);
|
|
OSStatus SoundEngine_SetListenerGain(Float32 inValue);
|
|
|
|
|
|
- /*!
|
|
|
|
- @function SoundEngine_LoadBackgroundMusicTrack
|
|
|
|
- @abstract Tells the background music player which file to play
|
|
|
|
- @param inPath
|
|
|
|
- & nbsp; The absolute path to the file to play.
|
|
|
|
- @param inAddToQueue
|
|
|
|
- & nbsp; If true, file will be added to the current background music queue. If
|
|
|
|
- false, queue will be cleared and only loop the specified file.
|
|
|
|
- @param inLoadAtOnce
|
|
|
|
- & nbsp; If true, file will be loaded completely into memory. If false, data will be
|
|
|
|
- streamed from the file as needed. For games without large memory pressure and/or
|
|
|
|
- small background music files, this can save memory access and improve power efficiency
|
|
|
|
- @result A OSStatus indicating success or failure.
|
|
|
|
- */
|
|
|
|
|
|
+// @function SoundEngine_LoadBackgroundMusicTrack
|
|
|
|
+// @abstract Tells the background music player which file to play
|
|
|
|
+// @param inPath
|
|
|
|
+// & nbsp; The absolute path to the file to play.
|
|
|
|
+// @param inAddToQueue
|
|
|
|
+// & nbsp; If true, file will be added to the current background music queue. If
|
|
|
|
+// false, queue will be cleared and only loop the specified file.
|
|
|
|
+// @param inLoadAtOnce
|
|
|
|
+// & nbsp; If true, file will be loaded completely into memory. If false, data will be
|
|
|
|
+// streamed from the file as needed. For games without large memory pressure and/or
|
|
|
|
+// small background music files, this can save memory access and improve power efficiency
|
|
|
|
+// @result A OSStatus indicating success or failure.
|
|
|
|
+
|
|
OSStatus SoundEngine_LoadBackgroundMusicTrack(const char* inPath, Boolean inAddToQueue, Boolean inLoadAtOnce);
|
|
OSStatus SoundEngine_LoadBackgroundMusicTrack(const char* inPath, Boolean inAddToQueue, Boolean inLoadAtOnce);
|
|
|
|
|
|
- /*!
|
|
|
|
- @function SoundEngine_UnloadBackgroundMusicTrack
|
|
|
|
- @abstract Tells the background music player to release all resources and stop playing.
|
|
|
|
- @result A OSStatus indicating success or failure.
|
|
|
|
- */
|
|
|
|
|
|
+// @function SoundEngine_UnloadBackgroundMusicTrack
|
|
|
|
+// @abstract Tells the background music player to release all resources and stop playing.
|
|
|
|
+// @result A OSStatus indicating success or failure.
|
|
|
|
+
|
|
OSStatus SoundEngine_UnloadBackgroundMusicTrack();
|
|
OSStatus SoundEngine_UnloadBackgroundMusicTrack();
|
|
|
|
|
|
- /*!
|
|
|
|
- @function SoundEngine_StartBackgroundMusic
|
|
|
|
- @abstract Tells the background music player to start playing.
|
|
|
|
- @result A OSStatus indicating success or failure.
|
|
|
|
- */
|
|
|
|
|
|
+
|
|
|
|
+// @function SoundEngine_StartBackgroundMusic
|
|
|
|
+// @abstract Tells the background music player to start playing.
|
|
|
|
+// @result A OSStatus indicating success or failure.
|
|
|
|
+
|
|
OSStatus SoundEngine_StartBackgroundMusic();
|
|
OSStatus SoundEngine_StartBackgroundMusic();
|
|
|
|
|
|
- /*!
|
|
|
|
- @function SoundEngine_StopBackgroundMusic
|
|
|
|
- @abstract Tells the background music player to stop playing.
|
|
|
|
- @param inAddToQueue
|
|
|
|
- & nbsp; If true, playback will stop when all tracks have completed. If false, playback
|
|
|
|
- will stop immediately.
|
|
|
|
- @result A OSStatus indicating success or failure.
|
|
|
|
- */
|
|
|
|
|
|
+// @function SoundEngine_StopBackgroundMusic
|
|
|
|
+// @abstract Tells the background music player to stop playing.
|
|
|
|
+// @param inAddToQueue
|
|
|
|
+// & nbsp; If true, playback will stop when all tracks have completed. If false, playback
|
|
|
|
+// will stop immediately.
|
|
|
|
+// @result A OSStatus indicating success or failure.
|
|
|
|
+
|
|
OSStatus SoundEngine_StopBackgroundMusic(Boolean inStopAtEnd);
|
|
OSStatus SoundEngine_StopBackgroundMusic(Boolean inStopAtEnd);
|
|
|
|
|
|
- /*!
|
|
|
|
- @function SoundEngine_SetBackgroundMusicVolume
|
|
|
|
- @abstract Sets the volume for the background music player
|
|
|
|
- @param inValue
|
|
|
|
- & nbsp; A Float32 that represents the level. The range is between 0.0 and 1.0 (inclusive).
|
|
|
|
- @result A OSStatus indicating success or failure.
|
|
|
|
- */
|
|
|
|
|
|
+// @function SoundEngine_SetBackgroundMusicVolume
|
|
|
|
+// @abstract Sets the volume for the background music player
|
|
|
|
+// @param inValue
|
|
|
|
+// & nbsp; A Float32 that represents the level. The range is between 0.0 and 1.0 (inclusive).
|
|
|
|
+// @result A OSStatus indicating success or failure.
|
|
|
|
+
|
|
OSStatus SoundEngine_SetBackgroundMusicVolume(Float32 inValue);
|
|
OSStatus SoundEngine_SetBackgroundMusicVolume(Float32 inValue);
|
|
|
|
|
|
//-Mat for loading caf files, this creates a soundeffect and sets outEffectID to it's alGenBuffer ID
|
|
//-Mat for loading caf files, this creates a soundeffect and sets outEffectID to it's alGenBuffer ID
|
|
@@ -219,3 +214,4 @@ namespace SoundEngine {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif //SOUND_ENGINE_H
|
|
#endif //SOUND_ENGINE_H
|
|
|
|
+*/
|