andrewrk / libsoundio

C library for cross-platform real-time audio input and output
http://libsound.io/
MIT License
1.92k stars 229 forks source link

Fix an issue SoundIo*Stream::name is not initialized by default value on some backends #210

Open mocabe opened 5 years ago

mocabe commented 5 years ago

Even though the document of SoundIoOutStream::name says it defaults to "SoundIoOutStream", some backends do not initialize it after soundio_outstream_open and leave it NULL if user does not provide optional value for it.

Currently, JACK and PulseAudio properly initialize it. Dummy, ALSA and CoreAudio don't.
WASAPI also does not initialize it and has null check for it.

This PR makes it always be initialized by default value on all backends.

mocabe commented 5 years ago

Dummy, ALSA and CoreAudio don't even read it so this shouldn't cause any problem.

Only WASAPI reads it when opening outstream and set the value as a name of stream. Tests and examples working fine as far as I've tested on WASAPI.

Edit: probably need to work on instream too.

mocabe commented 5 years ago

done.

wegylexy commented 4 years ago

If the process already has an audio output stream open, just leave it alone. You are overwriting the existing name in Volume Mixer. For example, plugins for games should not replace the name of the game to SoundIoOutStream just because the plugin plays a sound effect when the game is already playing background music. Worse is that it doesn't restore the name when the stream is closed while other streams are still open.

mocabe commented 4 years ago

@wegylexy Yeah, that might be more desirable behaviour for WASAPI, although API is not clear on behaviour iirc. Anyway, this library is pretty much unmaintained, so I will not spend more time on this PR at this point.

wegylexy commented 4 years ago

I think I better use Chromium or Electron for cross-platform audio.