wyvern.lib
Interface Music

All Superinterfaces:
Alert
All Known Subinterfaces:
Sound
All Known Implementing Classes:
MovableSoundSource, Soundtrack

public interface Music
extends Alert

Represents a background music track to play on the client. Inherits from Alert because we have many of the same operations, even though they're logically very different kinds of audible events.

Version:
1.0, Jul 25, 2003
Author:
Steve Yegge

Field Summary
static java.lang.String DEFAULT_COMBAT_MUSIC
          The default music track to play for combat.
static java.lang.String DEFAULT_FUNERAL_MUSIC
          Default music track to play when a player dies.
static double DEFAULT_GAIN
          Default volume.
static java.lang.String DEFAULT_LEVELUP_MUSIC
          Default music track to play when a player dies.
static java.lang.String DEFAULT_LOW_HP_COMBAT_MUSIC
          Default music track to play if HP are very low.
static int DEFAULT_REPEAT_DELAY
          By default no delay between repeats of a track.
static int DEFAULT_REPEATS
          By default, background track loops indefinitely, if supported by the client.
static int LOOP_FOREVER
          Setting the number of repeats to this value makes it loop continuously.
static int PRIORITY_HIGH
          High-priority background music: quest solved, combat started, etc.
static int PRIORITY_NORMAL
          Normal-priority background music.
 
Method Summary
 int getRepeatDelay()
          Returns delay in millis between repeats
 int getRepeats()
          Returns number of times to repeat before stopping and sending a notification to the server that we're done.
 void setRepeatDelay(int repeatDelay)
          Sets delay in millis between repeats
 void setRepeats(int repeats)
          Sets number of times to repeat the music before stopping.
 
Methods inherited from interface wyvern.lib.Alert
getGain, getPath, setGain, setPath
 

Field Detail

PRIORITY_NORMAL

public static final int PRIORITY_NORMAL
Normal-priority background music.

See Also:
Constant Field Values

PRIORITY_HIGH

public static final int PRIORITY_HIGH
High-priority background music: quest solved, combat started, etc.

See Also:
Constant Field Values

DEFAULT_COMBAT_MUSIC

public static final java.lang.String DEFAULT_COMBAT_MUSIC
The default music track to play for combat.

See Also:
Constant Field Values

DEFAULT_LOW_HP_COMBAT_MUSIC

public static final java.lang.String DEFAULT_LOW_HP_COMBAT_MUSIC
Default music track to play if HP are very low.

See Also:
Constant Field Values

DEFAULT_FUNERAL_MUSIC

public static final java.lang.String DEFAULT_FUNERAL_MUSIC
Default music track to play when a player dies.

See Also:
Constant Field Values

DEFAULT_LEVELUP_MUSIC

public static final java.lang.String DEFAULT_LEVELUP_MUSIC
Default music track to play when a player dies.

See Also:
Constant Field Values

LOOP_FOREVER

public static final int LOOP_FOREVER
Setting the number of repeats to this value makes it loop continuously.

See Also:
Constant Field Values

DEFAULT_REPEATS

public static final int DEFAULT_REPEATS
By default, background track loops indefinitely, if supported by the client.

See Also:
Constant Field Values

DEFAULT_REPEAT_DELAY

public static final int DEFAULT_REPEAT_DELAY
By default no delay between repeats of a track. If you set a delay, remember that it's in millis, so 5 seconds is 5000.

See Also:
Constant Field Values

DEFAULT_GAIN

public static final double DEFAULT_GAIN
Default volume. A gain of 0.5 means "play at the volume the user has specified on their computer". 0.0 is silent, and 1.0 is max volume.

See Also:
Constant Field Values
Method Detail

getRepeats

public int getRepeats()
Returns number of times to repeat before stopping and sending a notification to the server that we're done. (Any repeats are counted as part of the track, so the client doesn't notify the server until all the repeats have finished playing.)

Returns:
number of times to repeat. 0 means don't repeat - just play one time and stop. For a repeat value of 1, the music will play a total of 2 times. A value of -1 means "repeat forever": the client will loop the music until it's stopped or changed.

setRepeats

public void setRepeats(int repeats)
Sets number of times to repeat the music before stopping.

Parameters:
repeats - number of times to repeat. A value of zero (0) means to play the piece once and stop, with no repeats. A value of -1 means to loop continuously.

getRepeatDelay

public int getRepeatDelay()
Returns delay in millis between repeats

Returns:
delay in millis between repeats

setRepeatDelay

public void setRepeatDelay(int repeatDelay)
Sets delay in millis between repeats

Parameters:
repeatDelay - delay in millis between repeats