【发布时间】:2012-06-20 13:11:18
【问题描述】:
我使用 AudioRecorder 录制了音频。我需要将录制的文件合并到一个文件中。任何建议。
getAudioPath() -- 音频文件的路径。 getCombineFile()---组合文件的路径。我的问题是单独播放第一个文件,而不是该目录中的整个文件
public void readAudioAsStream()
{
getAudioPath();
File f=null;
FileInputStream ins = null;
ReadSDDatas rds=new ReadSDDatas();
try
{
String comfile=rds.getCombineFile();
//FileOutputStream fos=new FileOutputStream(comfile);
Log.d("combined file",comfile);
File file=new File(comfile);
RandomAccessFile raf = new RandomAccessFile(file, "rw");
Log.d("path size",Integer.toString(audFullPath.size()));
for(int i=0;i<audFullPath.size();i++)
{
String filepath=audFullPath.get(i);
Log.d("Filepath",filepath);
f=new File(audFullPath.get(i));
fileContent = new byte[read];
ins=new FileInputStream(audFullPath.get(i));
int numofbytes=ins.read(fileContent);
System.out.println("Number Of Bytes Read===========>>>"+numofbytes);
raf.seek(file.length());
raf.write(fileContent);
}
}
catch (FileNotFoundException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
/*String path=audFullPath.get(val);
playAudio(path);*/
playAudio();
/*
for(int i=0;i<audFullPath.size();i++)
{
Log.d("fullpathsize",Integer.toString(audFullPath.size()));
playAudio(audFullPath.get(i));
}*/
}
【问题讨论】:
-
合并是指按顺序制作一个文件,还是同时播放?
-
我想将它们作为单个文件按顺序播放,没有暂停