Created
March 21, 2017 13:32
-
-
Save sigmadeltasoftware/319560fc45437dcea82f047a65743d86 to your computer and use it in GitHub Desktop.
Android Low-Latency Audio Post-Processing with Superpowered - AudioPlayer Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
... | |
private class EffectAudioTrack extends AudioTrack { | |
public EffectAudioTrack(int streamType, int sampleRateInHz, int channelConfig, int audioFormat, int bufferSizeInBytes, int mode) throws IllegalArgumentException { | |
super(streamType, sampleRateInHz, channelConfig, audioFormat, bufferSizeInBytes, mode); | |
} | |
public EffectAudioTrack(int streamType, int sampleRateInHz, int channelConfig, int audioFormat, int bufferSizeInBytes, int mode, int sessionId) throws IllegalArgumentException { | |
super(streamType, sampleRateInHz, channelConfig, audioFormat, bufferSizeInBytes, mode, sessionId); | |
} | |
public EffectAudioTrack(AudioAttributes attributes, AudioFormat format, int bufferSizeInBytes, int mode, int sessionId) throws IllegalArgumentException { | |
super(attributes, format, bufferSizeInBytes, mode, sessionId); | |
} | |
@Override | |
public int write(@NonNull ByteBuffer audioData, int sizeInBytes, int writeMode) { | |
renderEffectNative(audioData, audioProps.getNrChannels()); | |
return super.write(audioData, sizeInBytes, writeMode); | |
} | |
} | |
private native void renderEffectNative(ByteBuffer data, int channelCount); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment