How to set StockAudioPlayer to specific device?

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

How to set StockAudioPlayer to specific device?

Postby abh » March 19th, 2013, 8:06 pm

The device property of StockAudioPlayer is read only. Is there a way to direct it to an audio output device other than the Windows default device (as set in Control Panel)?
abh
Active Member
Active Member
 
Posts: 12
Joined: August 24th, 2012, 10:49 pm

Re: How to set StockAudioPlayer to specific device?

Postby Kambiz » March 20th, 2013, 6:53 pm

The DeviceID is a read/write property.
Please check out the attached code.
Attachments
WavePlayer.zip
(3.17 KiB) Downloaded 66 times
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Re: How to set StockAudioPlayer to specific device?

Postby abh » March 21st, 2013, 11:32 am

Thank you! I knew I had to be missing something. :)
abh
Active Member
Active Member
 
Posts: 12
Joined: August 24th, 2012, 10:49 pm

Re: How to set StockAudioPlayer to specific device?

Postby abh » March 21st, 2013, 1:04 pm

The sample program doesn't seem to work for certain WAV files, in particular, GSM 6.10. It allows me to change the device ID, but when I attempt to play one of these files, I get an exception: "The specified format is not supported or cannot be translated. Use the Capabilities function to determine the supported formats."

In fact, the only device that plays these files is "Microsoft Sound Mapper" -- and it works correctly regardless of which physical device Microsoft Sound Mapper is currently pointing to. In other words, if I use Control Panel to set my default device to my USB Headset, then point the sample program at Microsoft Sound Mapper, it plays. If I set the sample program to "USB Headset Device", I get the above error. The same thing happens if I select my laptop's built in speakers -- they work if they're set as the default device, but throw this error if I select them from the output device list.

If I select a PCM format wave file, then I can select any of the devices from the device list, and they play without error.

Do you have any ideas why this is happening and what could be done to work around it? I can send a sample GSM 6.10 file if you'd like.

Thanks.
abh
Active Member
Active Member
 
Posts: 12
Joined: August 24th, 2012, 10:49 pm

Re: How to set StockAudioPlayer to specific device?

Postby Kambiz » March 21st, 2013, 7:03 pm

Most audio devices support only uncompressed audio data and of course only a subset of PCM formats. Windows sound mapper converts audio data before sending them to an audio device.

There is a "Live Convert" demo that you can use it as a guide line to convert GSM audio format to PCM on the fly.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 1 guest

cron