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.
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.