Category:Audio Function: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 2: Line 2:


An audio source can be preloaded as a clip or stream using {{func|defineAudioSource}}. This loads the file into memory and initialize the corresponding media player. Additionally, the media's default volume, cycleCount, and other parameters can be defined, so that these values are used when using {{code|playClip(clipName)}} or {{code|playStream(streamName)}}
An audio source can be preloaded as a clip or stream using {{func|defineAudioSource}}. This loads the file into memory and initialize the corresponding media player. Additionally, the media's default volume, cycleCount, and other parameters can be defined, so that these values are used when using {{code|playClip(clipName)}} or {{code|playStream(streamName)}}
See the [[playStream]] page for information on using Dropbox or Google Drive links in either {{func|playClip}} or {{func|playStream}}.


== Clips and Streams ==
== Clips and Streams ==

Latest revision as of 17:37, 1 May 2021

Through macro functions, MapTool can play audio either stored locally or off the net. The play functions, playClip() and playStream(), play the sound on the client they are executed on. This means that to play them on other clients you must use execMacro() or execFunction().

An audio source can be preloaded as a clip or stream using defineAudioSource(). This loads the file into memory and initialize the corresponding media player. Additionally, the media's default volume, cycleCount, and other parameters can be defined, so that these values are used when using playClip(clipName) or playStream(streamName)

See the playStream page for information on using Dropbox or Google Drive links in either playClip() or playStream().

Clips and Streams

The first difference between clips and streams is that clips are decompressed before playing. This leads to much more responsive sounds, at the cost of significantly more memory being used. Additionally, clips are "fire and forget", and once playing, the volume and other settings cannot be modified. Clips are intended for short sounds, such as door creaking sound, footsteps, etc

A stream keeps the audio compressed, so the memory footprint is much lower. A stream can also start before the full file is downloaded, which helps for long songs stored on servers. Streams also have more flexible options, and can be edited while playing.

Supported Audio Files Audio: MP3; AIFF containing uncompressed PCM; WAV containing uncompressed PCM; MPEG-4 multimedia container with Advanced Audio Coding (AAC) audio

The distinction between streams and clips is taken directly from the JavaFX documentation. You can read more about it here:

JavaFX AudioClip
JavaFX MediaPlayer

Pages in category "Audio Function"

The following 6 pages are in this category, out of 6 total.