私はsoxをc#programのprocessを呼び出して使用しています。私はWaitForExitやStartメソッドにぶら下がっていることはよく知られていますが、私はそれに対処できません。あなたは、標準出力が非同期に処理されますが、まだプログラムはタイムアウトが設定されている場合でもWaitForExit(でハング見ることができるようにSoxを使用して標準出力にプッシュするときにWaitForExitでプロセスがハングアップする
using (Process process = new Process())
{
process.StartInfo.FileName = _soxExePath;
process.StartInfo.Arguments = _task.Arguments.RemoveFirstOccurence("sox");
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
StringBuilder output = new StringBuilder();
StringBuilder error = new StringBuilder();
using (AutoResetEvent outputWaitHandle = new AutoResetEvent(false))
using (AutoResetEvent errorWaitHandle = new AutoResetEvent(false))
{
process.OutputDataReceived += (sender, e) =>
{
if (e.Data == null)
{
outputWaitHandle.Set();
}
else
{
output.AppendLine(e.Data);
}
};
process.ErrorDataReceived += (sender, e) =>
{
if (e.Data == null)
{
errorWaitHandle.Set();
}
else
{
error.AppendLine(e.Data);
}
};
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
if (process.WaitForExit(timeout) &&
outputWaitHandle.WaitOne(timeout) &&
errorWaitHandle.WaitOne(timeout))
{
result = process.ExitCode == 0;
}
else
{
// Timed out.
}
}
}
:たぶん私はthis topicで最高の定格の答えから&ペーストをコピーしている(プロセスを実行するためのコードreponsibleからスタート私は、WindowsのCMD処理にまったく同じコマンドを入力すると、それは大きな操作ではありませんので)100000まで。秒未満かかります。
sox --combine mix 1.wav 2.wav 3.wav -p | sox - --combine concatenate 4.wav output.wav << causing problem
私はそれがstdoutに最初の操作を作成しているソックスによって引き起こされる知っています。すぐにファイルに保存するコマンドを試しても問題ありません。
sox --combine mix 1.wav 2.wav 3.wav output.wav << no problem
soxプログラムからのログはありますか? –