translate AudioPlayer into English

translate AudioPlayer into English
pull/112/head
xufulong 5 years ago
parent b80c7bfb11
commit 2f5f77703e
  1. 25
      app/src/main/java/com/frank/ffmpeg/AudioPlayer.java

@ -5,7 +5,7 @@ import android.media.AudioManager;
import android.media.AudioTrack;
/**
* 音频播放器
* AudioPlayer: use AudioTrack and OpenSL ES to play audio
* Created by frank on 2018/2/1.
*/
@ -13,11 +13,13 @@ public class AudioPlayer {
static {
System.loadLibrary("media-handle");
}
//调用AudioTrack播放
//using AudioTrack to play
public native void play(String audioPath);
//调用OpenSL ES播放
//using OpenSL ES to play
public native void playAudio(String audioPath);
//调用OpenSL ES播放
public native void stop();
public native static void lameInitDefault();
@ -39,19 +41,20 @@ public class AudioPlayer {
public native static void lameClose();
/**
* 创建一个AudioTrack对象
* @param sampleRate 采样率
* @param channels 声道布局
* Create an AudioTrack instance for JNI call
*
* @param sampleRate sampleRate
* @param channels channel layout
* @return AudioTrack
*/
public AudioTrack createAudioTrack(int sampleRate, int channels){
public AudioTrack createAudioTrack(int sampleRate, int channels) {
int audioFormat = AudioFormat.ENCODING_PCM_16BIT;
int channelConfig;
if(channels == 1){
if (channels == 1) {
channelConfig = AudioFormat.CHANNEL_OUT_MONO;
}else if(channels == 2){
} else if (channels == 2) {
channelConfig = AudioFormat.CHANNEL_OUT_STEREO;
}else{
} else {
channelConfig = AudioFormat.CHANNEL_OUT_STEREO;
}

Loading…
Cancel
Save