Axmol Engine 2.4.0-258ceca
|
Offers a interface to play audio. More...
#include <AudioEngine.h>
Public Types | |
enum class | AudioState |
AudioState enum,all possible states of an audio instance. | |
Static Public Member Functions | |
static void | end () |
Release objects relating to AudioEngine. | |
static AudioProfile * | getDefaultProfile () |
Gets the default profile of audio instances. | |
static AUDIO_ID | play2d (std::string_view filePath, bool loop=false, float volume=1.0f, const AudioProfile *profile=nullptr) |
Play 2d sound. | |
static AUDIO_ID | play2d (std::string_view filePath, const AudioPlayerSettings &settings, const AudioProfile *profile=nullptr) |
Play 2d sound. | |
static void | setLoop (AUDIO_ID audioID, bool loop) |
Sets whether an audio instance loop or not. | |
static bool | isLoop (AUDIO_ID audioID) |
Checks whether an audio instance is loop. | |
static void | setVolume (AUDIO_ID audioID, float volume) |
Sets volume for an audio instance. | |
static float | getVolume (AUDIO_ID audioID) |
Gets the volume value of an audio instance. | |
static void | setPitch (AUDIO_ID audioID, float pitch) |
Sets pitch for an audio instance. | |
static float | getPitch (AUDIO_ID audioID) |
Gets the volume value of an audio instance. | |
static void | pause (AUDIO_ID audioID) |
Pause an audio instance. | |
static void | pauseAll () |
Pause all playing audio instances. | |
static void | resume (AUDIO_ID audioID) |
Resume an audio instance. | |
static void | resumeAll () |
Resume all suspended audio instances. | |
static void | stop (AUDIO_ID audioID) |
Stop an audio instance. | |
static void | stopAll () |
Stop all audio instances. | |
static bool | setCurrentTime (AUDIO_ID audioID, float sec) |
Sets the current playback position of an audio instance. | |
static float | getCurrentTime (AUDIO_ID audioID) |
Gets the current playback position of an audio instance. | |
static float | getDuration (AUDIO_ID audioID) |
Gets the duration of an audio instance. | |
static AudioState | getState (AUDIO_ID audioID) |
Returns the state of an audio instance. | |
static void | setFinishCallback (AUDIO_ID audioID, const std::function< void(AUDIO_ID, std::string_view)> &callback) |
Register a callback to be invoked when an audio instance has completed playing. | |
static int | getMaxAudioInstance () |
Gets the maximum number of simultaneous audio instance of AudioEngine. | |
static bool | setMaxAudioInstance (int maxInstances) |
Sets the maximum number of simultaneous audio instance for AudioEngine. | |
static void | uncache (std::string_view filePath) |
Uncache the audio data from internal buffer. | |
static void | uncacheAll () |
Uncache all audio data from internal buffer. | |
static AudioProfile * | getProfile (AUDIO_ID audioID) |
Gets the audio profile by id of audio instance. | |
static AudioProfile * | getProfile (std::string_view profileName) |
Gets an audio profile by name. | |
static void | preload (std::string_view filePath) |
Preload audio file. | |
static void | preload (std::string_view filePath, std::function< void(bool isSuccess)> callback) |
Preload audio file. | |
static int | getPlayingAudioCount () |
Gets playing audio count. | |
static void | setEnabled (bool isEnabled) |
Whether to enable playing audios. | |
static bool | isEnabled () |
Check whether AudioEngine is enabled. | |
Offers a interface to play audio.
|
static |
Release objects relating to AudioEngine.
|
static |
Gets the default profile of audio instances.
|
static |
Play 2d sound.
filePath | The path of an audio file. |
loop | Whether audio instance loop or not. |
volume | Volume value (range from 0.0 to 1.0). |
profile | A profile for audio instance. When profile is not specified, default profile will be used. |
AudioProfile
|
static |
Play 2d sound.
filePath | The path of an audio file. |
settings | The player settings for audio. |
profile | A profile for audio instance. When profile is not specified, default profile will be used. |
AudioProfile
, AudioPlayerSettings
|
static |
Sets whether an audio instance loop or not.
audioID | An audioID returned by the play2d function. |
loop | Whether audio instance loop or not. |
|
static |
Checks whether an audio instance is loop.
audioID | An audioID returned by the play2d function. |
|
static |
Sets volume for an audio instance.
audioID | An audioID returned by the play2d function. |
volume | Volume value (range from 0.0 to 1.0). |
|
static |
Gets the volume value of an audio instance.
audioID | An audioID returned by the play2d function. |
|
static |
Sets pitch for an audio instance.
audioID | An audioID returned by the play2d function. |
pitch | Volume value (range from 0.5 to 2.0). |
|
static |
Gets the volume value of an audio instance.
audioID | An audioID returned by the play2d function. |
|
static |
Pause an audio instance.
audioID | An audioID returned by the play2d function. |
|
static |
Resume an audio instance.
audioID | An audioID returned by the play2d function. |
|
static |
Stop an audio instance.
audioID | An audioID returned by the play2d function. |
|
static |
Sets the current playback position of an audio instance.
audioID | An audioID returned by the play2d function. |
sec | The offset in seconds from the start to seek to. |
|
static |
Gets the current playback position of an audio instance.
audioID | An audioID returned by the play2d function. |
|
static |
Gets the duration of an audio instance.
audioID | An audioID returned by the play2d function. |
|
static |
Returns the state of an audio instance.
audioID | An audioID returned by the play2d function. |
|
static |
Register a callback to be invoked when an audio instance has completed playing.
audioID | An audioID returned by the play2d function. |
callback |
|
static |
Sets the maximum number of simultaneous audio instance for AudioEngine.
maxInstances | The maximum number of simultaneous audio instance. |
|
static |
Uncache the audio data from internal buffer.
AudioEngine cache audio data on ios,mac, and win32 platform.
filePath | Audio file path. |
|
static |
Uncache all audio data from internal buffer.
|
static |
Gets the audio profile by id of audio instance.
audioID | An audioID returned by the play2d function. |
|
static |
Gets an audio profile by name.
profileName | A name of audio profile. |
|
inlinestatic |
Preload audio file.
filePath | The file path of an audio. |
|
static |
Preload audio file.
filePath | The file path of an audio. |
callback | A callback which will be called after loading is finished. |
|
static |
Whether to enable playing audios.