Module that handles audio features.
More...
Module that handles audio features.
◆ ShutterId
Shutter sound IDs for Sound.playShutter.
Enumerator |
---|
IMAGE_CAPTURE | Image capture shutter sound.
|
VIDEO_CAPTURE_START | Video record start shutter sound.
|
VIDEO_CAPTURE_END | Video record end shutter sound.
|
◆ init()
void Sound::init |
( |
void |
| ) |
|
Initialize audio subsystem.
- Usage example:
Definition luaSound.cpp:16
void init(void)
Initialize audio subsystem.
◆ term()
void Sound::term |
( |
void |
| ) |
|
Terminate audio subsystem.
- Usage example:
void term(void)
Terminate audio subsystem.
◆ open()
int Sound::open |
( |
string |
filename | ) |
|
Open an audio file.
- Usage example:
int open(string filename)
Open an audio file.
- Parameters
-
filename | - Name of the file to open |
- Returns
- A valid sound ID.
- Note
- Supported audio formats: .wav, .aif, .aiff, .opus, .ogg, .mid, .midi, .mp3.
-
This function can be used to reproduce audio track from a .pshv video file too.
◆ play()
void Sound::play |
( |
int |
music, |
|
|
bool |
loop |
|
) |
| |
Play a sound.
- Usage example:
void play(int music, bool loop)
Play a sound.
- Parameters
-
music | - A valid sound ID. |
loop | - If true, playback will loop (optional). |
◆ pause()
void Sound::pause |
( |
int |
music | ) |
|
Pause a sound.
- Usage example:
void pause(int music)
Pause a sound.
- Parameters
-
◆ resume()
void Sound::resume |
( |
int |
music | ) |
|
Resume a sound.
- Usage example:
void resume(int music)
Resume a sound.
- Parameters
-
◆ close()
void Sound::close |
( |
int |
music | ) |
|
Close an opened sound.
- Usage example:
void close(int music)
Close an opened sound.
- Parameters
-
◆ isPlaying()
bool Sound::isPlaying |
( |
int |
music | ) |
|
Check if a given sound is in playing state.
- Usage example:
end
bool isPlaying(int music)
Check if a given sound is in playing state.
- Parameters
-
- Returns
- true if playing, false otherwise.
◆ setVolume()
void Sound::setVolume |
( |
int |
music, |
|
|
int |
volume |
|
) |
| |
Set internal volume for a given sound.
- Usage example:
void setVolume(int music, int volume)
Set internal volume for a given sound.
- Parameters
-
music | - A valid sound ID. |
volume | - Volume value to set. |
- Note
- volume must be in a range of 0 and 32767.
◆ getVolume()
int Sound::getVolume |
( |
int |
music | ) |
|
Get internal volume for a given sound.
- Usage example:
int getVolume(int music)
Get internal volume for a given sound.
- Parameters
-
- Returns
- Volume value of the given sound.
◆ getTitle()
string Sound::getTitle |
( |
int |
music | ) |
|
Get song title of a given sound.
- Usage example:
string getTitle(int music)
Get song title of a given sound.
- Parameters
-
- Returns
- Song title of the given sound.
- Note
- This function works only with .ogg, .mp3, .opus and .wav audio files.
◆ getAuthor()
string Sound::getAuthor |
( |
int |
music | ) |
|
Get song author of a given sound.
- Usage example:
string getAuthor(int music)
Get song author of a given sound.
- Parameters
-
- Returns
- Song author of the given sound.
- Note
- This function works only with .ogg, .mp3, .opus and .wav audio files.
◆ playShutter()
Play a shutter sound.
- Usage example:
void playShutter(ShutterId id)
Play a shutter sound.
@ IMAGE_CAPTURE
Image capture shutter sound.
Definition luaSound.cpp:11
- Parameters
-
id | - A valid shutter sound ID. |