RandomAccessFile 클래스를 이용해서 파일을 오픈한후에 seekbar를 건드리지않으면
정상적으로 소리가나오는데 seekbar를 건드려서 재생위치를 변경시에 지직거리는 소리나 심한 잡음이 들립니다.
어떠한 때는 또 잘작동이되더군요. 혹시 문제점 아시는분 조언좀 부탁드립니다^^ 데이터 처리하는 부분은 노란색 처리했습니다.
mPlaySeekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
// TODO Auto-generated method stub
playbackPosition = progress;
System.out.println("test progress : "+playbackPosition);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "off", Toast.LENGTH_SHORT).show();
seekTo = true;
//playbackPosition = mPlaySeekbar.getProgress();
//audioTrack.flush();
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
if (audioTrack != null) {
//audioTrack = null;
//dis = null;
audioTrack.flush();
//playbackPosition = testtime;
seekTo = false;
Toast.makeText(getApplicationContext(), "on", Toast.LENGTH_SHORT).show();
int min = startTimeCount / 60;
int sec = startTimeCount % 60;
String strTime = String.format("%02d : %02d", min, sec);
// TODO Auto-generated method stub
mStartTime.setText(strTime);
}
}
});
/* if ((endPosition - playPosition) < bufferSize){
playPosition = 0;
System.arraycopy(wavIoData, playPosition, audioout, 0, bufferSize);
playPosition += bufferSize;
}
if (isVoiceCath)
{
Log.d("Play Mode", "Algo on");
System.out.println(isAlgoMax);
mTest2 = VMWProcess.PlayProcess(audioout, isAlgoMax);
}*/
try {
if(seekTo == true){
dis.seek(playbackPosition);
}
readLen = dis.read(audioout);
System.out.println("test read 2222 : "+dis.getFilePointer());
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
audioTrack.write(audioout, 0, readLen);
System.out.println("test track 1111 : "+audioTrack.getPlaybackHeadPosition());