I wrote a WPF application that captures the display and sound from a TV card using C # code. I can get the display from the TV card, but I can not get the sound from the TV card. BTW, I am using the .NET framework 3.5 with Visual Studio 2010. My question is: how can I get sound from a TV card?
Finally, I tried something like below using the DirectX DirectSound library. However, I received the following errors.
- The best overloaded method matching 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'
the 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); }
source share