danger.audio
Class Sound

java.lang.Object
  extended by danger.audio.Sound
All Implemented Interfaces:
Playable, PlayableAudio, PlayableMedia


public abstract class Sound
extends Object


Field Summary
static int MAX_SAMPLE_RATE
          max sample rate = 48 kHz
static int MIN_LOOP_SIZE
          min number of loop samples that can be processed
static int MIN_SAMPLE_RATE
          min sample rate = 1 kHz
static int SAMPLE_RATE_11K
           
static int SAMPLE_RATE_22K
           
static int SAMPLE_RATE_44K
           
static int SAMPLE_RATE_8K
          common sample rates
 
Fields inherited from interface danger.media.PlayableMedia
DEFAULT_PRIORITY, PRIORITY_1, PRIORITY_2, PRIORITY_3, PRIORITY_4, PRIORITY_5
 
Constructor Summary
Sound()
           
 
Method Summary
 void destroy()
          free internal resources for this object
abstract  void fadeFromToInTime(int sourceVolume, int destVolume, int timeInMiliseconds)
          fade from source volume, to dest volume in time miliseconds.
 int framesToMicroseconds(int frames)
          Given sample frames, return microseconds.
 int getCurrentLoopNumber()
          Gets the number of times the looped media has looped back to the loop start.
abstract  byte[] getData()
          return audio data formatted as file.
abstract  int getLoopCount()
          Gets the loop count; which is the total number of times an object is played.
abstract  int getLoops()
          Deprecated. - use getLoopCount() instead.
 int getMarkerCount()
          Gets the number of markers contained by the currently loaded media.
 int getMarkerID(int index)
          Return the integer ID associated with the marker at the given index.
 String getMarkerName(int index)
          Return the name associated with the marker at the given index.
 int getMarkerPosition(int index)
          Return the position in milliseconds of the marker at the given index.
 int getMediaType()
          Returns file type of media.
 int getMicrosecondLength()
          Deprecated. - use getMillisecondLength() instead.
 int getMicrosecondPosition()
          Deprecated. - use getMillisecondPosition() instead.
 int getMillisecondLength()
          get length in milliseconds of object
abstract  int getMillisecondPosition()
          get the current playback position of a sound in milliseconds
abstract  int getPlaybackLength()
          get playback length in sample frames
abstract  int getPlaybackPosition()
          Get the position in sample frames
 int getPlaybackRate()
          Get the playback rate of the media. 100 is default rate.
abstract  int getPriority()
          Get sound priority level.
abstract  int getRate()
           
abstract  int getSampleEndLoopPoint()
           
abstract  int getSampleStartLoopPoint()
          Get the current loop points in sample frames
 int getStereoPosition()
          Returns current stereo position.
 int getTranspose()
          Return tuning in semitones.
 int getTuning()
          Return tuning in cents (1200 is down an octave, -1200 is up an octave) This interacts with PlayableAudio.setTranspose(int) and PlayableAudio.getTranspose()
 int getUniqueID()
          return runtime ID.
abstract  int getVolume()
          Returns current volume in percent.
 int getVolumeClass()
          Get the current volume class.
abstract  boolean isDone()
          Returns true if done playing
abstract  boolean isLoaded()
          is sound loaded
 boolean isLoopingEnabled()
          Return whether looping is enabled (set by a call to PlayableMedia.setLoopingEnabled(boolean)).
 boolean isMuted()
          Return true if the audio is muted
abstract  boolean isPaused()
          pause, resume and test sound object
 boolean isPlaying()
          Returns true if object is playing.
static Sound load(byte[] data)
          Given an array of bytes, try and load a Sound (Can be a WAV, AIF file) Will return null if data is invalid.
static Sound load(byte[] data, boolean autoDelete)
          Given an array of bytes, try and load a Sound (Can be a WAV, AIF file) Will return null if data is invalid.
static Sound load(File f)
          Given a sound file, try and load it (Can be WAV, AIF, MP3) Will return null if file data is invalid.
static Sound load(File f, boolean autoDelete)
          Given a sound file, try and load it (Can be WAV, AIF, MP3) Will return null if file data is invalid.
static Sound load(int resourceID)
          Given an reousrce ID, try and load a Sound (Can be a WAV, AIF file) Will return null if data is invalid.
static Sound load(int resourceID, boolean autoDelete)
          Given an reousrce ID, try and load a Sound (Can be a WAV, AIF file) Will return null if data is invalid.
abstract  boolean loadFromCustom16bit(short[] data, int channels, int rate, int loopStart, int loopEnd)
          load a sample from a raw pointer.
abstract  boolean loadFromCustom8bit(byte[] data, int channels, int rate, int loopStart, int loopEnd)
          load a sample from a raw pointer.
abstract  boolean loadFromFile(byte[] data)
          Pass in data formatted as a AIF, WAV file.
abstract  boolean loadFromFrequency(int frequency, int lengthInMS, int channels, int rate)
          load a sample by creating a sine wave using a particular frequency.
 boolean loadFromResource(int id)
          pass and ID, and read data from the application resource file.
 boolean loadFromResource(int id, Application app)
           
 int microsecondsToFrames(int micros)
          Given microseconds, return sample frames.
abstract  void pause()
          Will pause object
 void play()
          Given a sound, start it playing, and auto delete it when done playing.
static Sound play(byte[] data)
          Given an array of bytes load a sound file, start it playing, and auto delete it when done playing.
static Sound play(byte[] data, boolean autoDelete)
          Given an array of bytes load a sound file, start it playing, and auto delete it when done playing if requested.
static Sound play(File f)
          Given a sound file, start it playing, and auto delete it when done playing.
static Sound play(File f, boolean autoDelete)
          Given a sound file, start it playing, and auto delete it when done playing if requested.
static Sound play(int resourceID)
          method to load a sound file from a resource, start it playing, and auto delete it when done playing.
static Sound play(int resourceID, int filter)
          method to load a sound file from a resource, start it playing, and auto delete it when done playing.
abstract  void resume()
          Will resume object if paused.
abstract  void setBuzzFlash(boolean buzzOn, boolean flashOn)
          Set auto generate buzz/flash on or off
abstract  void setBuzzFlashEnable(boolean buzzOn, boolean flashOn)
          Set buzz/flash enable or off.
 void setDoneCallbackEvent(Event done)
          Set the event that is called when this media is finished.
 void setDoneCallbackEvent(Event done, boolean doEventOnce)
          Set the event that is called when this media is finished.
abstract  void setLoopCount(int loopCount)
          Sets the loop count; which is the total number of times an object is played.
 void setLoopingEnabled(boolean on)
          Enable looping.
abstract  void setLoops(int loops)
          Deprecated. - use setLoopCount(int) instead.
 void setMicrosecondPosition(int ticks)
          Deprecated. - use setMillisecondPosition(int) instead.
abstract  void setMillisecondPosition(int pos)
          set the current playback position of sound in milliseconds
 void setMute(boolean mute)
          Mute or unmute the audio.
abstract  void setPlaybackPosition(int sampleFrame)
          Set the position in sample frames
 void setPlaybackRate(int newRate)
          Set the playback rate of the media.
 void setPositionCallbackEvent(Event event, int position)
          Set an event that is called when this media reaches the given position during playback.
 void setPositionToMarker(int markerID)
          Set the media playback position to the position associated with the marker with the given markerID
abstract  void setPriority(int priority)
          Set sound priority level.
abstract  void setRate(int newRate)
          get/set the sample rate of an object
abstract  void setRouteBus(int routeBus)
           
abstract  boolean setSampleLoopPoints(int start, int end)
          set the loop points in sample frames.
 void setStereoPosition(int position)
          Set the stereo position of sound.
 void setStoppedCallbackEvent(Event stopped)
          Set the event that is called when this media is stopped by stop().
 void setStoppedCallbackEvent(Event stopped, boolean doEventOnce)
          Set the event that is called when this media is stopped by stop().
 void setTranspose(int semitones)
          Set tuning in semitones.
 void setTuning(int cents)
          Set tuning in cents (1200 is down an octave, -1200 is up an octave) This interacts with PlayableAudio.setTranspose(int) and PlayableAudio.getTranspose()
abstract  void setVolume(int volume)
          get/set playback volume of object.
 void setVolumeClass(int volumeClass)
          Set the volume class.
 boolean start()
          start sound playing, will return false if failed to start
 boolean start(int sampleFrameStart)
          start sound playing.
 boolean start(int sampleFrameStart, int filter)
          start a sound playing, but filter content types from ToneFilter.
 boolean startAtOffset(int startOffset)
           
 boolean startDefault()
          Start Sound with defaults Returns true if started NOTE: This is the same as start().
 void startPlaying()
          Start media playback with default attributes.
 void startPlaying(int attributes)
          Start media playback with specified attributes.
 boolean startWithFilter(int filter)
          Start Sound with a filter Returns true if started NOTE: This is implemented in Playable OS 2.3
 void stop()
          Will stop the object and reset to begining
 void stopPlaying()
          Stop media playback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_SAMPLE_RATE

public static final int MIN_SAMPLE_RATE
min sample rate = 1 kHz

See Also:
Constant Field Values

MAX_SAMPLE_RATE

public static final int MAX_SAMPLE_RATE
max sample rate = 48 kHz

See Also:
Constant Field Values

SAMPLE_RATE_8K

public static final int SAMPLE_RATE_8K
common sample rates

See Also:
Constant Field Values

SAMPLE_RATE_11K

public static final int SAMPLE_RATE_11K
See Also:
Constant Field Values

SAMPLE_RATE_22K

public static final int SAMPLE_RATE_22K
See Also:
Constant Field Values

SAMPLE_RATE_44K

public static final int SAMPLE_RATE_44K
See Also:
Constant Field Values

MIN_LOOP_SIZE

public static final int MIN_LOOP_SIZE
min number of loop samples that can be processed

See Also:
Constant Field Values
Constructor Detail

Sound

public Sound()
Method Detail

destroy

public void destroy()
free internal resources for this object

Specified by:
destroy in interface Playable
Specified by:
destroy in interface PlayableMedia

load

public static Sound load(byte[] data,
                         boolean autoDelete)
Given an array of bytes, try and load a Sound (Can be a WAV, AIF file) Will return null if data is invalid. This sound will auto delete once its been played if requested. If the media has loop points they will remain intact. Use Sound.setSampleLoopPoints(0, 0) to clear the loop points. OS 3.0


load

public static Sound load(byte[] data)
Given an array of bytes, try and load a Sound (Can be a WAV, AIF file) Will return null if data is invalid. This sound will auto delete once its been played. If the media has loop points they will remain intact. Use Sound.setSampleLoopPoints(0, 0) to clear the loop points.


play

public static Sound play(byte[] data,
                         boolean autoDelete)
Given an array of bytes load a sound file, start it playing, and auto delete it when done playing if requested. This Sound will be played with the filter ToneFilter.BUZZER | ToneFilter.FLASHER, which will create buzz and flash. If you don't want to do that, do a Sound.load() then Sound.start() without the filters. OS 3.0


play

public static Sound play(byte[] data)
Given an array of bytes load a sound file, start it playing, and auto delete it when done playing. This Sound will be played with the filter ToneFilter.BUZZER | ToneFilter.FLASHER, which will create buzz and flash. If you don't want to do that, do a Sound.load() then Sound.start() without the filters.


load

public static Sound load(int resourceID,
                         boolean autoDelete)
Given an reousrce ID, try and load a Sound (Can be a WAV, AIF file) Will return null if data is invalid. This sound will auto delete once its been played if requested. If the media has loop points they will remain intact. Use Sound.setSampleLoopPoints(0, 0) to clear the loop points. OS 3.0


load

public static Sound load(int resourceID)
Given an reousrce ID, try and load a Sound (Can be a WAV, AIF file) Will return null if data is invalid. This sound will auto delete once its been played. If the media has loop points they will remain intact. Use Sound.setSampleLoopPoints(0, 0) to clear the loop points.


play

public static Sound play(int resourceID)
method to load a sound file from a resource, start it playing, and auto delete it when done playing. This Sound will be played with the filter ToneFilter.BUZZER | ToneFilter.FLASHER, which will create buzz and flash. If you don't want to do that, do a Sound.load() then Sound.start() without the filters.


play

public static Sound play(int resourceID,
                         int filter)
method to load a sound file from a resource, start it playing, and auto delete it when done playing. You can also pass in a different ToneFilter.* for playback. ToneFilter.BUZZER - enables the buzzer ToneFilter.FLASHER - enables the flasher ToneFilter.NONE - disables all but playback


load

public static Sound load(File f,
                         boolean autoDelete)
Given a sound file, try and load it (Can be WAV, AIF, MP3) Will return null if file data is invalid. This sound will auto delete once its been played if requested. If the media has loop points they will remain intact. Use Sound.setSampleLoopPoints(0, 0) to clear the loop points. OS 3.0


load

public static Sound load(File f)
Given a sound file, try and load it (Can be WAV, AIF, MP3) Will return null if file data is invalid. This sound will auto delete once its been played. If the media has loop points they will remain intact. Use Sound.setSampleLoopPoints(0, 0) to clear the loop points.


play

public static Sound play(File f,
                         boolean autoDelete)
Given a sound file, start it playing, and auto delete it when done playing if requested. This Sound will be played with the filter ToneFilter.BUZZER | ToneFilter.FLASHER, which will create buzz and flash. If you don't want to do that, do a Sound.load() then Sound.start() without the filters. OS 3.0


play

public static Sound play(File f)
Given a sound file, start it playing, and auto delete it when done playing. This Sound will be played with the filter ToneFilter.BUZZER | ToneFilter.FLASHER, which will create buzz and flash. If you don't want to do that, do a Sound.load() then Sound.start() without the filters.


play

public void play()
Given a sound, start it playing, and auto delete it when done playing. This sound will be played with the filter ToneFilter.BUZZER | ToneFilter.FLASHER, which will create buzz and flash. If you don't want to do that, do a Sound.load() then Sound.start() without the filters.


getData

public abstract byte[] getData()
return audio data formatted as file. Not raw audio


loadFromFile

public abstract boolean loadFromFile(byte[] data)
Pass in data formatted as a AIF, WAV file. Will return false if failed to parse. The result of this method is the sound is completely uncompressed. Will not decode an AMR or MP3 file.


loadFromResource

public boolean loadFromResource(int id)
pass and ID, and read data from the application resource file. Parsed data is a WAV, AIF, or au data. Will return false if failed to parse.


loadFromResource

public boolean loadFromResource(int id,
                                Application app)

loadFromFrequency

public abstract boolean loadFromFrequency(int frequency,
                                          int lengthInMS,
                                          int channels,
                                          int rate)
load a sample by creating a sine wave using a particular frequency. Only creates 16 bit data.


loadFromCustom8bit

public abstract boolean loadFromCustom8bit(byte[] data,
                                           int channels,
                                           int rate,
                                           int loopStart,
                                           int loopEnd)
load a sample from a raw pointer. This will make a copy of the passed data, so you can dispose of your origial pointer once this has been called. Returns true for success Use this function for 8 bit signed data. Length is assumed from object data


loadFromCustom16bit

public abstract boolean loadFromCustom16bit(short[] data,
                                            int channels,
                                            int rate,
                                            int loopStart,
                                            int loopEnd)
load a sample from a raw pointer. This will make a copy of the passed data, so you can dispose of your origial pointer once this has been called. Returns true for success Use this function for 16 bit signed data. Length is assumed from object data


setSampleLoopPoints

public abstract boolean setSampleLoopPoints(int start,
                                            int end)
set the loop points in sample frames. Pass in start==end to remove the loop point.


getSampleStartLoopPoint

public abstract int getSampleStartLoopPoint()
Get the current loop points in sample frames


getSampleEndLoopPoint

public abstract int getSampleEndLoopPoint()

setRouteBus

public abstract void setRouteBus(int routeBus)

setVolume

public abstract void setVolume(int volume)
get/set playback volume of object. Normal is 100 (100%). You can overdrive.


getVolume

public abstract int getVolume()
Description copied from interface: Playable
Returns current volume in percent. The value 100 is 100% of normal.


setPriority

public abstract void setPriority(int priority)
Set sound priority level. Higher values will allow for better voice stealing.

Parameters:
priority - - priority level for media

getPriority

public abstract int getPriority()
Get sound priority level. Higher values will allow for better voice stealing.

Returns:
current priority level

getPlaybackLength

public abstract int getPlaybackLength()
get playback length in sample frames


getPlaybackPosition

public abstract int getPlaybackPosition()
Get the position in sample frames


setPlaybackPosition

public abstract void setPlaybackPosition(int sampleFrame)
Set the position in sample frames


setMillisecondPosition

public abstract void setMillisecondPosition(int pos)
set the current playback position of sound in milliseconds

Parameters:
pos - - position in media to seek to

getMillisecondPosition

public abstract int getMillisecondPosition()
get the current playback position of a sound in milliseconds


getMicrosecondLength

public int getMicrosecondLength()
Deprecated. - use getMillisecondLength() instead.

Description copied from interface: Playable
get ticks in microseconds of length of object


setMicrosecondPosition

public void setMicrosecondPosition(int ticks)
Deprecated. - use setMillisecondPosition(int) instead.

Description copied from interface: Playable
set the current playback position of object in microseconds. Must call after starting object.


getMicrosecondPosition

public int getMicrosecondPosition()
Deprecated. - use getMillisecondPosition() instead.

Description copied from interface: Playable
get the current playback position of a object in microseconds


microsecondsToFrames

public int microsecondsToFrames(int micros)
Given microseconds, return sample frames. This figures this using this Sound's sample rate


framesToMicroseconds

public int framesToMicroseconds(int frames)
Given sample frames, return microseconds. This figures this using this Sound's sample rate


getMillisecondLength

public int getMillisecondLength()
get length in milliseconds of object


isDone

public abstract boolean isDone()
Returns true if done playing


setLoops

public abstract void setLoops(int loops)
Deprecated. - use setLoopCount(int) instead.


getLoops

public abstract int getLoops()
Deprecated. - use getLoopCount() instead.


setLoopCount

public abstract void setLoopCount(int loopCount)
Sets the loop count; which is the total number of times an object is played.

Parameters:
loopCount - - total number of times to play; 0 means loop forever.

getLoopCount

public abstract int getLoopCount()
Gets the loop count; which is the total number of times an object is played.

Returns:
loopCount - total number of times to play; 0 means loop forever. OS 3.0

setRate

public abstract void setRate(int newRate)
get/set the sample rate of an object


getRate

public abstract int getRate()

startWithFilter

public boolean startWithFilter(int filter)
Start Sound with a filter Returns true if started NOTE: This is implemented in Playable OS 2.3


startDefault

public boolean startDefault()
Start Sound with defaults Returns true if started NOTE: This is the same as start(). This is implmented to support Playable OS 2.3


start

public boolean start()
start sound playing, will return false if failed to start


start

public boolean start(int sampleFrameStart)
start sound playing. Pass in a sample frame offset to start from other than the begining


start

public boolean start(int sampleFrameStart,
                     int filter)
start a sound playing, but filter content types from ToneFilter.


setBuzzFlashEnable

public abstract void setBuzzFlashEnable(boolean buzzOn,
                                        boolean flashOn)
Set buzz/flash enable or off. Will only buzz/flash if this is true


setBuzzFlash

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


fadeFromToInTime

public abstract void fadeFromToInTime(int sourceVolume,
                                      int destVolume,
                                      int timeInMiliseconds)
fade from source volume, to dest volume in time miliseconds. Always async


isLoaded

public abstract boolean isLoaded()
is sound loaded


isPaused

public abstract boolean isPaused()
pause, resume and test sound object


pause

public abstract void pause()
Description copied from interface: Playable
Will pause object


resume

public abstract void resume()
Description copied from interface: Playable
Will resume object if paused. Does nothing if already resumed


getUniqueID

public int getUniqueID()
Description copied from interface: Playable
return runtime ID. Unique every time object is started

Specified by:
getUniqueID in interface Playable
Specified by:
getUniqueID in interface PlayableMedia

getMediaType

public int getMediaType()
Description copied from interface: PlayableMedia
Returns file type of media.

Specified by:
getMediaType in interface PlayableMedia

setVolumeClass

public void setVolumeClass(int volumeClass)
Description copied from interface: PlayableAudio
Set the volume class. This determines how the media responds to changes in the system sound profile.

Specified by:
setVolumeClass in interface PlayableAudio

getVolumeClass

public int getVolumeClass()
Description copied from interface: PlayableAudio
Get the current volume class. This determines how the media responds to changes in the system sound profile.

Specified by:
getVolumeClass in interface PlayableAudio

setLoopingEnabled

public void setLoopingEnabled(boolean on)
Description copied from interface: PlayableMedia
Enable looping. This will use the loop counter mLoopCount, which is either set via a call to PlayableMedia.setLoopCount(int) or is 0 (loop forever) by default.

Specified by:
setLoopingEnabled in interface PlayableMedia
Parameters:
on - - enable or disable looping.

isLoopingEnabled

public boolean isLoopingEnabled()
Description copied from interface: PlayableMedia
Return whether looping is enabled (set by a call to PlayableMedia.setLoopingEnabled(boolean)).

Specified by:
isLoopingEnabled in interface PlayableMedia
Returns:
enabled - true or false.

getCurrentLoopNumber

public int getCurrentLoopNumber()
Description copied from interface: PlayableMedia
Gets the number of times the looped media has looped back to the loop start.

Specified by:
getCurrentLoopNumber in interface PlayableMedia

getMarkerCount

public int getMarkerCount()
Description copied from interface: PlayableMedia
Gets the number of markers contained by the currently loaded media. These can be video, MIDI, or audio markers.

Specified by:
getMarkerCount in interface PlayableMedia

getMarkerID

public int getMarkerID(int index)
Description copied from interface: PlayableMedia
Return the integer ID associated with the marker at the given index.

Specified by:
getMarkerID in interface PlayableMedia

getMarkerName

public String getMarkerName(int index)
Description copied from interface: PlayableMedia
Return the name associated with the marker at the given index. May return null.

Specified by:
getMarkerName in interface PlayableMedia

getMarkerPosition

public int getMarkerPosition(int index)
Description copied from interface: PlayableMedia
Return the position in milliseconds of the marker at the given index.

Specified by:
getMarkerPosition in interface PlayableMedia

setPositionToMarker

public void setPositionToMarker(int markerID)
Description copied from interface: PlayableMedia
Set the media playback position to the position associated with the marker with the given markerID

Specified by:
setPositionToMarker in interface PlayableMedia
Parameters:
markerID - - integer ID of the marker (retrieved via PlayableMedia.getMarkerID(int))

setStereoPosition

public void setStereoPosition(int position)
Description copied from interface: PlayableAudio
Set the stereo position of sound. The range is -100 (full left) to 100 (full right). Default is 0 (center)

Specified by:
setStereoPosition in interface PlayableAudio

getStereoPosition

public int getStereoPosition()
Description copied from interface: PlayableAudio
Returns current stereo position. The range is -100 (full left) to 100 (full right). Default is 0 (center)

Specified by:
getStereoPosition in interface PlayableAudio

setMute

public void setMute(boolean mute)
Description copied from interface: PlayableAudio
Mute or unmute the audio. This is independent of the volume.

Specified by:
setMute in interface PlayableAudio

isMuted

public boolean isMuted()
Description copied from interface: PlayableAudio
Return true if the audio is muted

Specified by:
isMuted in interface PlayableAudio

startPlaying

public void startPlaying()
Description copied from interface: PlayableMedia
Start media playback with default attributes.

Specified by:
startPlaying in interface PlayableMedia

startPlaying

public void startPlaying(int attributes)
Description copied from interface: PlayableMedia
Start media playback with specified attributes.

Specified by:
startPlaying in interface PlayableMedia
Parameters:
attributes - - class-specific attributes applied to this playback

isPlaying

public boolean isPlaying()
Description copied from interface: PlayableMedia
Returns true if object is playing.

Specified by:
isPlaying in interface PlayableMedia

stopPlaying

public void stopPlaying()
Description copied from interface: PlayableMedia
Stop media playback

Specified by:
stopPlaying in interface PlayableMedia

setPlaybackRate

public void setPlaybackRate(int newRate)
Description copied from interface: PlayableMedia
Set the playback rate of the media.

Specified by:
setPlaybackRate in interface PlayableMedia
Parameters:
newRate - - new playback rate; 100 is default rate.

getPlaybackRate

public int getPlaybackRate()
Description copied from interface: PlayableMedia
Get the playback rate of the media. 100 is default rate.

Specified by:
getPlaybackRate in interface PlayableMedia

setTranspose

public void setTranspose(int semitones)
Description copied from interface: PlayableAudio
Set tuning in semitones. This interacts with PlayableAudio.setTuning(int) and PlayableAudio.getTuning()

Specified by:
setTranspose in interface PlayableAudio

getTranspose

public int getTranspose()
Description copied from interface: PlayableAudio
Return tuning in semitones. If PlayableAudio.setTuning(int) has been called, This will truncate actual value to nearest 100 cents

Specified by:
getTranspose in interface PlayableAudio

setTuning

public void setTuning(int cents)
Description copied from interface: PlayableAudio
Set tuning in cents (1200 is down an octave, -1200 is up an octave) This interacts with PlayableAudio.setTranspose(int) and PlayableAudio.getTranspose()

Specified by:
setTuning in interface PlayableAudio

getTuning

public int getTuning()
Description copied from interface: PlayableAudio
Return tuning in cents (1200 is down an octave, -1200 is up an octave) This interacts with PlayableAudio.setTranspose(int) and PlayableAudio.getTranspose()

Specified by:
getTuning in interface PlayableAudio

setPositionCallbackEvent

public void setPositionCallbackEvent(Event event,
                                     int position)
Description copied from interface: PlayableMedia
Set an event that is called when this media reaches the given position during playback. Any number of these may be set. Set event to null to disable a given position's callback.

Specified by:
setPositionCallbackEvent in interface PlayableMedia
Parameters:
event - - event to be posted
position - - time in milliseconds at which the event should be posted

setDoneCallbackEvent

public void setDoneCallbackEvent(Event done)
Description copied from interface: PlayableMedia
Set the event that is called when this media is finished.

Specified by:
setDoneCallbackEvent in interface PlayableMedia
Parameters:
done - - event to be posted

setDoneCallbackEvent

public void setDoneCallbackEvent(Event done,
                                 boolean doEventOnce)
Description copied from interface: PlayableMedia
Set the event that is called when this media is finished.

Specified by:
setDoneCallbackEvent in interface PlayableMedia
Parameters:
done - - event to be posted
doEventOnce - - if true, callback only called once for a given playback

setStoppedCallbackEvent

public void setStoppedCallbackEvent(Event stopped)
Description copied from interface: PlayableMedia
Set the event that is called when this media is stopped by stop().

Specified by:
setStoppedCallbackEvent in interface PlayableMedia
Parameters:
stopped - - event to be posted

setStoppedCallbackEvent

public void setStoppedCallbackEvent(Event stopped,
                                    boolean doEventOnce)
Description copied from interface: PlayableMedia
Set the event that is called when this media is stopped by stop().

Specified by:
setStoppedCallbackEvent in interface PlayableMedia
Parameters:
stopped - - event to be posted
doEventOnce - - if true, callback only called once for a given playback

startAtOffset

public boolean startAtOffset(int startOffset)

stop

public void stop()
Description copied from interface: Playable
Will stop the object and reset to begining

Specified by:
stop in interface Playable