Class of snx.android.media · Audio.java
public final class Audio
The runtime's audio (src/android/runtime/audio.c), which MediaPlayer and SoundPool play through: a source's bytes, read here, are decoded by FFmpeg, and one SDL audio stream mixes the voices. A voice is an ID: a sound's (which ends by itself) or a stream's (a player's, which stays paused at its end). A thread tells each watched voice's end.
public static final int PAUSE = 0 sourcepublic static final int RESUME = 1 sourcepublic static final int STOP = 2 sourcepublic static final int VOLUME = 3 sourcepublic static final int LOOPS = 4 sourcepublic static final int RATE = 5 sourcepublic static final int SEEK = 6 sourcepublic static native long nativeLoad(byte[] data) native sourcea sound decoded whole, 0 when the source holds no audio that the runtime decodes
public static native void nativeUnload(long sound) native sourcethe sound given up; the voices that play it keep it to their end
public static native int nativePlay(long sound, float left, float right, int loops, float rate) native sourcea voice of the sound, 0 when none plays: loops more plays after the first, -1 for ever
public static native int nativeOpen(byte[] data, long[] duration) native sourcea paused voice of a stream, decoded as it plays, and its length in milliseconds (-1 unknown) in duration[0]
public static native void nativeSet(int voice, int what, double x, double y) native sourcethe voice paused, resumed, stopped, its volumes (x, y), loops (x), rate (x) or position in milliseconds (x)
public static native long nativePosition(int voice, boolean[] completed) native sourcethe voice's position in milliseconds, -1 when it is gone: completed[0] tells once that it reached its end
public static void set(int voice, int what, double x, double y) sourcepublic static void set(int voice, int what) sourcepublic static float volume(float v) sourcepublic static byte[] read(InputStream in) throws IOException sourcepublic static byte[] read(String path) throws IOException sourcepublic static byte[] read(Context context, int resId) throws IOException sourcepublic static byte[] read(FileDescriptor fd, long offset, long length) throws IOException sourcelength bytes from offset (to the end for a negative or too large length), the descriptor left open
public static byte[] read(Context context, Uri uri) throws IOException sourcea file:, android.resource: or content: URI's bytes, or a path's
public static synchronized void watch(int voice, Runnable onEnd) sourceonEnd run (on the watcher's thread) each time the voice reaches its end, until the voice is gone or unwatched
public static synchronized void unwatch(int voice) sourceMade from ScarletNX's Sail at 166ad3910f80. The framework is ScarletNX's (GPL-3.0-or-later); the parts that follow the Android Open Source Project's sources (Apache-2.0) say so in their files.