edu.uiuc.cs397rhc.sound
Interface Fadeable

All Known Implementing Classes:
InstrumentationFilter, MidiPlayer, MP3Player, SoundFilePlayer, VelocityFilter, VolumeFilter

public interface Fadeable

This interface specifies that the implementing class is capable of volume fades.

Author:
Pedro DeRose

Field Summary
static long DEFAULT_FADE_DURATION
          Default fade duration in milliseconds.
static int DEFAULT_SLEEP_INTERVAL
          Default interval in milliseconds between incremental volume changes during fades.
 
Method Summary
 void fade(double targetPercent)
          Fade from the current multiplier to the target multiplier, over the default duration and with the default interval between volume changes.
 void fade(double targetPercent, long duration)
          Fade from the current multiplier to the target mulitplier, over the given duration and with the default interval between volume changes.
 void fade(double targetPercent, long duration, int steps)
          Fade from the current multiplier to the target multiplier, over the given duration and in the given number of steps.
 double getFadeMultiplier()
          Returns the current fade multiplier.
 boolean isFading()
          Whether a fade is in progress
 void setFadeMultiplier(double multiplier)
          Sets the current fade multiplier, thereby also stopping any fading.
 void updateVolume()
          Update the volume to reflect the current fade multiplier.
 

Field Detail

DEFAULT_FADE_DURATION

static final long DEFAULT_FADE_DURATION
Default fade duration in milliseconds.

See Also:
Constant Field Values

DEFAULT_SLEEP_INTERVAL

static final int DEFAULT_SLEEP_INTERVAL
Default interval in milliseconds between incremental volume changes during fades.

See Also:
Constant Field Values
Method Detail

getFadeMultiplier

double getFadeMultiplier()
Returns the current fade multiplier.

Returns:
the current fade multiplier

setFadeMultiplier

void setFadeMultiplier(double multiplier)
Sets the current fade multiplier, thereby also stopping any fading.

Parameters:
multiplier - the new fade multiplier

isFading

boolean isFading()
Whether a fade is in progress

Returns:
true if a fade is in progress, false otherwise

fade

void fade(double targetPercent)
Fade from the current multiplier to the target multiplier, over the default duration and with the default interval between volume changes.

Parameters:
targetPercent - the target volume percentage after the fade

fade

void fade(double targetPercent,
          long duration)
Fade from the current multiplier to the target mulitplier, over the given duration and with the default interval between volume changes.

Parameters:
targetPercent - the target volume percentage after the fade
duration - the duration of the fade in milliseconds

fade

void fade(double targetPercent,
          long duration,
          int steps)
Fade from the current multiplier to the target multiplier, over the given duration and in the given number of steps.

Parameters:
targetPercent - the target volume percentage after the fade
duration - the duration of the fade in milliseconds
steps - the number of volume changes during the fade

updateVolume

void updateVolume()
Update the volume to reflect the current fade multiplier. This should generally not have to be called by a client class, and is used primarily by the FadeHelper to notify a volume change during a fade.