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
musicMusicThe music data to check.
Returns
- float
Returns the length of audio file
musicin seconds.
IsPlaying(Music)
Checks if music is playing.
public static bool IsPlaying(Music music)
Parameters
musicMusicThe 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
soundSoundThe 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
filePathstringThe 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
filePathstringThe 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
musicMusicThe music to pause.
Pause(Sound)
Pause a playing sound.
public static void Pause(Sound sound)
Parameters
soundSoundThe sound to pause.
Play(Music)
Plays music.
public static void Play(Music music)
Parameters
musicMusicThe music to play.
Play(Sound)
Plays sound.
public static void Play(Sound sound)
Parameters
soundSoundThe sound to play.
Resume(Music)
Resumes a paused music.
public static void Resume(Music music)
Parameters
musicMusicThe music to resume.
Resume(Sound)
Resumes a paused sound.
public static void Resume(Sound sound)
Parameters
soundSoundThe 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
musicMusicThe music to stop.
Stop(Sound)
Stop a playing or paused sound.
public static void Stop(Sound sound)
Parameters
soundSoundThe sound to stop.
UnloadMusic(Music)
Unloads music from memory.
public static void UnloadMusic(Music music)
Parameters
musicMusicThe music to unload.
UnloadSound(Sound)
Unloads a sound from memory.
public static void UnloadSound(Sound sound)
Parameters
soundSoundThe sound to unload.