danger.audio
Interface PlayableAudio

All Superinterfaces:
PlayableMedia
All Known Implementing Classes:
BufferedStream, Sequence, Sound, Stream, Tone, Video


public interface PlayableAudio
extends PlayableMedia

The PlayableAudio interface provides methods which are common to all audio objects, including volume, transposition, stereo position, buzz/flash effects, and routing.


Field Summary
 
Fields inherited from interface danger.media.PlayableMedia
DEFAULT_PRIORITY, PRIORITY_1, PRIORITY_2, PRIORITY_3, PRIORITY_4, PRIORITY_5
 
Method Summary
 void fadeFromToInTime(int sourceVolume, int destVolume, int timeInMilliseconds)
          Fade from source volume, to dest volume in time milliseconds.
 int getStereoPosition()
          Returns current stereo position.
 int getTranspose()
          Get tuning in semitones.
 int getTuning()
          Get tuning in cents.
 int getVolume()
          Get the current volume.
 int getVolumeClass()
          Get the current volume class.
 boolean isMuted()
          Get mute status.
 void setBuzzFlash(boolean buzzOn, boolean flashOn)
          Set auto generate buzz/flash on or off.
 void setBuzzFlashEnable(boolean buzzOn, boolean flashOn)
          Set buzz/flash enable on or off.
 void setMute(boolean mute)
          Mute or unmute the audio.
 void setStereoPosition(int position)
          Set the stereo position of sound.
 void setTranspose(int semitones)
          Set tuning in semitones.
 void setTuning(int cents)
          Set tuning in cents.
 void setVolume(int volume)
          Set the current volume.
 void setVolumeClass(int volumeClass)
          Set the volume class.
 boolean startWithFilter(int filter)
          Start object with a filter.
 
Methods inherited from interface danger.media.PlayableMedia
destroy, getCurrentLoopNumber, getLoopCount, getMarkerCount, getMarkerID, getMarkerName, getMarkerPosition, getMediaType, getMillisecondLength, getMillisecondPosition, getPlaybackRate, getPriority, getUniqueID, isDone, isLoaded, isLoopingEnabled, isPaused, isPlaying, pause, resume, setDoneCallbackEvent, setDoneCallbackEvent, setLoopCount, setLoopingEnabled, setMillisecondPosition, setPlaybackRate, setPositionCallbackEvent, setPositionToMarker, setPriority, setStoppedCallbackEvent, setStoppedCallbackEvent, startPlaying, startPlaying, stopPlaying
 

Method Detail

setVolumeClass

void setVolumeClass(int volumeClass)
Set the volume class. This determines how the media responds to changes in the system sound profile.

Parameters:
volumeClass - one of VolumeSelector

getVolumeClass

int getVolumeClass()
Get the current volume class. This determines how the media responds to changes in the system sound profile.

Returns:
one of VolumeSelector

setVolume

void setVolume(int volume)
Set the current volume.

Parameters:
volume - 100 is 100% of normal, 200 is double volume, 50 is half volume, etc.

getVolume

int getVolume()
Get the current volume.

Returns:
int 100 is 100% of normal, 200 is double volume, 50 is half, etc.

setStereoPosition

void setStereoPosition(int position)
Set the stereo position of sound.

Parameters:
position - range is -100 (full left) to 100 (full right). Default is 0 (center)

getStereoPosition

int getStereoPosition()
Returns current stereo position.

Returns:
int range is -100 (full left) to 100 (full right). Default is 0 (center)

setTranspose

void setTranspose(int semitones)
Set tuning in semitones. This interacts with setTuning(int) and getTuning(). A semitone, or half-step is a musical interval. A full octave is 12 semitones.

Parameters:
semitones - range -12 to 12

getTranspose

int getTranspose()
Get tuning in semitones. If setTuning(int) has been called, This will truncate actual value to nearest 100 cents.

Returns:
int semitones

setTuning

void setTuning(int cents)
Set tuning in cents. This interacts with setTranspose(int) and getTranspose().

Parameters:
cents - 1200 is down an octave, -1200 is up an octave

getTuning

int getTuning()
Get tuning in cents. This interacts with setTranspose(int) and getTranspose()

Returns:
int 1200 is down an octave, -1200 is up an octave

setBuzzFlashEnable

void setBuzzFlashEnable(boolean buzzOn,
                        boolean flashOn)
Set buzz/flash enable on or off.

Parameters:
buzzOn - if true, media will use vibration
flashOn - if true, media will use LED

setBuzzFlash

void setBuzzFlash(boolean buzzOn,
                  boolean flashOn)
Set auto generate buzz/flash on or off.

Parameters:
buzzOn - if true, media will generate vibration
flashOn - if true, media will generate LED

startWithFilter

boolean startWithFilter(int filter)
Start object with a filter.

If you pass in ToneFilter.BUZZER or ToneFilter.FLASHER, then the flash and buzz will be synthetically generated.

Parameters:
filter - one or more of ToneFilter
Returns:
true if started otherwise false.

setMute

void setMute(boolean mute)
Mute or unmute the audio. This is independent of the volume.

Parameters:
mute - true will mute, false will unmute

isMuted

boolean isMuted()
Get mute status.

Returns:
boolean true if muted, false if not

fadeFromToInTime

void fadeFromToInTime(int sourceVolume,
                      int destVolume,
                      int timeInMilliseconds)
Fade from source volume, to dest volume in time milliseconds. Asynchronous.

Parameters:
sourceVolume - range 0 to 100
destVolume - range 0 to 100
timeInMilliseconds - how long the fade takes