Click here to Skip to main content
15,917,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We're using an embedded AxWMPLib.AxWindowsMediaPlayer to play various audio
files in our application (C# code). I'd like to change, programmatically,
the destination speakers (output audio device). I can't find any code to
accomplish this. I've searched high and low. Nothing tells me how to select
and/or change the speakers for audio output. Yet the standard Windows Media
Player in Windows XP certainly can change audio devices quite readily via
Tools / Options.
(i don't want to change the default sound card , only to change it for the this instance of WMP)
Can someone show me the light on how to change speakers, in C# code?
Thank you!!!
Posted
Comments
Sergey Alexandrovich Kryukov 17-May-11 16:18pm    
I understand the question. This is system setting, not related to your application.
Anyway, good to know how to do it...
--SA

1 solution

This problem is one I have hit several times and you can search as much as you want, using the AxWindowsMediaPlayer or WindowsMediaPlayerClass or anything similar, it cannot be done. I have tried many times to find such a feature. However, you should take a look at the following three things:

1) http://www.asio4all.com/[^] - ASIO4ALL is software that will run on many hardware devices and allows easy interfacing to hardware. It is what I have used previously to solve the issue of not being able to select devices. It is also far more powerful a tool for sound engineering in general.

2) To use ASIO4ALL I used NAudio. It is a very good, comprehensive library that allows MP3, Wave, Ogg and other formats to be played using ASIO. You also get very low level control over the sound - individual bit and bytes if you really fancy it - but it provides high level facilities as well. http://naudio.codeplex.com/[^] (You should also note that it comes with UI controls as well for things like Wave Form Rendering - while NAudio takes a little bit of effort to use at first, it is very powerful once you get it working :) Oh and it's an ongoing development so should remain up-to-date :) )

3) I would suggest having a look at my article in which I create a wrapper for the WindowsMediaPlayer class. I easily adapted this to use the ASIO4ALL player. Media Player Class[^]

Hope this helps,

Ed :)

P.S. If you get stuck with NAudio, contact me and I can provide good samples of what I have done, but they are too much for this answer ;P
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900