Audio
Functions
Audio Ready
Checks if SplashKit audio currently ready to be used. Should this return false
, you may want to use Open Audio
to enable audio.
Return Type: Boolean
Signatures:
bool audio_ready()
public static bool Audio.IsReady { get }public static bool SplashKit.AudioReady();
def audio_ready():
function AudioReady(): Boolean
Close Audio
Turns off audio, stopping all current sounds effects and music.
Signatures:
void close_audio()
public static void SplashKit.CloseAudio();
def close_audio():
procedure CloseAudio()
Open Audio
Starts the SplashKit audio system working.
Signatures:
void open_audio()
public static void SplashKit.OpenAudio();
def open_audio():
procedure OpenAudio()
Fade Music In
Fade Music In
Fades music file matching the name to full volume over a specified number of milliseconds
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the Music file to play. |
ms | Integer | How many milliseconds it takes to fade the Music to full volume |
Signatures:
void fade_music_in(const string &name, int ms)
public static void SplashKit.FadeMusicIn(string name, int ms);
def fade_music_in_named(name, ms):
procedure FadeMusicIn(const name: String; ms: Integer)
Fade Music In
Fades music file matching the name to full volume over a specified number of milliseconds and loops a specified number of times
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the Music file to play. |
times | Integer | Controls the number of times the music is played. |
ms | Integer | How many milliseconds it takes to fade the Music to full volume |
Signatures:
void fade_music_in(const string &name, int times, int ms)
public static void SplashKit.FadeMusicIn(string name, int times, int ms);
def fade_music_in_named_with_times(name, times, ms):
procedure FadeMusicIn(const name: String; times: Integer; ms: Integer)
Fade Music In
Fades music up to full volume over a specified number of milliseconds.
Parameters:
Name | Type | Description |
---|---|---|
data | Music | The name of the Music to play. |
ms | Integer | How many milliseconds it takes to fade the Music to full volume |
Signatures:
void fade_music_in(music data, int ms)
public void Music.FadeIn(int ms);public static void SplashKit.FadeMusicIn(Music data, int ms);
def fade_music_in(data, ms):
procedure FadeMusicIn(data: Music; ms: Integer)
Fade Music In
Fades music up to full volume over a specified number of milliseconds for a specified number of times.
Parameters:
Name | Type | Description |
---|---|---|
data | Music | The name of the Music to play. |
times | Integer | Controls the number of times the music is played. |
ms | Integer | How many milliseconds it takes to fade the Music to full volume |
Signatures:
void fade_music_in(music data, int times, int ms)
public void Music.FadeIn(int times, int ms);public static void SplashKit.FadeMusicIn(Music data, int times, int ms);
def fade_music_in_with_times(data, times, ms):
procedure FadeMusicIn(data: Music; times: Integer; ms: Integer)
Fade Music Out
Fades music outover a specified number of milliseconds
Parameters:
Name | Type | Description |
---|---|---|
ms | Integer | How many milliseconds it takes to fade the Music out |
Signatures:
void fade_music_out(int ms)
public static void Audio.FadeOut(int ms);public static void SplashKit.FadeMusicOut(int ms);
def fade_music_out(ms):
procedure FadeMusicOut(ms: Integer)
Free All Music
Releases all of the music files that have been loaded.
Signatures:
void free_all_music()
public static void Audio.FreeAllMusic();public static void SplashKit.FreeAllMusic();
def free_all_music():
procedure FreeAllMusic()
Free Music
Releases the SplashKit resources associated with music.
Parameters:
Name | Type | Description |
---|---|---|
effect | Music | The music file whose resources should be released. |
Signatures:
void free_music(music effect)
public static void SplashKit.FreeMusic(Music effect);
def free_music(effect):
procedure FreeMusic(effect: Music)
Has Music
Determines if SplashKit has a music file loaded for the supplied name. This checks against all music files loaded, those loaded without a name are assigned the filename as a default. If this returns false
, you may want to use Load Music
to load in a specific sound effect and give it the desired name.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name to check if a music file is loaded. |
Return Type: Boolean
Signatures:
bool has_music(const string &name)
public static bool SplashKit.HasMusic(string name);
def has_music(name):
function HasMusic(const name: String): Boolean
Load Music
Loads and returns a music value. The supplied filename
is used to locate the music file to load. The supplied name
indicates the name to use to refer to this Music value. The Music
can then be retrieved by passing this name
to the Music Named
function.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the resource for SplashKit |
filename | String | The filename to load |
Return Type: Music
Signatures:
music load_music(const string &name, const string &filename)
public static Music SplashKit.LoadMusic(string name, string filename);public Music(string name, string filename);
def load_music(name, filename):
function LoadMusic(const name: String; const filename: String): Music
Music Filename
Returns the filename the of the music data
Parameters:
Name | Type | Description |
---|---|---|
data | Music | The music resource |
Return Type: String
Signatures:
string music_filename(music data)
public string Music.Filename { get }public static string SplashKit.MusicFilename(Music data);
def music_filename(data):
function MusicFilename(data: Music): String
Music Name
Returns the name that SplashKit uses to refer to this music data
Parameters:
Name | Type | Description |
---|---|---|
data | Music | The music resource |
Return Type: String
Signatures:
string music_name(music data)
public string Music.Name { get }public static string SplashKit.MusicName(Music data);
def music_name(data):
function MusicName(data: Music): String
Music Named
Retrieves a Music
that has been loaded into SplashKit.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the music file to return. |
Return Type: Music
Signatures:
music music_named(const string &name)
public static Music SplashKit.MusicNamed(string name);
def music_named(name):
function MusicNamed(const name: String): Music
Music Playing
Checks whether music is currently playing.
Return Type: Boolean
Signatures:
bool music_playing()
public static bool Audio.Playing { get }public static bool SplashKit.MusicPlaying();
def music_playing():
function MusicPlaying(): Boolean
Music Valid
Lets you test if music value is valid. This will return true when it is a valid music.
Parameters:
Name | Type | Description |
---|---|---|
m | Music | the music source to test |
Return Type: Boolean
Signatures:
bool music_valid(music m)
public static bool SplashKit.MusicValid(Music m);
def music_valid(m):
function MusicValid(m: Music): Boolean
Music Volume
Returns the volume of the currently playing Music
.
Return Type: Double
Signatures:
double music_volume()
public static double Audio.Volume { get }public static double SplashKit.MusicVolume();
def music_volume():
function MusicVolume(): Double
Pause Music
Pauses currently playing music - see resume_music to continue playing.
Signatures:
void pause_music()
public static void Audio.Pause();public static void SplashKit.PauseMusic();
def pause_music():
procedure PauseMusic()
Play Music
Play Music
Plays the music file that matches the name once at full volume.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the Music to play. |
Signatures:
void play_music(const string &name)
public static void SplashKit.PlayMusic(string name);
def play_music_named(name):
procedure PlayMusic(const name: String)
Play Music
Plays the music file that matches the name a specified number of times at full volume.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the Music to play. |
times | Integer | Controls the number of times the music is played. |
Signatures:
void play_music(const string &name, int times)
public static void SplashKit.PlayMusic(string name, int times);
def play_music_named_with_times(name, times):
procedure PlayMusic(const name: String; times: Integer)
Play Music
Plays a music file once at full volume.
Parameters:
Name | Type | Description |
---|---|---|
data | Music | The name of the Music to play. |
Signatures:
void play_music(music data)
public void Music.Play();public static void SplashKit.PlayMusic(Music data);
def play_music(data):
procedure PlayMusic(data: Music)
Play Music
Plays a music file a specified number of times at full volume.
Parameters:
Name | Type | Description |
---|---|---|
data | Music | The name of the Music to play. |
times | Integer | Controls the number of times the music is played. |
Signatures:
void play_music(music data, int times)
public void Music.Play(int times);public static void SplashKit.PlayMusic(Music data, int times);
def play_music_with_times(data, times):
procedure PlayMusic(data: Music; times: Integer)
Play Music
Plays a music file for a specified number of times and playback volume.
Parameters:
Name | Type | Description |
---|---|---|
data | Music | The name of the Music to play. |
times | Integer | Controls the number of times the music is played. |
volume | Double | Indicates the percentage of the original volume to play the Music at. This must be between 0 and 1 . |
Signatures:
void play_music(music data, int times, double volume)
public void Music.Play(int times, double volume);public static void SplashKit.PlayMusic(Music data, int times, double volume);
def play_music_with_times_and_volume(data, times, volume):
procedure PlayMusic(data: Music; times: Integer; volume: Double)
Resume Music
Resumes currently paused music - see pause_music to pause playing music.
Signatures:
void resume_music()
public static void Audio.Resume();public static void SplashKit.ResumeMusic();
def resume_music():
procedure ResumeMusic()
Set Music Volume
Sets the volume of the currently playing Music
. Must be between 0 and 1, e.g. 0.1 is 10%.
Parameters:
Name | Type | Description |
---|---|---|
volume | Double | Indicates the percentage of the original volume to play the Music at. This must be between 0 and 1 . |
Signatures:
void set_music_volume(double volume)
public static void Audio.Volume { set }public static void SplashKit.SetMusicVolume(double volume);
def set_music_volume(volume):
procedure SetMusicVolume(volume: Double)
Stop Music
Stops currently playing music.
Signatures:
void stop_music()
public static void Audio.Stop();public static void SplashKit.StopMusic();
def stop_music():
procedure StopMusic()
Fade All Sound Effects Out
Fades out all Sound Effect
s over the specified milliseconds.
Parameters:
Name | Type | Description |
---|---|---|
ms | Integer | The number of milliseconds to fade out all sound effects. |
Signatures:
void fade_all_sound_effects_out(int ms)
public static void SplashKit.FadeAllSoundEffectsOut(int ms);
def fade_all_sound_effects_out(ms):
procedure FadeAllSoundEffectsOut(ms: Integer)
Fade Sound Effect Out
Fades out the Sound Effect
over the specified milliseconds.
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The Sound Effect to fade out. |
ms | Integer | The number of milliseconds to fade out the Sound Effect . |
Signatures:
void fade_sound_effect_out(sound_effect effect, int ms)
public void SoundEffect.FadeOut(int ms);public static void SplashKit.FadeSoundEffectOut(SoundEffect effect, int ms);
def fade_sound_effect_out(effect, ms):
procedure FadeSoundEffectOut(effect: SoundEffect; ms: Integer)
Free All Sound Effects
Releases all of the sound effects that have been loaded.
Signatures:
void free_all_sound_effects()
public static void SplashKit.FreeAllSoundEffects();
def free_all_sound_effects():
procedure FreeAllSoundEffects()
Free Sound Effect
Releases the SplashKit resources associated with the sound effect.
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The Sound Effect whose resources should be released. |
Signatures:
void free_sound_effect(sound_effect effect)
public void SoundEffect.Close();public static void SplashKit.FreeSoundEffect(SoundEffect effect);
def free_sound_effect(effect):
procedure FreeSoundEffect(effect: SoundEffect)
Has Sound Effect
Determines if SplashKit has a sound effect loaded for the supplied name. This checks against all sounds loaded, those loaded without a name are assigned the filename as a default. If this returns false
, you may want to use Load Sound Effect
to load in a specific sound effect and give it the desired name.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name to check if a sound effect is loaded. |
Return Type: Boolean
Signatures:
bool has_sound_effect(const string &name)
public static bool SplashKit.HasSoundEffect(string name);
def has_sound_effect(name):
function HasSoundEffect(const name: String): Boolean
Load Sound Effect
The supplied filename
is used to locate the sound effect to load. The supplied name
indicates the name to use to refer to this Sound Effect
. The Sound Effect
can then be retrieved by passing this name
to the Sound Effect Named
function.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name used to refer to the sound effect. |
filename | String | The filename used to locate the sound effect to use. |
Return Type: Sound Effect
Signatures:
sound_effect load_sound_effect(const string &name, const string &filename)
public static SoundEffect SplashKit.LoadSoundEffect(string name, string filename);public SoundEffect(string name, string filename);
def load_sound_effect(name, filename):
function LoadSoundEffect(const name: String; const filename: String): SoundEffect
Usage:
Play Sound Effect
Play Sound Effect
Plays a sound effect once at full volume.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the effect to play. |
Signatures:
void play_sound_effect(const string &name)
public static void SplashKit.PlaySoundEffect(string name);
def play_sound_effect_named(name):
procedure PlaySoundEffect(const name: String)
Play Sound Effect
Plays a sound effect once at full volume.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the effect to play. |
volume | Double | The volume to play the Sound Effect |
Signatures:
void play_sound_effect(const string &name, double volume)
public static void SplashKit.PlaySoundEffect(string name, double volume);
def play_sound_effect_named_with_volume(name, volume):
procedure PlaySoundEffect(const name: String; volume: Double)
Play Sound Effect
Plays a sound effect for a specified number of times at full volume.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the effect to play. |
times | Integer | Controls the number of times the sound effect is played. |
Signatures:
void play_sound_effect(const string &name, int times)
public static void SplashKit.PlaySoundEffect(string name, int times);
def play_sound_effect_named_with_times(name, times):
procedure PlaySoundEffect(const name: String; times: Integer)
Play Sound Effect
Plays a sound effect for a specified number of times and playback volume.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the effect to play. |
times | Integer | Controls the number of times the sound effect is played. |
volume | Double | Indicates the percentage of the original volume to play the Sound Effect at. This must be between 0 and 1 . |
Signatures:
void play_sound_effect(const string &name, int times, double volume)
public static void SplashKit.PlaySoundEffect(string name, int times, double volume);
def play_sound_effect_named_with_times_and_volume(name, times, volume):
procedure PlaySoundEffect(const name: String; times: Integer; volume: Double)
Play Sound Effect
Plays a sound effect once at full volume.
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The effect indicates which sound effect to start playing. |
Signatures:
void play_sound_effect(sound_effect effect)
public void SoundEffect.Play();public static void SplashKit.PlaySoundEffect(SoundEffect effect);
def play_sound_effect(effect):
procedure PlaySoundEffect(effect: SoundEffect)
Usage:
Play Sound Effect
Plays a sound effect once at playback volume.
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The effect indicates which sound effect to start playing. |
volume | Double | Indicates the percentage of the original volume to play the Sound Effect at. This must be between 0 and 1 . |
Signatures:
void play_sound_effect(sound_effect effect, double volume)
public void SoundEffect.Play(double volume);public static void SplashKit.PlaySoundEffect(SoundEffect effect, double volume);
def play_sound_effect_with_volume(effect, volume):
procedure PlaySoundEffect(effect: SoundEffect; volume: Double)
Play Sound Effect
Plays a sound effect once at full volume.
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The effect indicates which sound effect to start playing. |
times | Integer | Controls the number of times the sound effect is played. |
Signatures:
void play_sound_effect(sound_effect effect, int times)
public void SoundEffect.Play(int times);public static void SplashKit.PlaySoundEffect(SoundEffect effect, int times);
def play_sound_effect_with_times(effect, times):
procedure PlaySoundEffect(effect: SoundEffect; times: Integer)
Play Sound Effect
This version of Play Sound Effect
allows you to control both the number of times the Sound Effect
is repeated and its playback volume.
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The effect indicates which sound effect to start playing. |
times | Integer | Controls the number of times the sound effect is played. |
volume | Double | Indicates the percentage of the original volume to play the Sound Effect at. This must be between 0 and 1 . |
Signatures:
void play_sound_effect(sound_effect effect, int times, double volume)
public void SoundEffect.Play(int times, double volume);public static void SplashKit.PlaySoundEffect(SoundEffect effect, int times, double volume);
def play_sound_effect_with_times_and_volume(effect, times, volume):
procedure PlaySoundEffect(effect: SoundEffect; times: Integer; volume: Double)
Sound Effect Filename
Returns the filename of the Sound Effect
that has been loaded by SplashKit
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The Sound Effect to check |
Return Type: String
Signatures:
string sound_effect_filename(sound_effect effect)
public string SoundEffect.Filename { get }public static string SplashKit.SoundEffectFilename(SoundEffect effect);
def sound_effect_filename(effect):
function SoundEffectFilename(effect: SoundEffect): String
Sound Effect Name
Returns the name of the Sound Effect
that has been loaded by SplashKit
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The Sound Effect to check |
Return Type: String
Signatures:
string sound_effect_name(sound_effect effect)
public string SoundEffect.Name { get }public static string SplashKit.SoundEffectName(SoundEffect effect);
def sound_effect_name(effect):
function SoundEffectName(effect: SoundEffect): String
Sound Effect Named
Retrieves a Sound Effect
that has been loaded into SplashKit. If the sound effect has not been loaded, this will attempt to use the name to locate the file for you. If a file can be found, the sound effect is loaded and returned.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the sound effect to return. |
Return Type: Sound Effect
Signatures:
sound_effect sound_effect_named(const string &name)
public static SoundEffect SplashKit.SoundEffectNamed(string name);
def sound_effect_named(name):
function SoundEffectNamed(const name: String): SoundEffect
Usage:
Sound Effect Playing
Sound Effect Playing
Checks whether the Sound Effect
that matches the name is currently playing
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the Sound Effect |
Return Type: Boolean
Signatures:
bool sound_effect_playing(const string &name)
public static bool SplashKit.SoundEffectPlaying(string name);
def sound_effect_playing_named(name):
function SoundEffectPlaying(const name: String): Boolean
Sound Effect Playing
Checks whether the Sound Effect
is currently playing
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The Sound Effect to be tested. |
Return Type: Boolean
Signatures:
bool sound_effect_playing(sound_effect effect)
public bool SoundEffect.IsPlaying { get }public static bool SplashKit.SoundEffectPlaying(SoundEffect effect);
def sound_effect_playing(effect):
function SoundEffectPlaying(effect: SoundEffect): Boolean
Sound Effect Valid
Lets you test if a sound effect is valid. This will return true when it is a valid sound effect.
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | the effect to test |
Return Type: Boolean
Signatures:
bool sound_effect_valid(sound_effect effect)
public static bool SplashKit.SoundEffectValid(SoundEffect effect);
def sound_effect_valid(effect):
function SoundEffectValid(effect: SoundEffect): Boolean
Stop Sound Effect
Stop Sound Effect
Stops the Sound Effect
that matches the name, if it is currently playing.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the Sound Effect to stop. |
Signatures:
void stop_sound_effect(const string &name)
public static void SplashKit.StopSoundEffect(string name);
def stop_sound_effect_named(name):
procedure StopSoundEffect(const name: String)
Stop Sound Effect
Stops the Sound Effect
if it is currently playing
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The Sound Effect to stop. |
Signatures:
void stop_sound_effect(sound_effect effect)
public void SoundEffect.Stop();public static void SplashKit.StopSoundEffect(SoundEffect effect);
def stop_sound_effect(effect):
procedure StopSoundEffect(effect: SoundEffect)
Types
Music
The Music type is used to refer to music that can be
played by SplashKit. Music files are loaded with
Load Music
, played using Play Music
, and must be
released using Free Music
.
Unlike Sound Effect
s, there can only be one music track
playing at a time. Playing an new track will stop the currently
playing music and switch to the new track.
Sound Effect
The Sound Effect
type is used to refer to sound effects that can be
played by the SplashKit audio code. Sound effects are:
-
loaded with
Load Sound Effect
, -
played using
Play Sound Effect
, -
and must be released using
delete_sound_effect
(to release a specific sound effect) ordelete_all_sound_effects
(to release all loaded sound effects).
SplashKit will mix the audio from multiple sound effects, making it
possible to play multiple Sound Effect
s, or even to play the one
Sound Effect
multiple times.
You can check if a Sound Effect
is currently playing using
Sound Effect Playing
.
To stop a Sound Effect
playing use Stop Sound Effect
. This will stop all
instances of this one sound effect from playing.
Use Music
for background music for your games.