我撰写了一份WPF申请,正在通过C#代码从电视卡中获取显示和声音。 我可以从电视卡接听节目,但我从电视卡听不到任何音响。 BTW, I m, using.NET framework 3.5 with Vision 2010。 我的问题是,我如何能够从电视卡获得音响?
最后,我利用直接X图书馆在下文尝试过任何类似情况。 然而,我有以下错误。
- The best overloaded method match for
Microsoft.DirectX.DirectSound.Device.SetCooperativeLevel(System.Windows.Forms.Control, Microsoft.DirectX.DirectSound.CooperativeLevel)
has some invalid arguments. - Argument 1: cannot convert from
Wpfvideo.MainWindow
toSystem.Windows.Forms.Control
法典:
private DS.Device soundDevice;
private SecondaryBuffer buffer;
private ArrayList soundlist = new ArrayList();
private void InitializeSound()
{
soundDevice = new DS.Device();
soundDevice.SetCooperativeLevel(this, CooperativeLevel.Priority);
BufferDescription description = new BufferDescription();
description.ControlEffects = false;
buffer = new SecondaryBuffer(CaptureDeviceName, description, soundDevice);
buffer.Play(0, BufferPlayFlags.Default);
SecondaryBuffer newshotsound = buffer.Clone(soundDevice);
newshotsound.Play(0, BufferPlayFlags.Default);
}