VariableSpeedNativepublic class VariableSpeedNative extends Object Provides all the native calls through to the underlying audio library.
You should not use this class directly. Prefer to use the {@link VariableSpeed}
class instead. |
Methods Summary |
---|
static native int | getCurrentPosition()
| static native int | getTotalDuration()
| static void | initializeEngine(EngineParameters params)
initializeEngine(params.getTargetFrames(),
params.getWindowDuration(), params.getWindowOverlapDuration(),
params.getMaxPlayBufferCount(), params.getInitialRate(),
params.getDecodeBufferInitialSize(), params.getDecodeBufferMaxSize(),
params.getStartPositionMillis(), params.getAudioStreamType());
| private static native void | initializeEngine(int targetFrames, float windowDuration, float windowOverlapDuration, int maxPlayBufferCount, float initialRate, int decodeBufferInitialSize, int decodeBufferMaxSize, int startPositionMillis, int audioStreamType)
| static void | loadLibrary()
System.loadLibrary("variablespeed");
| static native void | playFileDescriptor(int fd, long offset, long length)
| static boolean | playFromContext(android.content.Context context, android.net.Uri uri)
AssetFileDescriptor afd = context.getContentResolver().openAssetFileDescriptor(uri, "r");
try {
FileDescriptor fileDescriptor = afd.getFileDescriptor();
Field descriptorField = fileDescriptor.getClass().getDeclaredField("descriptor");
descriptorField.setAccessible(true);
int fd = descriptorField.getInt(fileDescriptor);
VariableSpeedNative.playFileDescriptor(fd, afd.getStartOffset(), afd.getLength());
return true;
} catch (SecurityException e) {
// Fall through.
} catch (NoSuchFieldException e) {
// Fall through.
} catch (IllegalArgumentException e) {
// Fall through.
} catch (IllegalAccessException e) {
// Fall through.
} finally {
MoreCloseables.closeQuietly(afd);
}
return false;
| static native void | playUri(java.lang.String uri)
| static native void | setVariableSpeed(float speed)
| static native void | shutdownEngine()
| static native void | startPlayback()
| static native void | stopPlayback()
|
|