The NewAudio object [E/M/W]
The NewAudio object allows you to create sound channels and has overall better music management than the Audio object.
Audio Channels can play up to one sound at a time, and will stop any currently playing sounds if you add a new sound to the channel.
NOTE! The default audio channel used by the Audio object (not this one) is called "src".
It exists at the start of the encounter, and, by default, all music and sounds will be played there.
You may use it as the argument "name" in all of the below functions.
- NewAudio.CreateChannel( name) - Creates the audio channel
name.
- NewAudio.DestroyChannel( name) - Destroys the audio channel
name.
- NewAudio.Exists( name) - Checks if the audio channel
name exists.
- NewAudio.GetAudioName( name,
withPrefix = true) - Gets the name and type of the audio clip currently playing in the channel
name as a string.
If no audio is playing in a channel, this function returns "empty".
If withPrefix is true, the string returned by this function will begin with music: for music clips,
sound: for sound clips and voice: for voice clips.
For example, playing the sound dogsecret in an audio channel
and using this function on that channel would return the string "sound:dogsecret" (or "dogsecret").
- NewAudio.GetTotalTime( name) - Gets the length of time in seconds that an audio channel name's most recently played audio lasts for.
- NewAudio.GetPlayTime( name) or NewAudio.GetCurrentTime( name) - Get the current play position of the current audio of this channel
in seconds.
- NewAudio.PlayMusic( name, music,
loop = false, volume = 1) - Plays the music
music on the channel name.
loop tells the engine if it should loop the music or not;
volume is the volume of the music.
Songs played are loaded from your mod's Audio folder, as .ogg or .wav files. Don't include the file extension.
- NewAudio.PlaySound( name, sound,
loop = false, volume = 0.65) - Plays the sound
sound on the channel name.
loop tells the engine if it should loop the sound or not;
volume is the volume of the sound.
Sounds played are loaded from your mod's Sounds folder, as .ogg or .wav files. Don't include the file extension.
- NewAudio.PlayVoice( name, voice,
loop = false, volume = 0.65) - Plays the voice
voice on the channel name.
loop tells the engine if it should loop the voice or not;
volume is the volume of the voice.
Voices played are loaded from your mod's Sounds/Voices folder, as .ogg or .wav files. Don't include the file extension.
- NewAudio.SetPitch( name, value) - Sets the pitch (and speed) of the audio channel name.
1.0 is normal pitch/speed.
If the value becomes negative, the audio will be played in reverse.
- NewAudio.GetPitch( name) - Gets the pitch of the audio channel name.
- NewAudio.SetVolume( name, value) - Sets the volume of the audio channel name.
0.75 is the default value.
- NewAudio.GetVolume( name) - Gets the volume of the audio channel name.
- NewAudio.Play( name) - Plays the last sound played in the audio channel name.
- NewAudio.Stop( name) - Stops the audio in the channel name.
- NewAudio.Pause( name) - Pauses the audio in the channel name.
- NewAudio.Unpause( name) - Unpauses the audio in the channel name.
- NewAudio.SetPlayTime( name, value) - Sets the track position of the audio channel
name's audio, in seconds.
- NewAudio.isStopped( name) - Checks if the audio channel name is stopped (or paused).
- NewAudio.StopAll() - Stops all audio channels' audio.
- NewAudio.PauseAll() - Pauses all the audio channels' audio.
- NewAudio.UnpauseAll() - Unpauses all the audio channels' audio.