danger.audio
Class Sequence

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


public abstract class Sequence
extends Object

Sequences types are: midi, xmf, rmf, sms, smaf, imedoly, mono ringtone formats.

You can get more information from www.midi.org

To load a Sequence object do:

    mSeq = AudioManager.createSequence();
    mSeq.load(byte[]);
or
    mSeq = Sequence.load(byte[]);
Then to start do:
    mSeq.start(ToneFilter.BUZZER | ToneFilter.FLASHER);


Field Summary
static byte BANK
          Bank controller.
static byte CONTROL_CHANGE
          MIDI controller change command use with parseMidiData(byte, byte, byte, byte, int)
static byte DATA_LSB
           
static byte DATA_MSB
           
static byte DEFAULT_BANK
          Default bank: 0
static byte DEFAULT_PROGRAM
          Default program: 0
static byte EXPRESSION
          Volume expression controller.
static byte LED_BRIGHTNESS
          Danger specific control.
static byte LED_HUE
          Danger specific control.
static byte LED_MOOD_BOTTOM_LEFT_BRIGHTNESS
          Danger specific control.
static byte LED_MOOD_BOTTOM_RIGHT_BRIGHTNESS
          Danger specific control.
static byte LED_MOOD_TOP_LEFT_BRIGHTNESS
          Danger specific control.
static byte LED_MOOD_TOP_RIGHT_BRIGHTNESS
          Danger specific control.
static byte LED_PURITY
          Danger specific control.
static byte MAX_BANKS
          three GM banks; three user banks
static int MAX_INSTRUMENTS
          MIDI number of programs per patch bank
static byte MAX_MIDI_CHANNELS
          Max MIDI channels
static byte MAX_MIDI_TRACKS
          64 MIDI tracks, plus 1 tempo track
static byte MAX_MIDI_VOLUME
          Max channel volume
static int MAX_NOTE_NUMBER
          There are 128 notes on the midi scale.
static int MAX_TRANSPOSE_DOWN
          Max transpose down is 64 semitones
static int MAX_TRANSPOSE_UP
          Max transpose up is 63 semitones
protected  Object mLock
           
static byte MODULATION
          Modulation controller.
static byte NOTE_OFF
          MIDI note off command use with parseMidiData(byte, byte, byte, byte, int)
static byte NOTE_ON
          MIDI note on command use with parseMidiData(byte, byte, byte, byte, int)
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
          MIDI percussion channel, zero based
static byte PITCH_BEND
          MIDI pitch bend command use with parseMidiData(byte, byte, byte, byte, int)
static byte PROGRAM_CHANGE
          MIDI program change command use with parseMidiData(byte, byte, byte, byte, int)
static byte RPN_LSB
           
static byte RPN_MSB
           
static byte SUSTAIN
          Sustain controller.
static byte VIBRATE
          Danger specific control.
static byte VIBRATE_70MS
          Danger specific control.
static byte VOLUME
          Volume controller.
 
Fields inherited from interface danger.media.PlayableMedia
DEFAULT_PRIORITY, PRIORITY_1, PRIORITY_2, PRIORITY_3, PRIORITY_4, PRIORITY_5
 
Method Summary
 void allNotesOff()
          Stop at notes currently playing ASAP.
 void allNotesOff(int time)
          Stop at notes currently playing at a specific time.
 void allowChannelTranspose(byte channel, boolean allowPitch)
          Set a specific channel ability to transpose when PlayableAudio.setTranspose(int) is used.
 boolean areMidiEventsPending()
          Returns true if any MIDI events pending in the event queue.
 void controlChange(byte channel, byte controlNumber, byte controlValue)
          Controller event.
 void controlChange(byte channel, byte controlNumber, byte controlValue, int time)
          Controller event.
 void destroy()
          Free internal resources for this object.
 boolean doesChannelAllowTranspose(byte channel)
          Get the tranpose allow state of a specific channel.
 void fadeFromToInTime(int sourceVolume, int destVolume, int timeInMilliseconds)
          Fade from source volume, to dest volume in time milliseconds.
 byte getBank(byte channel)
          Deprecated. - use getBankLSB(byte) instead
 byte getBankLSB(byte channel)
          Get the LSB for the currently selected GM2 bank
 byte getBankMSB(byte channel)
          Get the MSB for the currently selected GM2 bank
 void getChannelMuteStatus(boolean[] pChannels)
          Get all channel mute status at once.
 void getChannelSoloStatus(boolean[] pChannels)
          Get all channel solo status at once.
 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.
 byte[] getData()
          Return MIDI/SMS sequence data once loaded
 int getLoopCount()
          Gets the loop count; which is the total number of times an object is played.
 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.
 int getMarkerIDByIndex(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.
 String getMarkerNameByID(int markerID)
          Return the name associated with the marker with the given markerID.
 String getMarkerNameByIndex(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 getMarkerPositionByID(int markerID)
          Return the position in milliseconds of the marker with the given markerID.
 int getMarkerPositionByIndex(int index)
          Return the position in milliseconds of the marker at the given index.
 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.
 int getMillisecondLength()
          Get length in milliseconds of object's media.
 int getMillisecondPosition()
          Get the current playback position of a object in milliseconds.
 byte getPitchBendLSB(byte channel)
          Get pitch bend LSB.
 byte getPitchBendMSB(byte channel)
          Get pitch bend MSB.
 int getPlaybackRate()
          Get the playback rate.
 int getPriority()
          Get media priority level.
 byte getProgram(byte channel)
          Get the current MIDI program
 void getSoloTrackStatus(boolean[] pTracks)
          Get all track solo status at once.
 int getStereoPosition()
          Returns current stereo position.
 int getTempo()
          Get song current tempo
 String getTitle()
          Return title, if available of Sequence
 void getTrackMuteStatus(boolean[] pTracks)
          Get all track mute status at once.
 int getTranspose()
          Get tuning in semitones.
 int getTuning()
          Get tuning in cents.
 int getType()
          Get type of sequence.
 int getUniqueID()
          Return runtime ID.
 int getVolume()
          Get volume.
 int getVolumeClass()
          Get the current volume class.
 boolean isDone()
          Returns true if object is finished playing.
 boolean isInstrumentLoaded(byte patch, byte bankLSB, byte bankMSB)
          Determine if a GM2 instrument is loaded via patch number and bank LSB/MSB.
 boolean isInstrumentLoaded(int instrument)
          Deprecated. Use isInstrumentLoaded(byte, byte, byte)
 boolean isLoaded()
          Returns true if object is loaded and ready to be played.
 boolean isLoopingEnabled()
          Return whether looping is enabled (set by a call to PlayableMedia.setLoopingEnabled(boolean)).
 boolean isMuted()
          Get mute status.
 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)
          Deprecated. As of 4.0, replaced by load(byte [])
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)
          Deprecated. As of 4.0, replaced by load(File)
 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)
          Parse a byte array that is in the Midp Tone control spec and turns it into a Sequence.
 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)
          Pass an ID, and read data from the application resource file or the system resource file.
 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
 boolean loadInstrument(byte patch, byte bankLSB, byte bankMSB)
          Load a GM2 instrument via patch number and bank LSB/MSB.
 boolean loadInstrument(int instrument)
          Deprecated. Use loadInstrument(byte, byte, byte)
 void muteChannel(byte channel)
          Mute a specific channel.
 void muteTrack(byte track)
          Mute a specific track.
 void noteOff(byte channel, byte note, byte velocity)
          Note off event.
 void noteOff(byte channel, byte note, byte velocity, int time)
          Note off event.
 void noteOn(byte channel, byte note, byte velocity)
          Note on event.
 void noteOn(byte channel, byte note, byte velocity, int time)
          Note on event.
 void noteOnWithLoad(byte channel, byte note, byte velocity)
          Note on event.
 void noteOnWithLoad(byte channel, byte note, byte velocity, int time)
          Note on event.
 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)
          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
 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
 void parseSysex(byte[] sysex)
          Send sysex message to sequencer immediately.
 void parseSysex(byte[] sysex, int time)
          Send sysex message to sequencer at a particular time.
 void pause()
          Will pause object.
 void pitchBend(byte channel, byte lsb, byte msb)
          Pitch bend event.
 void pitchBend(byte channel, byte lsb, byte msb, int time)
          Pitch bend event.
 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)
          Deprecated. As of 4.0, replaced by play(byte [])
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)
          Deprecated. As of 4.0, replaced by play(File)
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)
          Deprecated. As of 4.0, replaced by play(int)
 void programBankChange(byte channel, byte programNumber, byte bankNumber)
          Deprecated. Use programBankChange(byte, byte, byte, byte, int)
 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
 void programBankChange(byte channel, byte programNumber, byte bankNumber, int time)
          Deprecated. Use programBankChange(byte, byte, byte, byte, int)
 void programChange(byte channel, byte programNumber)
          Select MIDI program for the specified channel using program number.
 void programChange(byte channel, byte programNumber, int time)
          Select MIDI program for the specified channel using program number.
 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
 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 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.
 void setFlashOnlyEnable(boolean flashOnly)
          Enable/disable Mood Lights.
 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.
 void setLoops(int loops)
          Deprecated. use setLoopCount(int) instead.
 void setMasterTempo(int tempoFactor)
          Set song master tempo.
 void setMicrosecondPosition(int ticks)
          Deprecated. - use setMillisecondPosition(int) instead.
 void setMillisecondPosition(int position)
          Set the current playback position of object 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.
 void setPositionToMarkerByID(int markerID)
          Set the media playback position to the position associated with the marker with the given markerID.
 void setPositionToMarkerByIndex(int index)
          Set the media playback position to the position associated with the marker at the give index.
 void setPriority(int priority)
          Set media priority level.
 void setRouteBus(int routeBus)
          Set audio route.
 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 setTempo(int beatsPerMinute)
          Set song current tempo.
 void setTranspose(int semitones)
          Set tuning in semitones.
 void setTuning(int cents)
          Set tuning in cents.
 void setVolume(int volume)
          Set volume.
 void setVolumeClass(int volumeClass)
          Set the volume class.
 void soloChannel(byte channel)
          Solo a specific channel.
 void soloTrack(byte track)
          Solo a specific track.
 void start()
          Start sequence.
 void start(int filter)
          Start a sequence, but filter content types from ToneFilter.
 void start(int filter, int volume)
          Start a sequence, but filter content types by ToneFilter and set a volume level prior to starting.
 boolean startAtOffset(int startOffset)
          Start object at an offset.
 boolean startDefault()
          Start Sequence with defaults.
 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.
 void stop()
          Will stop the object and reset to begining.
 void stopPlaying()
          Stop media playback.
 int translateBankProgramToInstrument(byte bank, byte program, byte channel, byte note)
          Deprecated. Use only with loadInstrument(int) and unloadInstrument(int)
 boolean unloadInstrument(byte patch, byte bankLSB, byte bankMSB)
          Unload a GM2 instrument via patch number and bank LSB/MSB.
 boolean unloadInstrument(int instrument)
          Deprecated. Use unloadInstrument(byte, byte, byte)
 void unmuteChannel(byte channel)
          Unmute a specific channel.
 void unmuteTrack(byte track)
          Unmute a specific track.
 void unSoloChannel(byte channel)
          Unsolo a specific channel.
 void unSoloTrack(byte track)
          Unsolo a specific 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 note on command use with parseMidiData(byte, byte, byte, byte, int)

See Also:
Constant Field Values

NOTE_OFF

public static final byte NOTE_OFF
MIDI note off command use with parseMidiData(byte, byte, byte, byte, int)

See Also:
Constant Field Values

CONTROL_CHANGE

public static final byte CONTROL_CHANGE
MIDI controller change command use with parseMidiData(byte, byte, byte, byte, int)

See Also:
Constant Field Values

PROGRAM_CHANGE

public static final byte PROGRAM_CHANGE
MIDI program change command use with parseMidiData(byte, byte, byte, byte, int)

See Also:
Constant Field Values

PITCH_BEND

public static final byte PITCH_BEND
MIDI pitch bend command use with parseMidiData(byte, byte, byte, byte, int)

See Also:
Constant Field Values

NRPN_LSB

public static final byte NRPN_LSB
Controller values. Use with controlChange(byte, byte, byte, int)

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
Volume controller. Use with controlChange(byte, byte, byte, int)

See Also:
Constant Field Values

BANK

public static final byte BANK
Bank controller. Use with controlChange(byte, byte, byte, int)

See Also:
Constant Field Values

MODULATION

public static final byte MODULATION
Modulation controller. Use with controlChange(byte, byte, byte, int)

See Also:
Constant Field Values

EXPRESSION

public static final byte EXPRESSION
Volume expression controller. Use with controlChange(byte, byte, byte, int)

See Also:
Constant Field Values

SUSTAIN

public static final byte SUSTAIN
Sustain controller. Use with controlChange(byte, byte, byte, int)

See Also:
Constant Field Values

VIBRATE

public static final byte VIBRATE
Danger specific control. Use this with controlChange(byte, byte, byte, int)

A value >0 will turn on the vibration, until a value of 0 is set.

    mSeq->controlChange((byte)1, VIBRATE, (byte)1);
        

See Also:
Constant Field Values

LED_HUE

public static final byte LED_HUE
Danger specific control. Use this with controlChange(byte, byte, byte, int)

This value changes the LED's hue.

    mSeq->controlChange((byte)1, LED_HUE, (byte)43);
        

See Also:
Constant Field Values

LED_PURITY

public static final byte LED_PURITY
Danger specific control. Use this with controlChange(byte, byte, byte, int)

This value changes the LED's purity.

    mSeq->controlChange((byte)1, LED_PURITY, (byte)43);
        

See Also:
Constant Field Values

LED_BRIGHTNESS

public static final byte LED_BRIGHTNESS
Danger specific control. Use this with controlChange(byte, byte, byte, int)

This value changes the LED's brightness.

    mSeq->controlChange((byte)1, LED_BRIGHTNESS, (byte)43);
        

See Also:
Constant Field Values

LED_MOOD_BOTTOM_LEFT_BRIGHTNESS

public static final byte LED_MOOD_BOTTOM_LEFT_BRIGHTNESS
Danger specific control. Use this with controlChange(byte, byte, byte, int)

This value changes the LED #1's brightness.

    mSeq->controlChange((byte)1, LED_MOOD_BOTTOM_LEFT_BRIGHTNESS, (byte)43);
        

Since:
4.4
See Also:
Constant Field Values

LED_MOOD_BOTTOM_RIGHT_BRIGHTNESS

public static final byte LED_MOOD_BOTTOM_RIGHT_BRIGHTNESS
Danger specific control. Use this with controlChange(byte, byte, byte, int)

This value changes the LED #2's brightness.

    mSeq->controlChange((byte)1, LED_MOOD_BOTTOM_RIGHT_BRIGHTNESS, (byte)43);
        

Since:
4.4
See Also:
Constant Field Values

LED_MOOD_TOP_LEFT_BRIGHTNESS

public static final byte LED_MOOD_TOP_LEFT_BRIGHTNESS
Danger specific control. Use this with controlChange(byte, byte, byte, int)

This value changes the LED #3's brightness.

    mSeq->controlChange((byte)1, LED_MOOD_TOP_LEFT_BRIGHTNESS, (byte)43);
        

Since:
4.4
See Also:
Constant Field Values

LED_MOOD_TOP_RIGHT_BRIGHTNESS

public static final byte LED_MOOD_TOP_RIGHT_BRIGHTNESS
Danger specific control. Use this with controlChange(byte, byte, byte, int)

This value changes the LED #4's brightness.

    mSeq->controlChange((byte)1, LED_MOOD_TOP_RIGHT_BRIGHTNESS, (byte)43);
        

Since:
4.4
See Also:
Constant Field Values

VIBRATE_70MS

public static final byte VIBRATE_70MS
Danger specific control. Use this with controlChange(byte, byte, byte, int)

A value >0 will turn on the vibration for 70 milliseconds and turn off if 0.

    mSeq->controlChange((byte)1, VIBRATE_70MS, (byte)1);
        

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 MIDI channels

See Also:
Constant Field Values

MAX_MIDI_VOLUME

public static final byte MAX_MIDI_VOLUME
Max channel volume

See Also:
Constant Field Values

MAX_MIDI_TRACKS

public static final byte MAX_MIDI_TRACKS
64 MIDI tracks, plus 1 tempo track

See Also:
Constant Field Values

MAX_INSTRUMENTS

public static final int MAX_INSTRUMENTS
MIDI number of programs per patch bank

See Also:
Constant Field Values

MAX_NOTE_NUMBER

public static final int MAX_NOTE_NUMBER
There are 128 notes on the midi scale. This is 128.

Since:
4.0
See Also:
Constant Field Values

MAX_BANKS

public static final byte MAX_BANKS
three GM banks; three user banks

See Also:
Constant Field Values

MAX_TRANSPOSE_UP

public static final int MAX_TRANSPOSE_UP
Max transpose up is 63 semitones

Since:
4.0
See Also:
Constant Field Values

MAX_TRANSPOSE_DOWN

public static final int MAX_TRANSPOSE_DOWN
Max transpose down is 64 semitones

Since:
4.0
See Also:
Constant Field Values

DEFAULT_PROGRAM

public static final byte DEFAULT_PROGRAM
Default program: 0

See Also:
Constant Field Values

DEFAULT_BANK

public static final byte DEFAULT_BANK
Default bank: 0

See Also:
Constant Field Values

PERCUSSION_CHANNEL

public static final byte PERCUSSION_CHANNEL
MIDI percussion channel, zero based

See Also:
Constant Field Values

mLock

protected Object mLock
Method Detail

load

public static Sequence load(byte[] data,
                            boolean autoDelete)
Deprecated. As of 4.0, replaced by load(byte [])

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 setLoops(int) with 0 to clear the loop points.

Since:
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 setLoops(int) with 0 to clear the loop points.


play

public static Sequence play(byte[] data,
                            boolean autoDelete)
Deprecated. As of 4.0, replaced by play(byte [])

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 load(byte[], boolean) then start() without the filters.

Since:
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 load(byte[], boolean) then start() without the filters.


play

public static Sequence play(int resourceID,
                            boolean autoDelete)
Deprecated. As of 4.0, replaced by play(int)

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 load(byte[], boolean) then start() without the filters.

Since:
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 load(byte[], boolean) then start() without the filters.


load

public static Sequence load(File f,
                            boolean autoDelete)
Deprecated. As of 4.0, replaced by load(File)

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 setLoops(int) with 0 to clear the loop points.

Since:
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 setLoops(int) with 0 to clear the loop points.


play

public static Sequence play(File f,
                            boolean autoDelete)
Deprecated. As of 4.0, replaced by play(File)

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 load(byte[], boolean) then start() without the filters.

Since:
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 load(byte[], boolean) then 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 load(byte[], boolean) then start() without the filters.


getTitle

public String getTitle()
Return title, if available of Sequence


getData

public byte[] getData()
Return MIDI/SMS sequence data once loaded


getType

public int getType()
Get type of sequence.

Returns:
one of Format.Type

loadFromData

public 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)
Parse a byte array that is in the Midp Tone control spec and turns it into a Sequence.

Parameters:
data - byte array that is in the format. See ToneControl.

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.

Parameters:
id - resource ID.
Returns:
boolean false if failed to parse.

loadFromResource

public boolean loadFromResource(int id,
                                Application app)
Pass an ID, and read data from the application resource file or the system resource file. Will parse a RMF or MIDI file.

Parameters:
id - resource ID.
app - Application resource database to search.
Returns:
boolean false if failed to parse.

setLoops

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

Set loop counter. The number of times a is played is loops. When setting do after startDefault().

Parameters:
loops - number of times to loop
Since:
2.3

start

public void start()
Start sequence.


startWithFilter

public boolean startWithFilter(int filter)
Start Sequence with a filter.

Parameters:
filter - one or combined bits of ToneFilter
Returns:
true if started, false if not.
Since:
2.3

startDefault

public boolean startDefault()
Start Sequence with defaults.

Returns:
true if started, false if not.
Since:
2.3

start

public void start(int filter,
                  int volume)
Start a sequence, but filter content types by 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

areMidiEventsPending

public boolean areMidiEventsPending()
Returns true if any MIDI events pending in the event queue.

Returns:
true/false

setMasterTempo

public void setMasterTempo(int tempoFactor)
Set song master tempo.

Parameters:
tempoFactor - This is a multipler on the playback speed. A value of 100 uses song's encoded tempo, and 200 will play twice as fast, and 50 will play half as fast.

getMasterTempo

public int getMasterTempo()
Get song master tempo. If never set with setMasterTempo(int) then this will return 100, or what's encoded in the file.

Returns:
int master tempo.

setTempo

public void setTempo(int beatsPerMinute)
Set song current tempo. This may be overridden by any tempo events in the sequence as they play back.

Since:
4.0

getTempo

public int getTempo()
Get song current tempo

Since:
4.0

setPlaybackRate

public void setPlaybackRate(int rate)
Set the playback rate

Specified by:
setPlaybackRate in interface PlayableMedia
Parameters:
rate - rate of playback. 100 is normal, 200 is double speed, 50 is half speed

getPlaybackRate

public int getPlaybackRate()
Get the playback rate.

Specified by:
getPlaybackRate in interface PlayableMedia
Returns:
int rate of playback. 100 is normal, 200 is double speed, 50 is half speed
Since:
4.0

muteTrack

public void muteTrack(byte track)
Mute a specific track.

Parameters:
track - 0 to 64

unmuteTrack

public void unmuteTrack(byte track)
Unmute a specific track.

Parameters:
track - 0 to 64

getTrackMuteStatus

public void getTrackMuteStatus(boolean[] pTracks)
Get all track mute status at once.

Parameters:
pTracks - a 65 byte array.

soloTrack

public void soloTrack(byte track)
Solo a specific track.

Parameters:
track - 0 to 64

unSoloTrack

public void unSoloTrack(byte track)
Unsolo a specific track.

Parameters:
track - 0 to 64

getSoloTrackStatus

public void getSoloTrackStatus(boolean[] pTracks)
Get all track solo status at once.

Parameters:
pTracks - a 65 byte array.

getMicrosecondLength

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

Get length in microseconds of object.


setMicrosecondPosition

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

Set the current playback position of object in ticks. Must call after starting object.


getMicrosecondPosition

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

Get the current playback position of a object in ticks


allowChannelTranspose

public void allowChannelTranspose(byte channel,
                                  boolean allowPitch)
Set a specific channel ability to transpose when PlayableAudio.setTranspose(int) is used.

Parameters:
channel - MIDI channel. 0 to 15.
allowPitch - true/false

doesChannelAllowTranspose

public boolean doesChannelAllowTranspose(byte channel)
Get the tranpose allow state of a specific channel.

Parameters:
channel - MIDI channel. 0 to 15.
Returns:
true/false

muteChannel

public void muteChannel(byte channel)
Mute a specific channel.

Parameters:
channel - MIDI channel. 0 to 15.

unmuteChannel

public void unmuteChannel(byte channel)
Unmute a specific channel.

Parameters:
channel - MIDI channel. 0 to 15.

getChannelMuteStatus

public void getChannelMuteStatus(boolean[] pChannels)
Get all channel mute status at once.

Parameters:
pChannels - a 16 byte array.

soloChannel

public void soloChannel(byte channel)
Solo a specific channel.

Parameters:
channel - MIDI channel. 0 to 15.

unSoloChannel

public void unSoloChannel(byte channel)
Unsolo a specific channel.

Parameters:
channel - MIDI channel. 0 to 15.

getChannelSoloStatus

public void getChannelSoloStatus(boolean[] pChannels)
Get all channel solo status at once.

Parameters:
pChannels - a 16 byte array.

loadInstrument

public boolean loadInstrument(int instrument)
Deprecated. Use loadInstrument(byte, byte, byte)

Load an instrument via instrument number.


unloadInstrument

public boolean unloadInstrument(int instrument)
Deprecated. Use unloadInstrument(byte, byte, byte)

Unload an instrument via instrument number.


isInstrumentLoaded

public boolean isInstrumentLoaded(int instrument)
Deprecated. Use isInstrumentLoaded(byte, byte, byte)

Determine if an instrument is loaded via instrument number.


loadInstrument

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

Parameters:
patch - MIDI patch number (0-127)
bankLSB - LSB of a MIDI bank number
bankMSB - MSB of a MIDI bank number
Since:
3.0

unloadInstrument

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

Parameters:
patch - MIDI patch number (0-127)
bankLSB - LSB of a MIDI bank number
bankMSB - MSB of a MIDI bank number
Since:
3.0

isInstrumentLoaded

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

Parameters:
patch - MIDI patch number (0-127)
bankLSB - LSB of a MIDI bank number
bankMSB - MSB of a MIDI bank number
Since:
3.0

translateBankProgramToInstrument

public int translateBankProgramToInstrument(byte bank,
                                            byte program,
                                            byte channel,
                                            byte note)
Deprecated. Use only with loadInstrument(int) and unloadInstrument(int)

Translate a MIDI bank, program, channel, note into a instrument.

Parameters:
channel - MIDI channel. 0 to 15.
program - MIDI program. 0 to 127.
note - MIDI note. 0 to 127.
bank - MIDI bank. 0 to 3.

getControlValue

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

Parameters:
channel - MIDI channel. 0 to 15.
controller - MIDI controller. 0 to 127.

getProgram

public byte getProgram(byte channel)
Get the current MIDI program

Parameters:
channel - MIDI channel. 0 to 15.

getBankMSB

public byte getBankMSB(byte channel)
Get the MSB for the currently selected GM2 bank

Parameters:
channel - MIDI channel. 0 to 15.
Since:
4.0

getBankLSB

public byte getBankLSB(byte channel)
Get the LSB for the currently selected GM2 bank

Parameters:
channel - MIDI channel. 0 to 15.
Since:
4.0

getBank

public byte getBank(byte channel)
Deprecated. - use getBankLSB(byte) instead

Get the current MIDI bank number (LSB for GM2 bank number)

Parameters:
channel - MIDI channel. 0 to 15.

getPitchBendLSB

public byte getPitchBendLSB(byte channel)
Get pitch bend LSB.

Parameters:
channel - MIDI channel. 0 to 15.

getPitchBendMSB

public byte getPitchBendMSB(byte channel)
Get pitch bend MSB.

Parameters:
channel - MIDI channel. 0 to 15.

parseMidiData

public 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
                

Parameters:
commandByte - MIDI command byte
data1Byte - data byte specific to commandByte
data2Byte - data byte specific to commandByte
data3Byte - data byte specific to commandByte
time - time in microseconds

parseMidiData

public void parseMidiData(byte commandByte,
                          byte data1Byte,
                          byte data2Byte,
                          byte data3Byte)
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
                

Parameters:
commandByte - MIDI command byte
data1Byte - data byte specific to commandByte
data2Byte - data byte specific to commandByte
data3Byte - data byte specific to commandByte

parseSysex

public void parseSysex(byte[] sysex,
                       int time)
Send sysex message to sequencer at a particular time.

Since:
4.0

parseSysex

public void parseSysex(byte[] sysex)
Send sysex message to sequencer immediately.

Since:
4.0

noteOff

public void noteOff(byte channel,
                    byte note,
                    byte velocity,
                    int time)
Note off event.

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.

Parameters:
channel - MIDI channel. 0 to 15.
note - MIDI note. 0 to 127.
velocity - MIDI velocity. 0 to 127.
time - event start time in microseconds.

noteOff

public void noteOff(byte channel,
                    byte note,
                    byte velocity)
Note off event.

Parameters:
channel - MIDI channel. 0 to 15.
note - MIDI note. 0 to 127.
velocity - MIDI velocity. 0 to 127.

noteOnWithLoad

public void noteOnWithLoad(byte channel,
                           byte note,
                           byte velocity,
                           int time)
Note on event.

Will load an instrument if not currently loaded.

Parameters:
channel - MIDI channel. 0 to 15.
note - MIDI note. 0 to 127.
velocity - MIDI velocity. 0 to 127.
time - event start time in microseconds.

noteOnWithLoad

public void noteOnWithLoad(byte channel,
                           byte note,
                           byte velocity)
Note on event.

Will load an instrument if not currently loaded.

Parameters:
channel - MIDI channel. 0 to 15.
note - MIDI note. 0 to 127.
velocity - MIDI velocity. 0 to 127.

noteOn

public void noteOn(byte channel,
                   byte note,
                   byte velocity,
                   int time)
Note on event.

Parameters:
channel - MIDI channel. 0 to 15.
note - MIDI note. 0 to 127.
velocity - MIDI velocity. 0 to 127.
time - event start time in microseconds.

noteOn

public void noteOn(byte channel,
                   byte note,
                   byte velocity)
Note on event.

Parameters:
channel - MIDI channel. 0 to 15.
note - MIDI note. 0 to 127.
velocity - MIDI velocity. 0 to 127.

controlChange

public void controlChange(byte channel,
                          byte controlNumber,
                          byte controlValue,
                          int time)
Controller event.

Parameters:
channel - MIDI channel. 0 to 15.
controlNumber - MIDI controller. 0 to 127.
controlValue - value. 0 to 127.
time - event start time in microseconds.

controlChange

public void controlChange(byte channel,
                          byte controlNumber,
                          byte controlValue)
Controller event.

Parameters:
channel - MIDI channel. 0 to 15.
controlNumber - MIDI controller. 0 to 127.
controlValue - value. 0 to 127.

programBankChange

public void programBankChange(byte channel,
                              byte programNumber,
                              byte bankNumber,
                              int time)
Deprecated. Use programBankChange(byte, byte, byte, byte, int)

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

Parameters:
channel - MIDI channel. 0 to 15.
programNumber - MIDI program. 0 to 127.
bankNumber - value. 0 to 3.
time - event start time in microseconds.

programBankChange

public void programBankChange(byte channel,
                              byte programNumber,
                              byte bankNumber)
Deprecated. Use programBankChange(byte, byte, byte, byte, int)

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

Parameters:
channel - MIDI channel. 0 to 15.
programNumber - MIDI program. 0 to 127.
bankNumber - value. 0 to 3.

programBankChange

public 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

Parameters:
channel - MIDI channel. 0 to 15.
programNumber - MIDI program. 0 to 127.
bankLSB - LSB bank.
bankMSB - MSB bank.
time - event start time in microseconds.
Since:
3.0

programChange

public 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.

Parameters:
channel - MIDI channel. 0 to 15.
programNumber - MIDI program. 0 to 127.
time - event start time in microseconds.

programChange

public void programChange(byte channel,
                          byte programNumber)
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.

Parameters:
channel - MIDI channel. 0 to 15.
programNumber - MIDI program. 0 to 127.

pitchBend

public void pitchBend(byte channel,
                      byte lsb,
                      byte msb,
                      int time)
Pitch bend event.

Parameters:
channel - MIDI channel. 0 to 15.
lsb - LSB of bend amount. 0 to 127.
msb - MSB of bend amount. 0 to 127.
time - event start time in microseconds.

pitchBend

public void pitchBend(byte channel,
                      byte lsb,
                      byte msb)
Pitch bend event.

Parameters:
channel - MIDI channel. 0 to 15.
lsb - LSB of bend amount. 0 to 127.
msb - MSB of bend amount. 0 to 127.

RPN

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

Parameters:
channel - MIDI channel. 0 to 15.
lsb - LSB of bend amount. 0 to 127.
msb - MSB of bend amount. 0 to 127.
value - 0 to 127.
time - event start time in microseconds.

RPN

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

Parameters:
channel - MIDI channel. 0 to 15.
lsb - LSB of bend amount. 0 to 127.
msb - MSB of bend amount. 0 to 127.
value - 0 to 127.

NRPN

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

Parameters:
channel - MIDI channel. 0 to 15.
lsb - LSB of bend amount. 0 to 127.
msb - MSB of bend amount. 0 to 127.
value - 0 to 127.
time - event start time in microseconds.

NRPN

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

Parameters:
channel - MIDI channel. 0 to 15.
lsb - LSB of bend amount. 0 to 127.
msb - MSB of bend amount. 0 to 127.
value - 0 to 127.

allNotesOff

public void allNotesOff(int time)
Stop at notes currently playing at a specific time.

Parameters:
time - in microseconds

allNotesOff

public void allNotesOff()
Stop at notes currently playing ASAP.


destroy

public void destroy()
Free internal resources for this object. Any attempt to use a destroyed object will cause it to throw an IllegalStateException.

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

setRouteBus

public void setRouteBus(int routeBus)
Set audio route.

Parameters:
routeBus - one of Route

setVolume

public void setVolume(int volume)
Set volume.

Specified by:
setVolume in interface Playable
Specified by:
setVolume in interface PlayableAudio
Parameters:
volume - 0 to 100 volume.

getVolume

public int getVolume()
Get volume.

Specified by:
getVolume in interface Playable
Specified by:
getVolume in interface PlayableAudio
Returns:
int 0 to 100 default volume.

setPriority

public void setPriority(int priority)
Description copied from interface: PlayableMedia
Set media priority level.

Specified by:
setPriority in interface PlayableMedia
Parameters:
priority - - priority level for media

getPriority

public int getPriority()
Description copied from interface: PlayableMedia
Get media priority level.

Specified by:
getPriority in interface PlayableMedia
Returns:
current priority level

getLoops

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

Get number of loops to play.

Specified by:
getLoops in interface Playable

setLoopCount

public void setLoopCount(int loopCount)
Description copied from interface: PlayableMedia
Sets the loop count; which is the total number of times an object is played.

Specified by:
setLoopCount in interface PlayableMedia
Parameters:
loopCount - - total number of times to play; 0 means loop forever.

getLoopCount

public int getLoopCount()
Description copied from interface: PlayableMedia
Gets the loop count; which is the total number of times an object is played.

Specified by:
getLoopCount in interface PlayableMedia

setBuzzFlashEnable

public void setBuzzFlashEnable(boolean buzzOn,
                               boolean flashOn)
Description copied from interface: PlayableAudio
Set buzz/flash enable on or off.

Specified by:
setBuzzFlashEnable in interface PlayableAudio
Parameters:
buzzOn - if true, media will use vibration
flashOn - if true, media will use LED

setFlashOnlyEnable

public void setFlashOnlyEnable(boolean flashOnly)
Enable/disable Mood Lights. On some devices in addition to the regular light (known as "flash") there are additional lights (known as "mood lights"), which can be enabled or disabled using this method. If called with true, the mood lights will be disabled and only the regular flash used.

Parameters:
flashOnly - true to disable mood lights, false to enable them

setBuzzFlash

public void setBuzzFlash(boolean buzzOn,
                         boolean flashOn)
Description copied from interface: PlayableAudio
Set auto generate buzz/flash on or off.

Specified by:
setBuzzFlash in interface PlayableAudio
Parameters:
buzzOn - if true, media will generate vibration
flashOn - if true, media will generate LED

fadeFromToInTime

public void fadeFromToInTime(int sourceVolume,
                             int destVolume,
                             int timeInMilliseconds)
Description copied from interface: PlayableAudio
Fade from source volume, to dest volume in time milliseconds. Asynchronous.

Specified by:
fadeFromToInTime in interface PlayableAudio
Parameters:
sourceVolume - range 0 to 100
destVolume - range 0 to 100
timeInMilliseconds - how long the fade takes

isLoaded

public boolean isLoaded()
Returns true if object is loaded and ready to be played.

Specified by:
isLoaded in interface Playable
Specified by:
isLoaded in interface PlayableMedia
Since:
2.3

isPaused

public boolean isPaused()
Returns true if paused.

Specified by:
isPaused in interface Playable
Specified by:
isPaused in interface PlayableMedia

pause

public void pause()
Will pause object. Does nothing if already paused.

Specified by:
pause in interface Playable
Specified by:
pause in interface PlayableMedia

resume

public void resume()
Will resume object if paused. Does nothing if already resumed.

Specified by:
resume in interface Playable
Specified by:
resume in interface PlayableMedia

getMillisecondLength

public int getMillisecondLength()
Description copied from interface: PlayableMedia
Get length in milliseconds of object's media.

Specified by:
getMillisecondLength in interface PlayableMedia

getMillisecondPosition

public int getMillisecondPosition()
Description copied from interface: PlayableMedia
Get the current playback position of a object in milliseconds.

Specified by:
getMillisecondPosition in interface PlayableMedia

setMillisecondPosition

public void setMillisecondPosition(int position)
Description copied from interface: PlayableMedia
Set the current playback position of object in milliseconds. Must call after starting object.

Specified by:
setMillisecondPosition in interface PlayableMedia
Parameters:
position - position in media to seek to

getUniqueID

public int getUniqueID()
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)
Set the volume class. This determines how the media responds to changes in the system sound profile.

Specified by:
setVolumeClass in interface PlayableAudio
Parameters:
volumeClass - one of VolumeSelector

getVolumeClass

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

Specified by:
getVolumeClass in interface PlayableAudio
Returns:
one of VolumeSelector

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: MarkableMedia
Gets the number of markers contained by the currently loaded media. These can be video, MIDI, or audio markers.

Specified by:
getMarkerCount in interface MarkableMedia
Specified by:
getMarkerCount in interface PlayableMedia

getMarkerIDByIndex

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

Specified by:
getMarkerIDByIndex in interface MarkableMedia
Parameters:
index - index of the marker (0 to (MarkableMedia.getMarkerCount() - 1))

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

getMarkerNameByIndex

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

Specified by:
getMarkerNameByIndex in interface MarkableMedia
Parameters:
index - index of the marker (0 to (MarkableMedia.getMarkerCount() - 1))

getMarkerNameByID

public String getMarkerNameByID(int markerID)
Description copied from interface: MarkableMedia
Return the name associated with the marker with the given markerID. May return null.

Specified by:
getMarkerNameByID in interface MarkableMedia
Parameters:
markerID - integer ID of the marker (retrieved via MarkableMedia.getMarkerIDByIndex(int))

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

getMarkerPositionByIndex

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

Specified by:
getMarkerPositionByIndex in interface MarkableMedia
Parameters:
index - index of the marker (0 to (MarkableMedia.getMarkerCount() - 1))

getMarkerPositionByID

public int getMarkerPositionByID(int markerID)
Description copied from interface: MarkableMedia
Return the position in milliseconds of the marker with the given markerID.

Specified by:
getMarkerPositionByID in interface MarkableMedia
Parameters:
markerID - integer ID of the marker (retrieved via MarkableMedia.getMarkerIDByIndex(int))

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

setPositionToMarkerByIndex

public void setPositionToMarkerByIndex(int index)
Description copied from interface: MarkableMedia
Set the media playback position to the position associated with the marker at the give index.

Specified by:
setPositionToMarkerByIndex in interface MarkableMedia
Parameters:
index - index of the marker (0 to (MarkableMedia.getMarkerCount() - 1))

setPositionToMarkerByID

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

Specified by:
setPositionToMarkerByID in interface MarkableMedia
Parameters:
markerID - integer ID of the marker (retrieved via MarkableMedia.getMarkerIDByIndex(int))

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

setStereoPosition

public void setStereoPosition(int position)
Description copied from interface: PlayableAudio
Set the stereo position of sound.

Specified by:
setStereoPosition in interface PlayableAudio
Parameters:
position - range is -100 (full left) to 100 (full right). Default is 0 (center)

getStereoPosition

public int getStereoPosition()
Description copied from interface: PlayableAudio
Returns current stereo position.

Specified by:
getStereoPosition in interface PlayableAudio
Returns:
int range is -100 (full left) to 100 (full right). Default is 0 (center)

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
Parameters:
mute - true will mute, false will unmute

isMuted

public boolean isMuted()
Description copied from interface: PlayableAudio
Get mute status.

Specified by:
isMuted in interface PlayableAudio
Returns:
boolean true if muted, false if not

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

isDone

public boolean isDone()
Returns true if object is finished playing.

Specified by:
isDone in interface Playable
Specified by:
isDone in interface PlayableMedia

stopPlaying

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

Specified by:
stopPlaying in interface PlayableMedia

setTranspose

public 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.

Specified by:
setTranspose in interface PlayableAudio
Parameters:
semitones - range -12 to 12

getTranspose

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

Specified by:
getTranspose in interface PlayableAudio
Returns:
int semitones

setTuning

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

Specified by:
setTuning in interface PlayableAudio
Parameters:
cents - 1200 is down an octave, -1200 is up an octave

getTuning

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

Specified by:
getTuning in interface PlayableAudio
Returns:
int 1200 is down an octave, -1200 is up an octave

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)
Start object at an offset.

Parameters:
startOffset - offset in milliseconds.

stop

public void stop()
Will stop the object and reset to begining.

Specified by:
stop in interface Playable