1

SKype4Comを使用していますが、wavファイルを再生するたびに、マイクに戻ることができないようです。文字通り通話を終了し、マイクを再び使用するために電話をかけ直す必要があります。ここにいくつかのコードがあります:

DeviceType = TCallIoDeviceType.callIoDeviceTypeFile
var filename = Path.GetTempFileName();
using (this.Speak = new SpeechSynthesizer())
{
    this.Speak.SetOutputToWaveFile(
        filename,
        new System.Speech.AudioFormat.SpeechAudioFormatInfo(
            16000,
            System.Speech.AudioFormat.AudioBitsPerSample.Sixteen,
            System.Speech.AudioFormat.AudioChannel.Mono));
    this.Speak.Speak(reply);
    this.Speak.SetOutputToDefaultAudioDevice();
    this.Speak.Speak(reply);
    CurrentCall.set_InputDevice(DeviceType, filename);
    this.skype.SendMessage(pMessage.FromHandle, reply);
    this.Speak.SetOutputToNull();
    this.Speak.Dispose();
    CurrentCall.set_InputDevice(DeviceType,"");
}
CurrentCall.set_InputDevice(TCallIoDeviceType.callIoDeviceTypeSoundcard, "default");
Dispatcher.Invoke(new Action(() =>
    {
        tb1.Text += "sound card: ";
        tb1.Text += CurrentCall.get_InputDevice(TCallIoDeviceType.callIoDeviceTypeSoundcard);
        tb1.Text += Environment.NewLine;
        tb1.Text += "port: ";
        tb1.Text += CurrentCall.get_InputDevice(TCallIoDeviceType.callIoDeviceTypePort);
        tb1.Text += Environment.NewLine;
        tb1.Text += "file: ";
        tb1.Text += CurrentCall.get_InputDevice(TCallIoDeviceType.callIoDeviceTypeFile);
        tb1.Text += Environment.NewLine;
    }));
}

これを機能させる方法はありますか?自動車が終わった後、私はただ永遠に沈黙を聞きます。

4

2 に答える 2

0

再生中のファイルがまだビジーかどうかを確認できます。

do
{
    System.Threading.Thread.Sleep(1000);
} while (IsBusy(filename));
CurrentCall.set_InputDevice(DeviceType,"");

IsBusyメソッドは次のように宣言されます。

public bool IsBusy(string filePath)
{
    try
    {
        using (FileStream stream = File.OpenWrite(filePath))
        {
            stream.Close();
            return false;
        }
    }
    catch (IOException)
    {
        return true;
    }
}
于 2013-01-10T11:14:18.717 に答える
0

tcpを使用してSkypeにオーディオを入れる方法があるので、代わりにそれを行いました。

于 2013-05-19T01:56:40.200 に答える