A commonly requested feature is the ability to switch audio to play through a Bluetooth headset device. Mobile In The Hand 4.0 brings this functionality to .NET Compact Framework developers allowing you to play any device audio through a paired headset device. It also includes classes to playback sounds too.
The AudioGateway sample application which ships with the library contains the functionality to playback a sound file and toggle between the device speaker and a headset. The code to perform the switch is incredibly simple:-
private BluetoothAudioGateway bag = new BluetoothAudioGateway();
The BluetoothAudioGateway exists in the InTheHand.WindowsMobile.Media namespace. A CheckBox control toggles the output using the following code:-
private void chkGateway_CheckStateChanged(object sender, EventArgs e)
OpenAudio opens the connection to the headset and sends audio output to it. CloseAudio closes the connection and returns output to the built in speaker. The SoundPlayer class is used to play back a sound file:-
InTheHand.Media. SoundPlayer sp = new InTheHand.Media.SoundPlayer(txtFilename.Text);
A full online library of class documentation for all this and more is available. For more information about Mobile In The Hand see the product page.