Closed nacgarg closed 2 years ago
@LinusU @nacgarg could we get a review on this? There are many uses where the default device isn't the appropriate device to use and the user needs the ability to select the desired output device. Not having the ability to change the output device makes this package unusable for these use cases.
@LinusU is there someone else we should tag to take a look at this change? Are changes like this still being accepted to this project? Or should I create and publish a fork if I need this behavior?
@daytonellwanger Wow, I just realized it's been over a year without any response from the maintainers, so I appreciate you bumping this PR. I'd welcome any feedback about this change and will fix any issues that come up so that we can get this merged in. In the meantime, I've been using my fork with npm by adding "speaker": "https://github.com/nacgarg/node-speaker"
to package.json
.
Sorry for the very long delay here. I cannot personally test this, but I will merge and release this since it seems that multiple people have reacted positively to this PR, and since the code looks straight forward enough.
Released as 🚢 0.5.4 / 2022-03-16!
Again, sorry for the delay 🙏
Thanks @LinusU ! Much appreciated 🙏
Previously, the win32 output module would always use the default output device (
WAVE_MAPPER
). To support selecting non-default output devices, this PR will enumerate all output devices and pick the device with the same name asao->device
. The name comes from the szPname field in WAVEOUTCAPS which is limited to 32 characters (including null sentinel). This means that to select an audio device such asSpeakers (High Definition Audio Device)
,ao->device
must be truncated to the first 31 characters of that followed by the null byte.