Category:Audio Function: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Created page with "Category:Macro Function")
 
(Added details about audio clips/streams etc.)
Line 1: Line 1:
Through macro functions, MapTool can play audio either stored locally or off the net.  The play functions, {{func|playClip}} and {{func|playStream}}, play the sound '''on the client they are executed on'''.  This means that to play them on other clients you must use {{func|execMacro}} or {{func|execFunction}}.
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)}}
== 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.
The distinction between streams and clips is directly taken from JavaFX. You can read more about it here:
[https://docs.oracle.com/javase/10/docs/api/javafx/scene/media/AudioClip.html JavaFX AudioClip]<br>
[https://docs.oracle.com/javase/10/docs/api/javafx/scene/media/MediaPlayer.html JavaFX MediaPlayer]
[[Category:Macro Function]]
[[Category:Macro Function]]

Revision as of 13:52, 29 February 2020

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)

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.

The distinction between streams and clips is directly taken from JavaFX. 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.