Sound

From ScapeFX Wiki

Jump to: navigation, search

Overview

ScapeFX features a powerful sound player which player scripts and client plugins can use to play sound FX and music. The sound player separates FX from music and allows you to play a musical tune in the background while playing sound FX files.


ScapeFX supports the following sound file formats:

  • .wav
  • .ogg
  • .mp3


SFXP (ScapeFX Protocol) includes tags to start and stop the sound player and the ScapeFXAPI_SoundManager class can be used from within scripts and plugins to access the sound player methods.

When playing music and the soundmanager is forced to start a new music file it will put the new file into a waiting state and slowly fade away the currently playing song before starting the new. All to make the sound transitions smooth and easy to the ear. When playing music you also have the options to loop the music until it is stopped.

Players can configure the client and set volume for both FX and music. It is also possible to turn off all sound or just turn off FX or music.

Examples

Example messages to send to play a sound through SFXP:

ESC#playMusic:sounds/to_arms.ogg:falseESC

ESC#playFX:somesound.wavESC


Example plugin that will receive some data over SFXP and play a sound file.

Message from server to plugin: ESC#plugin:MySoundPluginESCdeathESC#plugin>

public class MySoundPlugin extends ScapeFXPlugin{
    @Override
    public void receiveMessage(String message) {
       if (message.equals("death")){
          this.getSoundManager.playMusic("death.mp3", false);
       }
       // else play some other file?
    }
    @Override
    public String getPluginInfo() {
        return "A plugin that will play some sound.";
    }
    @Override
    public String getPluginName() {
        return "MySoundPlugin";
    }
}
Personal tools