Methods Summary |
---|
public boolean | clearQueue()Empties the segment queue, and clears all clips that are scheduled for playback.
return native_clearQueue();
|
public java.lang.Object | clone()Cloning a JetPlayer instance is not supported. Calling clone() will generate an exception.
// JetPlayer is a singleton class,
// so you can't clone a JetPlayer instance
throw new CloneNotSupportedException();
|
public boolean | closeJetFile()Closes the resource containing the JET content.
return native_closeJetFile();
|
protected void | finalize()
native_finalize();
|
public static android.media.JetPlayer | getJetPlayer()Factory method for the JetPlayer class.
if (singletonRef == null) {
singletonRef = new JetPlayer();
}
return singletonRef;
|
public static int | getMaxTracks()Returns the maximum number of simultaneous MIDI tracks supported by JetPlayer
return JetPlayer.MAXTRACKS;
|
public boolean | loadJetFile(java.lang.String path)Loads a .jet file from a given path.
return native_loadJetFromFile(path);
|
public boolean | loadJetFile(android.content.res.AssetFileDescriptor afd)Loads a .jet file from an asset file descriptor.
long len = afd.getLength();
if (len < 0) {
throw new AndroidRuntimeException("no length for fd");
}
return native_loadJetFromFileD(
afd.getFileDescriptor(), afd.getStartOffset(), len);
|
private static void | logd(java.lang.String msg)
Log.d(TAG, "[ android.media.JetPlayer ] " + msg);
|
private static void | loge(java.lang.String msg)
Log.e(TAG, "[ android.media.JetPlayer ] " + msg);
|
private final native boolean | native_clearQueue()
|
private final native boolean | native_closeJetFile()
|
private final native void | native_finalize()
|
private final native boolean | native_loadJetFromFile(java.lang.String pathToJetFile)
|
private final native boolean | native_loadJetFromFileD(java.io.FileDescriptor fd, long offset, long len)
|
private final native boolean | native_pauseJet()
|
private final native boolean | native_playJet()
|
private final native boolean | native_queueJetSegment(int segmentNum, int libNum, int repeatCount, int transpose, int muteFlags, byte userID)
|
private final native boolean | native_queueJetSegmentMuteArray(int segmentNum, int libNum, int repeatCount, int transpose, boolean[] muteArray, byte userID)
|
private final native void | native_release()
|
private final native boolean | native_setMuteArray(boolean[] muteArray, boolean sync)
|
private final native boolean | native_setMuteFlag(int trackId, boolean muteFlag, boolean sync)
|
private final native boolean | native_setMuteFlags(int muteFlags, boolean sync)
|
private final native boolean | native_setup(java.lang.Object Jet_this, int maxTracks, int trackBufferSize)
|
private final native boolean | native_triggerClip(int clipId)
|
public boolean | pause()Pauses the playback of the JET segment queue.
return native_pauseJet();
|
public boolean | play()Starts playing the JET segment queue.
return native_playJet();
|
private static void | postEventFromNative(java.lang.Object jetplayer_ref, int what, int arg1, int arg2)
//logd("Event posted from the native side: event="+ what + " args="+ arg1+" "+arg2);
JetPlayer jet = (JetPlayer)((WeakReference)jetplayer_ref).get();
if ((jet != null) && (jet.mEventHandler != null)) {
Message m =
jet.mEventHandler.obtainMessage(what, arg1, arg2, null);
jet.mEventHandler.sendMessage(m);
}
|
public boolean | queueJetSegment(int segmentNum, int libNum, int repeatCount, int transpose, int muteFlags, byte userID)Queues the specified segment in the JET queue.
return native_queueJetSegment(segmentNum, libNum, repeatCount,
transpose, muteFlags, userID);
|
public boolean | queueJetSegmentMuteArray(int segmentNum, int libNum, int repeatCount, int transpose, boolean[] muteArray, byte userID)Queues the specified segment in the JET queue.
if (muteArray.length != JetPlayer.getMaxTracks()) {
return false;
}
return native_queueJetSegmentMuteArray(segmentNum, libNum, repeatCount,
transpose, muteArray, userID);
|
public void | release()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().
native_release();
singletonRef = null;
|
public void | setEventListener(android.media.JetPlayer$OnJetEventListener listener)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.
setEventListener(listener, null);
|
public void | setEventListener(android.media.JetPlayer$OnJetEventListener listener, android.os.Handler handler)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.
synchronized(mEventListenerLock) {
mJetEventListener = listener;
if (listener != null) {
if (handler != null) {
mEventHandler = new NativeEventHandler(this, handler.getLooper());
} else {
// no given handler, use the looper the AudioTrack was created in
mEventHandler = new NativeEventHandler(this, mInitializationLooper);
}
} else {
mEventHandler = null;
}
}
|
public boolean | setMuteArray(boolean[] muteArray, boolean sync)Modifies the mute flags for the current active segment.
if(muteArray.length != JetPlayer.getMaxTracks())
return false;
return native_setMuteArray(muteArray, sync);
|
public boolean | setMuteFlag(int trackId, boolean muteFlag, boolean sync)Mutes or unmutes a single track.
return native_setMuteFlag(trackId, muteFlag, sync);
|
public boolean | setMuteFlags(int muteFlags, boolean sync)Modifies the mute flags.
return native_setMuteFlags(muteFlags, sync);
|
public boolean | triggerClip(int clipId)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.
return native_triggerClip(clipId);
|