我想要录制现场音频并播放它.就UI而言,应用程序只有三个按钮:一个用于开始录制和流式传输,一个用于播放预录制文件,最后一个用于停止当前任务(录制/播放).为此,我分别使用AudioRecord和AudioTrack类进行录制和播放.我的程序看起来像....
/***@author amit**/
public class AudioRecorder extends Activity {
private String LOG_TAG = null;
/* variables which are required to generate and manage the UI of the App */
// private RecordButton mRecordButton = null;
private Button recordBtn, stopBtn, playBtn;
/*
* variables which are required for the actual functioning of the recording
* and playing
*/
private AudioRecord recorder = null;
private AudioTrack player = null;
private AudioManager audioManager = null;
private int recorderBufSize, recordingSampleRate; …Run Code Online (Sandbox Code Playgroud)