Closed lerdmann closed 1 year ago
Just as a note since this is what we found out when updating SDL2: the default audio device can always be selected when you open a device via device type id and a device number of 0 (in parameter "pszDeviceType"). This is true, regardless if a device has been specifically selected as a default (via additional entries in MMPM2.INI) or not (in the latter case, MMPM2 will pick the first device in the device list of that device type).
How about adding set KAI_NOSOFTMIXER=1
to config.sys ?
What does that do ? How does that influence selection of the default device ? Where is that documented ?
It's an option for libkai not for ksoftseq itself, and it disables soft mixer mode of libkai. See https://github.com/komh/kai/blob/master/libkai.txt.
If soft mixer mode is disabled, libkai communicates with DART APIs directly, then this problem may be solved.
Yes, that fixes the problem, thank you very much for that information. I still do not understand how the soft mixer comes into play. Why is that needed at all ? I certainly cannot mix multiple sound streams. Only one Midi file can ever be selected. Can the soft mixer (in libkai) be made to honour the default device selection ?
The soft mixer is used to mix multiple streams when a sound card or a driver does not support to play multiple streams simultaneously. In case of ksoftseq, it may support to play multiple midi files although it's not working yet.
The soft mixer should consider the default device selection. However, currently it converts a default index to a real index manually at init because I didn't consider sound cards may be inserted and/or removed dynamically. Of course, converting a default index to a real index dynamically when opening a device may improve this situation. I'm considering this way although it has a few problems to solve.
And I want to know that indexes of audio devices may change when an audio card is inserted and/or removed. Would you mind helping this?
Indexes of audio cards (or rather: audio drivers) will never change because drivers are loaded statically on system start by OS/2.
It is very simple: the list of say waveaudio devices in MMPM2.INI can be read from left to right: mostleft = 1, next to mostleft = 2 etc., example from MMPM2.INI:
[Drivers] Digitalvideo=IBMDIGVIDPLAYER01,IBMMPEGPLAYER01 Speaker=SPEAKER Headphone=HEADPHONE Microphone=MICROPHONE Filter=IBMFILTER01,IBMFILTER02,IBMFILTER03 Waveaudio=UNIAUDWAVE01,WMBWAVEUSB01,WMBWAVE2USB01 Ampmix=UNIAUDAMPMIX01,WMBAMPMIXUSB01,WMBAMPMIX2USB01 CDaudio=IBMCDAUDIO01,IBMCDAUDIO02 Sequencer=KSOFTSEQ01
So, UNIAUDWAVE01 would be device with index = 1, WMBWAVEUSB01 would be device with index = 2, WMBWAVE2USB01 would be device with index = 3
UNIAUDWAVE01 would also be device with index = 0 because it is the default device as it appears first in the list, unless you find this section in MMPM2.INI:
[defaultnames] Digitalvideo=IBMDIGVIDPLAYER01 Waveaudio=WMBWAVEUSB01 Ampmix=WMBAMPMIXUSB01 Sequencer=KSOFTSEQ01
in which case the default wave device (device index = 0) would be WMBWAVEUSB01.
In short: if you always want to use the "default device" (you do not want to involve the user in selecting a specific device), you can always go with device index = 0.
Good!
And there are more things I want to know. So I wrote a simple test program. Attach the output of the following program, please.
Thanks!
Great!
I could know that
In case of 4., I want to know whether or not indexes of audio devices are reordered if an audio device with a lower index is removed. And I could guess it will not.
I'll try to fix this problem, soon.
Thanks a lot!
Test, please...
Yes, that works as expected. I can now swap back and forth between UNIAUD and USB audio and the sound will always play on the default device selected. And the good news is: it also works without setting KAI_NOSOFTMIXER at all. Thank you very much !
Good!
Working without KAI_NOSOFTMIXER was the purpose.
Thanks for your help!!!
ksoftseq seems to have some problems in finding the default audio device: If I play via USB first and then, I switch the default device (I am delivering a utility with the USB audio drivers that does that and AN has also their own solution to switch the default audio device), I cannot switch to UNIAUD: if I do, ksoftseq will still continue to play on the USB device, if I remove the USB audio device, ksoftseq will refuse to play even if have switched over the default audio device to UNIAUD.