DirectSound and DirectShow are two different APIs. There is no direct adding of DirectSound objects into DirectShow filter graphs and hence your inability to do impossible.
There are two ways to address the problem: you either insist that you already hold an IDirectSound
interface pointer and you want to use it within DirectShow. In this case you have to implement a custom audio renderer filter, which will be backed by this DirectSound interface and your renderer will forward all audio to the device of your interest. You don't really want to go this way. In particular, you won't be able to implement this in C# only.
And the second way is to find an existing DirectShow audio renderer, which is using the device of your interest. Then use it and it will play through the same DirectSound device, just not exactly the pointer you had on your hands in first place.
More details on the second approach. DirectShow has a special category where all audio renderers are listed: CLSID_AudioRendererCategory
. Enumerating filters there, you enumerate instances of DirectSound Renderer Filter
created for every existing device.
This filter acts as a wrapper for an audio device. To enumerate the audio devices available on the user's system, use the ICreateDevEnum interface with the audio renderer category (CLSID_AudioRendererCategory). For each audio device, the audio renderer category contains two filter instances. One of these corresponds to the DirectSound Renderer, and the other corresponds to the Audio Renderer (WaveOut) filter. The DirectSound instance has the friendly name "DirectSound: DeviceName," where DeviceName is the name of the device. The WaveOut instance has the friendly name DeviceName.
You can find the right device there, and you then you can use this filter as a regular audio renderer (that is, you add it to your graph, you connect it there). The filter does not however expose IDirectSound
pointer it is using internally.