0
휴대 전화의 오디오 인터페이스에서 데이터를 기록하려고합니다. audiorecord 기능을 사용했습니다.휴대 전화의 오디오 잭에서 데이터 기록
공개 무효 초기화() {
buffersizebytes = AudioRecord.getMinBufferSize(SAMPPERSEC,channelConfiguration, audioEncoding); // 4096 on ion
buffer = new short[buffersizebytes];
buflen = buffersizebytes/2;
audioRecord = new AudioRecord(
android.media.MediaRecorder.AudioSource.MIC, SAMPPERSEC,
channelConfiguration, audioEncoding, buffersizebytes);
acquire();
for(int i=0; i<4096; i++) buffer[i]=1;
} 나는 4096 바이트의 버퍼로 내 획득 한 데이터를 넣을
public void acquire() {
try {
audioRecord.startRecording();
mSamplesRead = audioRecord.read(buffer, 0, buffersizebytes);
audioRecord.stop();
} catch (Throwable t) {
// Log.e("AudioRecord", "Recording Failed");
}
}
: 다음은 내 코드입니다. 그러나 내 프로그램은 데이터를 1024 바이트로만 저장합니다. 또한 처음 432 바이트도 0입니다. 그러나 나는 지속적으로 데이터를 보내고있다. 무엇이 문제 일 수 있습니까?
나는이 줄을 이해할 수 없다. (int i = 0; i <4096; i ++) buffer [i] = 1;' – Vincent
4096 대신 buflen을 사용하지 않는다. – Vincent