Class Audio
- Namespace
- MohawkGame2D
- Assembly
- GAME 10003 Game Development Foundations - 2D Game Template.dll
Access audio functions.
public static class Audio
- Inheritance
-
Audio
- Inherited Members
Remarks
A static wrapper to standardize raylib's audio API.
Properties
LoadedMusic
Get an array of all loaded music.
public static Music[] LoadedMusic { get; }
Property Value
- Music[]
LoadedSounds
Get an array of all loaded sounds.
public static Sound[] LoadedSounds { get; }
Property Value
- Sound[]
Methods
GetMusicLength(Music)
Get the length of music
in seconds.
public static float GetMusicLength(Music music)
Parameters
music
MusicThe music data to check.
Returns
- float
Returns the length of audio file
music
in seconds.
IsPlaying(Music)
Checks if music
is playing.
public static bool IsPlaying(Music music)
Parameters
music
MusicThe music to check.
Returns
- bool
Returns true if playing, false otherwise.
IsPlaying(Sound)
Checks if sound
is playing.
public static bool IsPlaying(Sound sound)
Parameters
sound
SoundThe sound to check.
Returns
- bool
Returns true if playing, false otherwise.
LoadMusic(string)
Loads a music file at filePath
.
public static Music LoadMusic(string filePath)
Parameters
filePath
stringThe file path to the audio file.
Returns
- Music
Returns the loaded music data.
Remarks
Music should be more than 10s long, otherwise use Sound. Supported file types: FLAC, MOD, MP3, OGG, QOA, WAV, XM.
LoadSound(string)
Loads a sound file at filePath
.
public static Sound LoadSound(string filePath)
Parameters
filePath
stringThe file path to the audio file.
Returns
- Sound
Returns the loaded sound data.
Remarks
Sound should be 10s or less, otherwise use Music. Supported file types: FLAC, MOD, MP3, OGG, QOA, WAV, XM.
Pause(Music)
Pause a playing music
.
public static void Pause(Music music)
Parameters
music
MusicThe music to pause.
Pause(Sound)
Pause a playing sound
.
public static void Pause(Sound sound)
Parameters
sound
SoundThe sound to pause.
Play(Music)
Plays music
.
public static void Play(Music music)
Parameters
music
MusicThe music to play.
Play(Sound)
Plays sound
.
public static void Play(Sound sound)
Parameters
sound
SoundThe sound to play.
Resume(Music)
Resumes a paused music
.
public static void Resume(Music music)
Parameters
music
MusicThe music to resume.
Resume(Sound)
Resumes a paused sound
.
public static void Resume(Sound sound)
Parameters
sound
SoundThe sound to resume.
SetPan(Music, float)
Sets the pan
for music
.
public static void SetPan(Music music, float pan)
Parameters
SetPan(Sound, float)
Sets the pan
for sound
.
public static void SetPan(Sound sound, float pan)
Parameters
SetPitch(Music, float)
Sets the pitch
for music
.
public static void SetPitch(Music music, float pitch)
Parameters
SetPitch(Sound, float)
Sets the pitch
for sound
.
public static void SetPitch(Sound sound, float pitch)
Parameters
SetVolume(Music, float)
Sets the volume
for music
.
public static void SetVolume(Music music, float volume)
Parameters
SetVolume(Sound, float)
Sets the volume
for sound
.
public static void SetVolume(Sound sound, float volume)
Parameters
Stop(Music)
Stop a playing or paused music
.
public static void Stop(Music music)
Parameters
music
MusicThe music to stop.
Stop(Sound)
Stop a playing or paused sound
.
public static void Stop(Sound sound)
Parameters
sound
SoundThe sound to stop.
UnloadMusic(Music)
Unloads music
from memory.
public static void UnloadMusic(Music music)
Parameters
music
MusicThe music to unload.
UnloadSound(Sound)
Unloads a sound
from memory.
public static void UnloadSound(Sound sound)
Parameters
sound
SoundThe sound to unload.