Table of Contents

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 Music

The 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 Music

The 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 Sound

The 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 string

The 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 string

The 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 Music

The music to pause.

Pause(Sound)

Pause a playing sound.

public static void Pause(Sound sound)

Parameters

sound Sound

The sound to pause.

Play(Music)

Plays music.

public static void Play(Music music)

Parameters

music Music

The music to play.

Play(Sound)

Plays sound.

public static void Play(Sound sound)

Parameters

sound Sound

The sound to play.

Resume(Music)

Resumes a paused music.

public static void Resume(Music music)

Parameters

music Music

The music to resume.

Resume(Sound)

Resumes a paused sound.

public static void Resume(Sound sound)

Parameters

sound Sound

The sound to resume.

SetPan(Music, float)

Sets the pan for music.

public static void SetPan(Music music, float pan)

Parameters

music Music

The music to pan.

pan float

The pan value. 0.5 is center, 0 left, and 1 right.

SetPan(Sound, float)

Sets the pan for sound.

public static void SetPan(Sound sound, float pan)

Parameters

sound Sound

The sound to pan.

pan float

The pan value. 0.5 is center, 0 left, and 1 right.

SetPitch(Music, float)

Sets the pitch for music.

public static void SetPitch(Music music, float pitch)

Parameters

music Music

The music to pitch.

pitch float

The pitch value. 1.0 is the base pitch level.

SetPitch(Sound, float)

Sets the pitch for sound.

public static void SetPitch(Sound sound, float pitch)

Parameters

sound Sound

The sound to pitch.

pitch float

The pitch value. 1.0 is the base pitch level.

SetVolume(Music, float)

Sets the volume for music.

public static void SetVolume(Music music, float volume)

Parameters

music Music

The music to set.

volume float

The volume amount. 0 is silent, 1 is max volume.

SetVolume(Sound, float)

Sets the volume for sound.

public static void SetVolume(Sound sound, float volume)

Parameters

sound Sound

The sound to set.

volume float

The volume amount. 0 is silent, 1 is max volume.

Stop(Music)

Stop a playing or paused music.

public static void Stop(Music music)

Parameters

music Music

The music to stop.

Stop(Sound)

Stop a playing or paused sound.

public static void Stop(Sound sound)

Parameters

sound Sound

The sound to stop.

UnloadMusic(Music)

Unloads music from memory.

public static void UnloadMusic(Music music)

Parameters

music Music

The music to unload.

UnloadSound(Sound)

Unloads a sound from memory.

public static void UnloadSound(Sound sound)

Parameters

sound Sound

The sound to unload.