SoxController クラスの使用に問題がある。. SoxController Class のトリムオーディオ関数の例を教えてください。. .
1 に答える
0
これを試してみましょう。すでにテスト済みなので、あなたにぴったりだと思います。それはうまくいきます
/**
* Trim File Wave
*/
public class TrimFileWave extends AsyncTask<String, Void, Void> {
private ProgressDialogUtil progressDialogUtil;
private Context context;
public TrimFileWave(Context context) {
this.context = context;
progressDialogUtil = new ProgressDialogUtil(context, R.string.progressing);
}
@Override
protected void onPreExecute() {
progressDialogUtil.show();
}
@Override
protected Void doInBackground(String... params) {
startTrimFile();
return null;
}
@Override
protected void onPostExecute(Void unused) {
progressDialogUtil.dismiss();
}
private void startTrimFile() {
File fileAppRoot = new File(context.getApplicationInfo().dataDir);
try {
SoxController sxCon = new SoxController(context, fileAppRoot, new ShellUtils.ShellCallback() {
@Override
public void shellOut(String shellLine) {
DebugUtil.log(new Exception(), shellLine);
}
@Override
public void processComplete(int exitValue) {
DebugUtil.log(new Exception(), exitValue);
}
});
double length = sxCon.getLength(MyApplication.FILE_NAME_RECORDED_WAVE);
DebugUtil.log(new Exception(), "[length]" + length);
// sxCon.trimAudio(MyApplication.FILE_MERGE_WAVE, 0, length);
// Type {"q", "h", "t", "l", "p"}
sxCon.fadeAudio(MyApplication.FILE_MERGE_WAVE, "t", 0, length, 1);
}
catch (Exception e) {
DebugUtil.logInfo(new Exception(), e.toString());
}
}
}
于 2014-11-10T19:37:49.317 に答える