danger.audio
Class Sequence

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


public abstract class Sequence
extends Object

sequences, midi, xmf, rmf, sms.


Field Summary
static byte BANK
           
static byte CONTROL_CHANGE
           
static byte DATA_LSB
           
static byte DATA_MSB
           
static byte DEFAULT_BANK
           
static byte DEFAULT_PROGRAM
           
static byte EXPRESSION
           
static byte LED_BRIGHTNESS
           
static byte LED_HUE
           
static byte LED_PURITY
           
static byte MAX_BANKS
           
static int MAX_INSTRUMENTS
           
static byte MAX_MIDI_CHANNELS
          MAX/MIN
static byte MAX_MIDI_TRACKS
           
static byte MAX_MIDI_VOLUME
           
static byte MODULATION
           
static byte NOTE_OFF
           
static byte NOTE_ON
          MIDI commands to send to ParseMidiData
static byte NPRN_BUZZER_LSB
          Danger specific NRPN's
static byte NPRN_BUZZER_MSB
           
static byte NPRN_FLASHER_LSB
           
static byte NPRN_FLASHER_MSB
           
static byte NRPN_LSB
          Controller values
static byte NRPN_MSB
           
static byte PERCUSSION_CHANNEL
           
static byte PITCH_BEND
           
static byte PROGRAM_CHANGE
           
static byte RPN_LSB
           
static byte RPN_MSB
           
static byte SUSTAIN
           
static byte VIBRATE
          Danger specific controls
static byte VIBRATE_70MS
           
static byte VOLUME
           
 
Fields inherited from interface danger.media.PlayableMedia
DEFAULT_PRIORITY, PRIORITY_1, PRIORITY_2, PRIORITY_3, PRIORITY_4, PRIORITY_5
 
Constructor Summary
Sequence()
           
 
Method Summary
 void allNotesOff()
          kill all voices
abstract  void allNotesOff(int time)
          kill voices with release
abstract  void allowChannelTranspose(byte channel, boolean allowPitch)
          If allowPitch is false, then "SetTranspose" will have no effect on passed channel (0 to 15)
abstract  boolean areMidiEventsPending()
          returns true if there are midi events pending
 void controlChange(byte channel, byte controlNumber, byte controlValue)
           
abstract  void controlChange(byte channel, byte controlNumber, byte controlValue, int time)
           
 void destroy()
          will free memory associated with this object
abstract  boolean doesChannelAllowTranspose(byte channel)
          Return if the passed channel will allow pitch offset
abstract  void fadeFromToInTime(int sourceVolume, int destVolume, int timeInMiliseconds)
          fade from source volume, to dest volume in time miliseconds.
abstract  byte getBank(byte channel)
          Get the current Midi bank number (LSB for GM2 bank number)
abstract  void getChannelMuteStatus(boolean[] pChannels)
          Get all channels mute status at once.
abstract  void getChannelSoloStatus(boolean[] pChannels)
          Get all channels mute status at once.
abstract  byte getControlValue(byte channel, byte controller)
          Get the current Midi controler value.
 int getCurrentLoopNumber()
          Gets the number of times the looped media has looped back to the loop start.
abstract  byte[] getData()
          return Midi/SMS sequence data once loaded
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.
abstract  int getMasterTempo()
          get song master tempo
 int getMediaType()
          Returns file type of media.
 int getMicrosecondLength()
          Deprecated. - use getMillisecondLength() instead.
 int getMicrosecondPosition()
          Deprecated. - use getMillisecondPosition() instead.
abstract  int getMillisecondLength()
          get length in milliseconds of length of song
abstract  int getMillisecondPosition()
          get the current playback position of a song in milliseconds
abstract  byte getPitchBendLSB(byte channel)
           
abstract  byte getPitchBendMSB(byte channel)
           
 int getPlaybackRate()
          Get the playback rate of the media. 100 is default rate.
 int getPlaybackRate(int rate)
          Get the playback rate
abstract  int getPriority()
          Get synth priority level.
abstract  byte getProgram(byte channel)
          Get the current Midi program
abstract  void getSoloTrackStatus(boolean[] pTracks)
          Get all track mute status at once.
 int getStereoPosition()
          Returns current stereo position.
abstract  String getTitle()
          return title, if available of Sequence
abstract  void getTrackMuteStatus(boolean[] pTracks)
          Get all track mute status at once.
 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()
abstract  int getType()
          return type of sequence.
 int getUniqueID()
          return runtime ID.
abstract  int getVolume()
          Returns current volume in percent.
 int getVolumeClass()
          Get the current volume class.
abstract  boolean isDone()
          poll to see if song is done
abstract  boolean isInstrumentLoaded(byte patch, byte bankLSB, byte bankMSB)
          Determine if a GM2 instrument is loaded via patch number and bank LSB/MSB OS 3.0
abstract  boolean isInstrumentLoaded(int instrument)
          Deprecated. - use version which takes patch plus bank lsb and msb
abstract  boolean isLoaded()
          is song 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()
          Returns true if paused
 boolean isPlaying()
          Returns true if object is playing.
static Sequence load(byte[] data)
          Given an array of bytes, try and load a Sequence (Can be a Midi, RMF, or XMF file) Will return null if data is invalid.
static Sequence load(byte[] data, boolean autoDelete)
          Given an array of bytes, try and load a Sequence (Can be a Midi, RMF, or XMF file) Will return null if data is invalid.
static Sequence load(File f)
          Given a sequence file, try and load it (Can be a Midi, RMF, or XMF file) Will return null if file data is invalid.
static Sequence load(File f, boolean autoDelete)
          Given a sequence file, try and load it (Can be a Midi, RMF, or XMF file) Will return null if file data is invalid.
abstract  boolean loadFromData(byte[] data)
          load data and return true if ok
 boolean loadFromFile(byte[] data)
          Given a block of data, figure out if it is a sequence file format, and load it if so.
 boolean loadFromMidi(byte[] data)
          Deprecated. - use loadFromFile(byte[]) instead
 boolean loadFromMIDPToneSeq(byte[] data)
           
 boolean loadFromResource(int id)
          Pass an ID, and read data from the application resource file or the system resource file.
 boolean loadFromResource(int id, Application app)
           
 boolean loadFromRingtone(byte[] data)
          Deprecated. - use loadFromFile(byte[]) instead
 boolean loadFromRingtone(String ringtone)
          Load a Nokia SMS formatted String that is encoded as ascii hex into a Sequence.
 boolean loadFromRmf(byte[] data)
          Deprecated. - use loadFromFile(byte[]) instead
abstract  boolean loadInstrument(byte patch, byte bankLSB, byte bankMSB)
          Load a GM2 instrument via patch number and bank LSB/MSB OS 3.0
abstract  boolean loadInstrument(int instrument)
          Deprecated. - use version which takes patch plus bank lsb and msb
abstract  void muteChannel(byte channel)
          Mute and unmute channels (0 to 15)
abstract  void muteTrack(byte track)
          Mute and unmute tracks (0 to 64)
 void noteOff(byte channel, byte note, byte velocity)
           
abstract  void noteOff(byte channel, byte note, byte velocity, int time)
          If you pass AudioManager.NOW for time the current time will be passed The channel variable is 0 to 15.
 void noteOn(byte channel, byte note, byte velocity)
           
abstract  void noteOn(byte channel, byte note, byte velocity, int time)
           
 void noteOnWithLoad(byte channel, byte note, byte velocity)
           
abstract  void noteOnWithLoad(byte channel, byte note, byte velocity, int time)
          note on that checks to see if an instrument needs to be loaded.
 void NRPN(byte channel, byte lsb, byte msb, byte value)
          Non registered parameters
 void NRPN(byte channel, byte lsb, byte msb, byte value, int time)
          Non registered parameters
 void parseMidiData(byte commandByte, byte data1Byte, byte data2Byte, byte data3Byte)
           
abstract  void parseMidiData(byte commandByte, byte data1Byte, byte data2Byte, byte data3Byte, int time)
          given a midi stream, parse it out to the various midi functions for example: 0x92 0x50 0x7F 0x00 comandByte data1Byte data2Byte data3Byte Note 80 on with a velocity of 127 on channel 2
abstract  void pause()
          pause, resume, test playback of song playback
 void pitchBend(byte channel, byte lsb, byte msb)
           
abstract  void pitchBend(byte channel, byte lsb, byte msb, int time)
           
 void play()
          Given a sequence file, start it playing, and auto delete it when done playing.
static Sequence play(byte[] data)
          Given an array of bytes load a sequence file, start it playing, and auto delete it when done playing.
static Sequence play(byte[] data, boolean autoDelete)
          Given an array of bytes load a sequence file, start it playing, and auto delete it when done playing if autoDelete is true.
static Sequence play(File f)
          Given a sequence file, start it playing, and auto delete it when done playing.
static Sequence play(File f, boolean autoDelete)
          Given a sequence file, start it playing, and auto delete it when done playing if requested.
static Sequence play(int resourceID)
          Method to load a sequence file from a resource, start it playing, and auto delete it when done playing.
static Sequence play(int resourceID, boolean autoDelete)
          Method to load a sequence file from a resource, start it playing, and auto delete it when done playing if requested.
 void programBankChange(byte channel, byte programNumber, byte bankNumber)
          Deprecated. - use version which takes program plus bank lsb and msb.
abstract  void programBankChange(byte channel, byte programNumber, byte bankLSB, byte bankMSB, int time)
          Select GM2 MIDI program for the specified channel using program number and bank LSB/MSB OS 3.0
abstract  void programBankChange(byte channel, byte programNumber, byte bankNumber, int time)
          Deprecated. - use version which takes program plus bank lsb and msb.
 void programChange(byte channel, byte programNumber)
           
abstract  void programChange(byte channel, byte programNumber, int time)
          Select MIDI program for the specified channel using program number.
abstract  void resume()
          Will resume object if paused.
 void RPN(byte channel, byte lsb, byte msb, byte value)
          GM Registered parameters
 void RPN(byte channel, byte lsb, byte msb, byte value, int time)
          GM Registered parameters
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.
abstract  void setMasterTempo(int tempoFactor)
          Set song master tempo.
 void setMicrosecondPosition(int ticks)
          Deprecated. - use setMillisecondPosition(int) instead.
abstract  void setMillisecondPosition(int pos)
          set the current playback position of song in milliseconds
 void setMute(boolean mute)
          Mute or unmute the audio.
 void setPlaybackRate(int rate)
          Set the playback rate
 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 synth priority level.
abstract  void setRouteBus(int routeBus)
           
 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)
          set song volume.
 void setVolumeClass(int volumeClass)
          Set the volume class.
abstract  void soloChannel(byte channel)
           
abstract  void soloTrack(byte track)
           
 void start()
          Start sequence
 void start(int filter)
          Start a sequence, but filter content types from ToneFilter.* If you pass in ToneFilter.BUZZER or ToneFilter.FLASHER and there are no specific controller events in the midi file, then the flash and buzz will be synthetically generated by looking at the percussion track first, then the first channel of data.
 void start(int filter, int volume)
          Start a sequence, but filter content types from ToneFilter.* and set a volume level prior to starting
 boolean startAtOffset(int startOffset)
           
 boolean startDefault()
          Start Sequence with defaults Returns true if started NOTE: This is implemented in Playable OS 2.3
 void startPlaying()
          Start media playback with default attributes.
 void startPlaying(int attributes)
          Start media playback with specified attributes.
 boolean startWithFilter(int filter)
          Start Sequence 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
abstract  int translateBankProgramToInstrument(byte bank, byte program, byte channel, byte note)
          Deprecated. - only used with old instrument number methods.
abstract  boolean unloadInstrument(byte patch, byte bankLSB, byte bankMSB)
          Unload a GM2 instrument via patch number and bank LSB/MSB OS 3.0
abstract  boolean unloadInstrument(int instrument)
          Deprecated. - use version which takes patch plus bank lsb and msb
abstract  void unmuteChannel(byte channel)
           
abstract  void unmuteTrack(byte track)
           
abstract  void unSoloChannel(byte channel)
           
abstract  void unSoloTrack(byte track)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOTE_ON

public static final byte NOTE_ON
MIDI commands to send to ParseMidiData

See Also:
Constant Field Values

NOTE_OFF

public static final byte NOTE_OFF
See Also:
Constant Field Values

CONTROL_CHANGE

public static final byte CONTROL_CHANGE
See Also:
Constant Field Values

PROGRAM_CHANGE

public static final byte PROGRAM_CHANGE
See Also:
Constant Field Values

PITCH_BEND

public static final byte PITCH_BEND
See Also:
Constant Field Values

NRPN_LSB

public static final byte NRPN_LSB
Controller values

See Also:
Constant Field Values

NRPN_MSB

public static final byte NRPN_MSB
See Also:
Constant Field Values

RPN_LSB

public static final byte RPN_LSB
See Also:
Constant Field Values

RPN_MSB

public static final byte RPN_MSB
See Also:
Constant Field Values

DATA_LSB

public static final byte DATA_LSB
See Also:
Constant Field Values

DATA_MSB

public static final byte DATA_MSB
See Also:
Constant Field Values

VOLUME

public static final byte VOLUME
See Also:
Constant Field Values

BANK

public static final byte BANK
See Also:
Constant Field Values

MODULATION

public static final byte MODULATION
See Also:
Constant Field Values

EXPRESSION

public static final byte EXPRESSION
See Also:
Constant Field Values

SUSTAIN

public static final byte SUSTAIN
See Also:
Constant Field Values

VIBRATE

public static final byte VIBRATE
Danger specific controls

See Also:
Constant Field Values

LED_HUE

public static final byte LED_HUE
See Also:
Constant Field Values

LED_PURITY

public static final byte LED_PURITY
See Also:
Constant Field Values

LED_BRIGHTNESS

public static final byte LED_BRIGHTNESS
See Also:
Constant Field Values

VIBRATE_70MS

public static final byte VIBRATE_70MS
See Also:
Constant Field Values

NPRN_BUZZER_LSB

public static final byte NPRN_BUZZER_LSB
Danger specific NRPN's

See Also:
Constant Field Values

NPRN_BUZZER_MSB

public static final byte NPRN_BUZZER_MSB
See Also:
Constant Field Values

NPRN_FLASHER_LSB

public static final byte NPRN_FLASHER_LSB
See Also:
Constant Field Values

NPRN_FLASHER_MSB

public static final byte NPRN_FLASHER_MSB
See Also:
Constant Field Values

MAX_MIDI_CHANNELS

public static final byte MAX_MIDI_CHANNELS
MAX/MIN

See Also:
Constant Field Values

MAX_MIDI_VOLUME

public static final byte MAX_MIDI_VOLUME
See Also:
Constant Field Values

MAX_MIDI_TRACKS

public static final byte MAX_MIDI_TRACKS
See Also:
Constant Field Values

MAX_INSTRUMENTS

public static final int MAX_INSTRUMENTS
See Also:
Constant Field Values

MAX_BANKS

public static final byte MAX_BANKS
See Also:
Constant Field Values

DEFAULT_PROGRAM

public static final byte DEFAULT_PROGRAM
See Also:
Constant Field Values

DEFAULT_BANK

public static final byte DEFAULT_BANK
See Also:
Constant Field Values

PERCUSSION_CHANNEL

public static final byte PERCUSSION_CHANNEL
See Also:
Constant Field Values
Constructor Detail

Sequence

public Sequence()
Method Detail

load

public static Sequence load(byte[] data,
                            boolean autoDelete)
Given an array of bytes, try and load a Sequence (Can be a Midi, RMF, or XMF file) Will return null if data is invalid. This sequence will auto delete once its been played if autoDelete is true. If the media has loop points they will remain intact. Use Sequence.setLoops(0) to clear the loop points. OS 3.0


load

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


play

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


play

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


play

public static Sequence play(int resourceID,
                            boolean autoDelete)
Method to load a sequence file from a resource, start it playing, and auto delete it when done playing if requested. This Sequence will be played with the filter ToneFilter.BUZZER | ToneFilter.FLASHER, which will create buzz and flash, if its not in the content already. If you don't want to do that, do a Sequence.load() then Sequence.start() without the filters. OS 3.0


play

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


load

public static Sequence load(File f,
                            boolean autoDelete)
Given a sequence file, try and load it (Can be a Midi, RMF, or XMF file) Will return null if file data is invalid. This sequence will auto delete once its been played if requested. If the media has loop points they will remain intact. Use Sequence.setLoops(0) to clear the loop points. OS 3.0


load

public static Sequence load(File f)
Given a sequence file, try and load it (Can be a Midi, RMF, or XMF file) Will return null if file data is invalid. This sequence will auto delete once its been played. If the media has loop points they will remain intact. Use Sequence.setLoops(0) to clear the loop points.


play

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


play

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


play

public void play()
Given a sequence file, start it playing, and auto delete it when done playing. This sequence 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 Sequence.load() then Sequence.start() without the filters.


getTitle

public abstract String getTitle()
return title, if available of Sequence


getData

public abstract byte[] getData()
return Midi/SMS sequence data once loaded


getType

public abstract int getType()
return type of sequence. Format.Type.UNKNOWN Format.Type.MIDI Format.Type.RMF Format.Type.NRT


loadFromData

public abstract boolean loadFromData(byte[] data)
load data and return true if ok


loadFromRingtone

public boolean loadFromRingtone(String ringtone)
Load a Nokia SMS formatted String that is encoded as ascii hex into a Sequence. This format comes from an SMS message right after the 1581h port identifier. It looks like: "024A3A5D19B1B9D1CDD1B804005124650490418A24849B6194124106194 1761661661761961241441621021941241062892126D86504904186505D 85985985D865849051048800" NOTE: This is a String as hex values. If you have binary, you must convert to hex strings prior to calling this function.


loadFromMIDPToneSeq

public boolean loadFromMIDPToneSeq(byte[] data)

loadFromMidi

public boolean loadFromMidi(byte[] data)
Deprecated. - use loadFromFile(byte[]) instead


loadFromRingtone

public boolean loadFromRingtone(byte[] data)
Deprecated. - use loadFromFile(byte[]) instead


loadFromRmf

public boolean loadFromRmf(byte[] data)
Deprecated. - use loadFromFile(byte[]) instead


loadFromFile

public boolean loadFromFile(byte[] data)
Given a block of data, figure out if it is a sequence file format, and load it if so.


loadFromResource

public boolean loadFromResource(int id)
Pass an ID, and read data from the application resource file or the system resource file. Will parse a RMF or Midi file. Will return false if failed to parse.


loadFromResource

public boolean loadFromResource(int id,
                                Application app)

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


start

public void start()
Start sequence


startWithFilter

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


startDefault

public boolean startDefault()
Start Sequence with defaults Returns true if started NOTE: This is implemented in Playable OS 2.3


start

public void start(int filter,
                  int volume)
Start a sequence, but filter content types from ToneFilter.* and set a volume level prior to starting


start

public void start(int filter)
Start a sequence, but filter content types from ToneFilter.* If you pass in ToneFilter.BUZZER or ToneFilter.FLASHER and there are no specific controller events in the midi file, then the flash and buzz will be synthetically generated by looking at the percussion track first, then the first channel of data.

See Also:
VIBRATE, VIBRATE_70MS, LED_HUE, LED_PURITY, LED_BRIGHTNESS, ToneFilter.BUZZER, ToneFilter.FLASHER

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 song loaded?


isDone

public abstract boolean isDone()
poll to see if song is done


areMidiEventsPending

public abstract boolean areMidiEventsPending()
returns true if there are midi events pending


setMasterTempo

public abstract void setMasterTempo(int tempoFactor)
Set song master tempo. The value 100 uses song's encoded tempo, 200 will play song twice as fast, and 50 will play song half as fast.


getMasterTempo

public abstract int getMasterTempo()
get song master tempo


setPlaybackRate

public void setPlaybackRate(int rate)
Set the playback rate

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

getPlaybackRate

public int getPlaybackRate(int rate)
Get the playback rate


muteTrack

public abstract void muteTrack(byte track)
Mute and unmute tracks (0 to 64)


unmuteTrack

public abstract void unmuteTrack(byte track)

getTrackMuteStatus

public abstract void getTrackMuteStatus(boolean[] pTracks)
Get all track mute status at once. Must pass in an array of 65 boolean's


soloTrack

public abstract void soloTrack(byte track)

unSoloTrack

public abstract void unSoloTrack(byte track)

getSoloTrackStatus

public abstract void getSoloTrackStatus(boolean[] pTracks)
Get all track mute status at once. Must pass in an array of 65 boolean's


getMillisecondLength

public abstract int getMillisecondLength()
get length in milliseconds of length of song


setMillisecondPosition

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

Parameters:
pos - - position in media to seek to

getMillisecondPosition

public abstract int getMillisecondPosition()
get the current playback position of a song 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


pause

public abstract void pause()
pause, resume, test playback of song playback


resume

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


isPaused

public abstract boolean isPaused()
Description copied from interface: Playable
Returns true if paused


setRouteBus

public abstract void setRouteBus(int routeBus)

setVolume

public abstract void setVolume(int volume)
set song volume. You can overdrive by passing values larger than 100. The value 100 is 100%, 50 is 50%, and so on.


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 synth priority level. Higher values will allow for better voice stealing.

Parameters:
priority - - priority level for media

getPriority

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

Returns:
current priority level

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

allowChannelTranspose

public abstract void allowChannelTranspose(byte channel,
                                           boolean allowPitch)
If allowPitch is false, then "SetTranspose" will have no effect on passed channel (0 to 15)


doesChannelAllowTranspose

public abstract boolean doesChannelAllowTranspose(byte channel)
Return if the passed channel will allow pitch offset


muteChannel

public abstract void muteChannel(byte channel)
Mute and unmute channels (0 to 15)


unmuteChannel

public abstract void unmuteChannel(byte channel)

getChannelMuteStatus

public abstract void getChannelMuteStatus(boolean[] pChannels)
Get all channels mute status at once. Must pass in an array of 16 boolean's


soloChannel

public abstract void soloChannel(byte channel)

unSoloChannel

public abstract void unSoloChannel(byte channel)

getChannelSoloStatus

public abstract void getChannelSoloStatus(boolean[] pChannels)
Get all channels mute status at once. Must pass in an array of 16 boolean's


loadInstrument

public abstract boolean loadInstrument(int instrument)
Deprecated. - use version which takes patch plus bank lsb and msb

Load an instrument via instrument number.


unloadInstrument

public abstract boolean unloadInstrument(int instrument)
Deprecated. - use version which takes patch plus bank lsb and msb

Unload an instrument via instrument number.


isInstrumentLoaded

public abstract boolean isInstrumentLoaded(int instrument)
Deprecated. - use version which takes patch plus bank lsb and msb

Determine if an instrument is loaded via instrument number.


loadInstrument

public abstract boolean loadInstrument(byte patch,
                                       byte bankLSB,
                                       byte bankMSB)
Load a GM2 instrument via patch number and bank LSB/MSB OS 3.0


unloadInstrument

public abstract boolean unloadInstrument(byte patch,
                                         byte bankLSB,
                                         byte bankMSB)
Unload a GM2 instrument via patch number and bank LSB/MSB OS 3.0


isInstrumentLoaded

public abstract boolean isInstrumentLoaded(byte patch,
                                           byte bankLSB,
                                           byte bankMSB)
Determine if a GM2 instrument is loaded via patch number and bank LSB/MSB OS 3.0


translateBankProgramToInstrument

public abstract int translateBankProgramToInstrument(byte bank,
                                                     byte program,
                                                     byte channel,
                                                     byte note)
Deprecated. - only used with old instrument number methods.

translate a Midi bank, program, channel, note into a instrument.


getControlValue

public abstract byte getControlValue(byte channel,
                                     byte controller)
Get the current Midi controler value. Note this is not time based


getProgram

public abstract byte getProgram(byte channel)
Get the current Midi program


getBank

public abstract byte getBank(byte channel)
Get the current Midi bank number (LSB for GM2 bank number)


getPitchBendLSB

public abstract byte getPitchBendLSB(byte channel)

getPitchBendMSB

public abstract byte getPitchBendMSB(byte channel)

parseMidiData

public abstract void parseMidiData(byte commandByte,
                                   byte data1Byte,
                                   byte data2Byte,
                                   byte data3Byte,
                                   int time)
given a midi stream, parse it out to the various midi functions for example: 0x92 0x50 0x7F 0x00 comandByte data1Byte data2Byte data3Byte Note 80 on with a velocity of 127 on channel 2


parseMidiData

public void parseMidiData(byte commandByte,
                          byte data1Byte,
                          byte data2Byte,
                          byte data3Byte)

noteOff

public abstract void noteOff(byte channel,
                             byte note,
                             byte velocity,
                             int time)
If you pass AudioManager.NOW for time the current time will be passed The channel variable is 0 to 15. Channel 9 is percussion for example. The programNumber variable is a number from 0-127. note is a MIDI note value. 0-127. Higher numbers are higher in pitch.


noteOff

public void noteOff(byte channel,
                    byte note,
                    byte velocity)

noteOnWithLoad

public abstract void noteOnWithLoad(byte channel,
                                    byte note,
                                    byte velocity,
                                    int time)
note on that checks to see if an instrument needs to be loaded.


noteOnWithLoad

public void noteOnWithLoad(byte channel,
                           byte note,
                           byte velocity)

noteOn

public abstract void noteOn(byte channel,
                            byte note,
                            byte velocity,
                            int time)

noteOn

public void noteOn(byte channel,
                   byte note,
                   byte velocity)

controlChange

public abstract void controlChange(byte channel,
                                   byte controlNumber,
                                   byte controlValue,
                                   int time)

controlChange

public void controlChange(byte channel,
                          byte controlNumber,
                          byte controlValue)

programBankChange

public abstract void programBankChange(byte channel,
                                       byte programNumber,
                                       byte bankNumber,
                                       int time)
Deprecated. - use version which takes program plus bank lsb and msb.

Select MIDI program for the specified channel using program and bank number at a specified time.


programBankChange

public void programBankChange(byte channel,
                              byte programNumber,
                              byte bankNumber)
Deprecated. - use version which takes program plus bank lsb and msb.

Select MIDI program for the specified channel using program and bank number. Time is set to AudioManager.NOW.


programBankChange

public abstract void programBankChange(byte channel,
                                       byte programNumber,
                                       byte bankLSB,
                                       byte bankMSB,
                                       int time)
Select GM2 MIDI program for the specified channel using program number and bank LSB/MSB OS 3.0


programChange

public abstract void programChange(byte channel,
                                   byte programNumber,
                                   int time)
Select MIDI program for the specified channel using program number. Bank defaults to GM2 bank 0 (MSB 0x78 LSB 0x00) or whichever bank has been previously selected for this channel.


programChange

public void programChange(byte channel,
                          byte programNumber)

pitchBend

public abstract void pitchBend(byte channel,
                               byte lsb,
                               byte msb,
                               int time)

pitchBend

public void pitchBend(byte channel,
                      byte lsb,
                      byte msb)

RPN

public void RPN(byte channel,
                byte lsb,
                byte msb,
                byte value,
                int time)
GM Registered parameters


RPN

public void RPN(byte channel,
                byte lsb,
                byte msb,
                byte value)
GM Registered parameters


NRPN

public void NRPN(byte channel,
                 byte lsb,
                 byte msb,
                 byte value,
                 int time)
Non registered parameters


NRPN

public void NRPN(byte channel,
                 byte lsb,
                 byte msb,
                 byte value)
Non registered parameters


allNotesOff

public abstract void allNotesOff(int time)
kill voices with release


allNotesOff

public void allNotesOff()
kill all voices


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

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

destroy

public void destroy()
Description copied from interface: Playable
will free memory associated with this object

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

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