Hatch Game Engine Documentation v1.4.0
The documentation for the Hatch Game Engine
Loading...
Searching...
No Matches
Music Class Reference

Music playback. More...

Public Member Functions

void Play (integer music, integer loopPoint, decimal panning=0.0, decimal speed=1.0, decimal volume=1.0, decimal startPoint=0.0, decimal fadeInAfterFinished=0.0)
 Places the music onto the music stack and plays it.
void Stop (integer music)
 Removes the music from the music stack, stopping it if currently playing.
void StopWithFadeOut (decimal seconds)
 Removes the music at the top of the music stack, fading it out over a time period.
void Pause ()
 Pauses the music at the top of the music stack.
void Resume ()
 Resumes the music at the top of the music stack.
void Clear ()
 Completely clears the music stack, stopping all music.
boolean IsPlaying (integer music)
 Checks to see if the specified music is currently playing.
decimal GetPosition (integer music)
 Gets the position of the current track playing.
void Alter (decimal panning, decimal speed, decimal volume)
 Alters the playback conditions of the current track playing.
integer GetLoopPoint (integer music)
 Gets the loop point of a music index, if it has one.
void SetLoopPoint (integer music, integer loopPoint)
 Sets the loop point of a music index.

Detailed Description

Music playback.

Member Function Documentation

◆ Alter()

void Music.Alter ( decimal panning,
decimal speed,
decimal volume )

Alters the playback conditions of the current track playing.

Parameters
panningControl the panning of the audio. -1.0 makes it sound in left ear only, 1.0 makes it sound in right ear, and closer to 0.0 centers it.
speedControl the speed of the audio. Higher than 1.0 makes it faster, lesser than 1.0 is slower, 1.0 is normal speed.
volumeControls the volume of the audio. 0.0 is muted, 1.0 is normal volume.

◆ GetLoopPoint()

integer Music.GetLoopPoint ( integer music)

Gets the loop point of a music index, if it has one.

Parameters
musicThe music index to get the loop point.
Returns
Returns the loop point in samples, as an integer value, or null if the audio does not have one.

◆ GetPosition()

decimal Music.GetPosition ( integer music)

Gets the position of the current track playing.

Parameters
musicThe music index to get the current position (in seconds) of.
Returns
Returns a decimal value.

◆ IsPlaying()

boolean Music.IsPlaying ( integer music)

Checks to see if the specified music is currently playing.

Parameters
musicThe music index to play.
Returns
Returns a boolean value.

◆ Play()

void Music.Play ( integer music,
integer loopPoint,
decimal panning = 0.0,
decimal speed = 1.0,
decimal volume = 1.0,
decimal startPoint = 0.0,
decimal fadeInAfterFinished = 0.0 )

Places the music onto the music stack and plays it.

Parameters
musicThe music index to play.
loopPointLoop point in samples. Use AUDIO_LOOP_NONE to play the track once or AUDIO_LOOP_DEFAULT to use the audio file's metadata. (default: AUDIO_LOOP_DEFAULT)
panningControl the panning of the audio. -1.0 makes it sound in left ear only, 1.0 makes it sound in right ear, and closer to 0.0 centers it.
speedControl the speed of the audio. Higher than 1.0 makes it faster, lesser than 1.0 is slower, 1.0 is normal speed.
volumeControls the volume of the audio. 0.0 is muted, 1.0 is normal volume.
startPointThe time (in seconds) to start the music at.
fadeInAfterFinishedThe time period to fade in the previous music track after the currently playing track finishes playing, in seconds.

◆ SetLoopPoint()

void Music.SetLoopPoint ( integer music,
integer loopPoint )

Sets the loop point of a music index.

Parameters
musicThe music index to set the loop point.
loopPointThe loop point in samples, or null to remove the audio's loop point.

◆ Stop()

void Music.Stop ( integer music)

Removes the music from the music stack, stopping it if currently playing.

Parameters
musicThe music index to stop.

◆ StopWithFadeOut()

void Music.StopWithFadeOut ( decimal seconds)

Removes the music at the top of the music stack, fading it out over a time period.

Parameters
secondsThe time period to fade out the music, in seconds.