java.lang.Object | |
↳ | android.media.JetPlayer |
JetPlayer provides access to JET content playback and control.
Please refer to the JET Creator User Manual for a presentation of the JET interactive music concept and how to use the JetCreator tool to create content to be player by JetPlayer.
Use of the JetPlayer class is based around the playback of a number of JET segments sequentially added to a playback FIFO queue. The rendering of the MIDI content stored in each segment can be dynamically affected by two mechanisms:
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
JetPlayer.OnJetEventListener | Handles the notification when the JET engine generates an event. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Empties the segment queue, and clears all clips that are scheduled for playback.
| |||||||||||
Cloning a JetPlayer instance is not supported.
| |||||||||||
Closes the resource containing the JET content.
| |||||||||||
Factory method for the JetPlayer class.
| |||||||||||
Returns the maximum number of simultaneous MIDI tracks supported by JetPlayer
| |||||||||||
Loads a .jet file from a given path.
| |||||||||||
Loads a .jet file from an asset file descriptor.
| |||||||||||
Pauses the playback of the JET segment queue.
| |||||||||||
Starts playing the JET segment queue.
| |||||||||||
Queues the specified segment in the JET queue.
| |||||||||||
Queues the specified segment in the JET queue.
| |||||||||||
Stops the current JET playback, and releases all associated native resources.
| |||||||||||
Sets the listener JetPlayer notifies when a JET event is generated by the rendering and
playback engine.
| |||||||||||
Sets the listener JetPlayer notifies when a JET event is generated by the rendering and
playback engine.
| |||||||||||
Modifies the mute flags for the current active segment.
| |||||||||||
Mutes or unmutes a single track.
| |||||||||||
Modifies the mute flags.
| |||||||||||
Schedules the playback of a clip.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Is called before the object's memory is being reclaimed by the VM.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
Empties the segment queue, and clears all clips that are scheduled for playback.
Cloning a JetPlayer instance is not supported. Calling clone() will generate an exception.
CloneNotSupportedException |
---|
Closes the resource containing the JET content.
Factory method for the JetPlayer class.
Returns the maximum number of simultaneous MIDI tracks supported by JetPlayer
Loads a .jet file from a given path.
path | the path to the .jet file, for instance "/sdcard/mygame/music.jet". |
---|
Loads a .jet file from an asset file descriptor.
afd | the asset file descriptor. |
---|
Pauses the playback of the JET segment queue.
Starts playing the JET segment queue.
Queues the specified segment in the JET queue.
segmentNum | the identifier of the segment. |
---|---|
libNum | the index of the sound bank associated with the segment. Use -1 to indicate that no sound bank (DLS file) is associated with this segment, in which case JET will use the General MIDI library. |
repeatCount | the number of times the segment will be repeated. 0 means the segment will only play once. -1 means the segment will repeat indefinitely. |
transpose | the amount of pitch transposition. Set to 0 for normal playback. Range is -12 to +12. |
muteFlags | a bitmask to specify which MIDI tracks will be muted during playback. Bit 0 affects track 0, bit 1 affects track 1 etc. |
userID | a value specified by the application that uniquely identifies the segment. this value is received in the onJetUserIdUpdate(JetPlayer, int, int) event listener method. Normally, the application will keep a byte value that is incremented each time a new segment is queued up. This can be used to look up any special characteristics of that track including trigger clips and mute flags. |
Queues the specified segment in the JET queue.
segmentNum | the identifier of the segment. |
---|---|
libNum | the index of the soundbank associated with the segment. Use -1 to indicate that no sound bank (DLS file) is associated with this segment, in which case JET will use the General MIDI library. |
repeatCount | the number of times the segment will be repeated. 0 means the segment will only play once. -1 means the segment will repeat indefinitely. |
transpose | the amount of pitch transposition. Set to 0 for normal playback. Range is -12 to +12. |
muteArray | an array of booleans to specify which MIDI tracks will be muted during playback. The value at index 0 affects track 0, value at index 1 affects track 1 etc. The length of the array must be getMaxTracks() for the call to succeed. |
userID | a value specified by the application that uniquely identifies the segment. this value is received in the onJetUserIdUpdate(JetPlayer, int, int) event listener method. Normally, the application will keep a byte value that is incremented each time a new segment is queued up. This can be used to look up any special characteristics of that track including trigger clips and mute flags. |
Stops the current JET playback, and releases all associated native resources. The object can no longer be used and the reference should be set to null after a call to release().
Sets the listener JetPlayer notifies when a JET event is generated by the rendering and playback engine. Use this method to receive JET events in the Handler associated with another thread than the one in which you created the JetPlayer instance.
handler | the Handler that will receive the event notification messages. |
---|
Sets the listener JetPlayer notifies when a JET event is generated by the rendering and playback engine. Notifications will be received in the same thread as the one in which the JetPlayer instance was created.
Modifies the mute flags for the current active segment.
muteArray | an array of booleans to specify which MIDI tracks are muted. The value at index 0 affects track 0, value at index 1 affects track 1 etc. The length of the array must be getMaxTracks() for the call to succeed. |
---|---|
sync | if false, the new mute flags will be applied as soon as possible by the JET render and playback engine. If true, the mute flags will be updated at the start of the next segment. If the segment is repeated, the flags will take effect the next time segment is repeated. |
Mutes or unmutes a single track.
trackId | the index of the track to mute. |
---|---|
muteFlag | set to true to mute, false to unmute. |
sync | if false, the new mute flags will be applied as soon as possible by the JET render and playback engine. If true, the mute flag will be updated at the start of the next segment. If the segment is repeated, the flag will take effect the next time segment is repeated. |
Modifies the mute flags.
muteFlags | a bitmask to specify which MIDI tracks are muted. Bit 0 affects track 0, bit 1 affects track 1 etc. |
---|---|
sync | if false, the new mute flags will be applied as soon as possible by the JET render and playback engine. If true, the mute flags will be updated at the start of the next segment. If the segment is repeated, the flags will take effect the next time segment is repeated. |
Schedules the playback of a clip. This will automatically update the mute flags in sync with the JET Clip Marker (controller 103). The parameter clipID must be in the range of 0-63. After the call to triggerClip, when JET next encounters a controller event 103 with bits 0-5 of the value equal to clipID and bit 6 set to 1, it will automatically unmute the track containing the controller event. When JET encounters the complementary controller event 103 with bits 0-5 of the value equal to clipID and bit 6 set to 0, it will mute the track again.
clipId | the identifier of the clip to trigger. |
---|
Is called before the object's memory is being reclaimed by the VM. This can only happen once the VM has detected, during a run of the garbage collector, that the object is no longer reachable by any thread of the running application.
The method can be used to free system resources or perform other cleanup
before the object is garbage collected. The default implementation of the
method is empty, which is also expected by the VM, but subclasses can
override finalize()
as required. Uncaught exceptions which are
thrown during the execution of this method cause it to terminate
immediately but are otherwise ignored.
Note that the VM does guarantee that finalize()
is called at most
once for any object, but it doesn't guarantee when (if at all) finalize()
will be called. For example, object B's finalize()
can delay the execution of object A's finalize()
method and
therefore it can delay the reclamation of A's memory. To be safe, use a
ReferenceQueue, because it provides more control
over the way the VM deals with references during garbage collection.