I want to use a USB speaker.
I succeeded in reproducing the audio from the USB speaker by invalidating the registry value according to the procedure here.
Instead of disabling the libnvwavedev.dll, you can also make the USB speaker your default audio device with a small piece of code.
The device ID is defined by the load order. The internal wave driver is loaded first, making it audio device 0. The USB speaker is loaded later, as audio device 1.
void SwapDefaultAudioDevice()
{
WAVEOUTCAPS woCaps;
DWORD numDevs;
MMRESULT res;
DWORD wParam = 1; //OrigDeviceId
DWORD lParam = 0; //NewDeviceId
// Swap waveOut device 0 <-> 1
res = waveOutMessage(0, DRVM_MAPPER_PREFERRED_SET, wParam, lParam);
// Query number of audio devices
numDevs = waveOutGetNumDevs();
// Get Info about device 0 (the default playback device)
res = waveOutGetDevCaps(0, &woCaps, sizeof(woCaps));
}
After executing this code once, all system sounds are played on your USB speaker. Running it a second time makes the system sounds play on the analog audio device again.
However, the situation for playing MP3 audio and MP4 videos is more difficult. Our BSP contains Nvidia audio/video decoders which use hardware acceleration and play sounds not through the system audio mapper, but directly to the analog audio output.
There’s two optionsto get around this:
Disable all hardware acceleration and use software codecs.
This might be acceptable for low-resolution videos.
In our old BSP, we had a special Nvidia audio router that could be used with the hardware-accelerated codecs. It had some drawbacks and did not work properly for all use cases. If you want to play all your sound exclusively through the USB speaker, it should work.
Please let me know some more details about the requirements of your final system, then I can get into more details.
Thank you for explaining in detail.
I understood that the sample code is the way to output only the system sound from the USB speaker.
The problem we want to solve is that the noise will be added to the analog output by the combination of Apalis T30 and Ixora so we want to be able to output all sounds such as system sound and movie sound from the USB speaker.
Detailed system requirements are as follows.
· Apalis T30 and Ixora
· LVDS output screen
· Screen resolution is 1366 x 768
· The resolution of the movie is 480p ~ 720p
· Movie shooting with USB camera (It is not directly related to this post · · ·)
We think that it is difficult in terms of performance to disable hardware acceleration and use software codecs.
By using “special Nvidia audio router” that you taught, will you be able to output all sounds from the USB speaker?
Will it also be available on the latest BSP?
This audiorouter copies all audio samples from the device “WAV1” and outputs them to the
device OutputWaveDevice.
By default, device#0 is the analog audio channel, device#1 is your USB speaker.
MP4 and system sounds should be both be played through USB.
Please verify that you didn’t do any other registry setting. I did the following steps to assure this:
Run the installer AudiorouterInstaller_CE7.cab with default settings
Reboot
Already the startup sound is played on the USB speaker.
The volume control affects the default audio device only. You need to execute the SwapDefaultAudioDevice() function from my first answer. After this, the volume control will change the USB speaker volume.