I have written a WPF application which is capturing display and sound from TV Card from with through C# code. I can get the display from TV card, but I can't get any sound from TV Card. BTW, I'm using .NET framework 3.5 with Visual Studio 2010. My question is how can I get the sound from the TV card?
Lastly, I tried anything like below by using DirectSound library of DirectX. However, I got the following errors.
- 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'
to'System.Windows.Forms.Control'
Code:
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);
}