Closed Dragon-Baroque closed 2 years ago
About exult.cfg I'm tentatively against autofilling alsa_port and fluidsynth soundfont location. I think we don't add these tags by default on linux (or other OS), right?
So the autodetection is a great idea, but once these tags are in the cfg, their value shouldn't be overwritten IMO.
sigh I stillstrongly dislike the xml style of the cfg anyway ;)
It would make sense if we were to poll the ports and print which "devices" Exult finds at the ports. Same as being done for Windows Midi ports and Coremidi on macOS. And THEN autoselect the first available one if 65:0 (or the alsa_port setting) is not available.
I am actually tempted to maybe add it as a GUI option for it in Audio gump, with something similar for Windows midi drivers. And maybe something similar for OSX, but @DominusExult will have to let me know if this is needed. And with this GUI option being added, maybe it would be better to save the name of the chosen device (if it has one) instead of an ID/port -- so if the device ID/port changes, it can still be enabled (if it exists) by name.
The reasons:
The sequence for opening a MIDI device might be something like:
sigh I still strongly dislike the xml style of the cfg anyway ;)
Switch to YAML ? And please, not JSON ...
sigh I still strongly dislike the xml style of the cfg anyway ;)
Switch to YAML ? And please, not JSON ...
Actually I'm pretty much a fan of the ini format. When people from exult started Pentagram, we went with that for ease of use.
OTOH, the strong reason not to switch was always that we should have as much as possible accessible via the GUI so people do not have to edit the cfg as much.
I am actually tempted to maybe add it as a GUI option for it in Audio gump, with something similar for Windows midi drivers. And maybe something similar for OSX, but @DominusExult will have to let me know if this is needed. And with this GUI option being added, maybe it would be better to save the name of the chosen device (if it has one) instead of an ID/port -- so if the device ID/port changes, it can still be enabled (if it exists) by name.
Having this in the GUI for macOS and Linux would be great. DOSBox is already polling the CoreMidi devices' name so you can use either port number or name (quick view in the svn2git repo at https://github.com/svn2github/dosbox/commit/3fd4c512eaf6c372d4a189e03cd2509d17b4f579).
I'm not sure when macOS changed this but at some point the MIDI network port was always turned on and at port 0, so the first port found is always that one, so you will always need to set a different one if you want to use a physical device or a virtual one like Munt. <- another reason a GUI option would be great.
Looking at the logging, Exult could also need to print out which port it uses if the one in the cfg is not available (in the screenshot below I had entered the device name and I guess Exult used 0 but you never know :))
Correction: Exult does write a message that a port is not available and that it tries port 0, if the value
Regardless of cfg file format, @Dragon-Baroque any code you already have would be welcome.
Regardless of cfg file format, @Dragon-Baroque any code you already have would be welcome.
Yes, please disregard the cfg file format, I shouldn't have brought it up, it's just a distraction.
I too agree that having an explicit list of available MIDI ports for the user to choose from would be nice. I have two questions for you :
open
service when the user clicks on OK and the Audio Gump closes. Should we add an listAvailable
service in the MIDI drivers to populate the MIDI list ?Also I have posted an updated MIDI detector code that works on a MIDI sound card I bought. Then the code not only detects correctly the Software MIDI Synthesizers but also the Hardware MIDI Synthesizer of the sound card. I have now this in the console :
Trying config specified Midi driver: `alsa'
ALSAMidiDriver: Can't subscribe to default MIDI port [65:0], looking for other MIDI ports
ALSAMidiDriver: ALSA client initialised on MIDI port [17:0] [ Emu10k1 WaveTable : Emu10k1 Port 0 ]
Success!
Midi Output: Enabled
Where 17:0
is the ClientID:PortID, and Emu10k1 WaveTable
is the ClientName and Emu10k1 Port 0
the PortName.
Published in Dragon-Baroque/exult, Branch exult_audio.
As I messed with CoreAudio and SoundFonts, it would be really great if Exult were to parse the DATA folder for sf2 (and in the case of CoreAudio, additionally for dls) files and toggle them through a button. And if there is anything written in the <..._soundfont> tag first try if that is in the DATA folder and if not try whether it is a full path.
as for the questions above:
... parse the DATA folder for sf2 ...
Can you alter the choice of SoundFonts in CoreMidi
?
In Linux, you cannot in Alsa
, only directly in FluidSynth
.
And you should respect the default folders of FluidSynth, /usr/share/soundfonts
.
We do already list in stdout available ports/port names for Windows (WindowsMidiDriver.cpp:74) and CoreMidi (CoreMidiDriver.cpp:57). Can't see anything in the ALSA code.
True. I can add this to the code in Dragon-Baroque/exult
branch exult_audio
.
So far we could use just a button that enumerates the available ports/names and toggle through them (as we do with the MIDI drivers.
Yes, but for Alsa, the proper enumeration should be clientNumber:portNumber
and clientName:portName
, which would quickly overflow the gump width, unless we can restrict to the portName
. Here is a list from aplaymidi -l
on my Linux, with my SB Audigy, with FluidSynth and TiMidity++ :
Port Client name Port name
14:0 Midi Through Midi Through Port-0
24:0 SB Audigy 5/Rx [SB1550] Audigy MPU-401 (UART)
24:32 SB Audigy 5/Rx [SB1550] Audigy MPU-401 #2
25:0 Emu10k1 WaveTable Emu10k1 Port 0
25:1 Emu10k1 WaveTable Emu10k1 Port 1
25:2 Emu10k1 WaveTable Emu10k1 Port 2
25:3 Emu10k1 WaveTable Emu10k1 Port 3
128:0 FLUID Synth (178130) Synth input port (178130:0)
129:0 TiMidity TiMidity port 0
129:1 TiMidity TiMidity port 1
129:2 TiMidity TiMidity port 2
129:3 TiMidity TiMidity port 3
I honestly have no idea about ALSA and only about FluidSynth. Fluidsynth is also special in Exult as you can have multiple soundfonts that "stack". For ALSA enumaration you would probably need to see what makes the most sense to display.
There is a difference between CoreAudio and CoreMidi. CoreMidi is only for connecting to an "external" MIDI device which are connected to a port. Can be both a real device like a Roland MT-32 or a virtual one like the Munt MT32emu. It doesn't make use of a soundfont. CoreAudio is for using the builtin MIDI stuff using a soundfont (which you can change in exult.cfg).
I have a prototype change of the my exult_audio
branch that lists the MIDI devices prior to the connection with Alsa :
Trying config specified Midi driver: `Alsa'
Listing midi devices:
14:0 : [ Midi Through : Midi Through Port-0 ], available, 0 channels
24:0 : [ SB Audigy 5/Rx [SB1550] : Audigy MPU-401 (UART) ], available, 16 channels
24:32 : [ SB Audigy 5/Rx [SB1550] : Audigy MPU-401 #2 ], available, 16 channels
25:0 : [ Emu10k1 WaveTable : Emu10k1 Port 0 ], in use, 16 channels
25:1 : [ Emu10k1 WaveTable : Emu10k1 Port 1 ], available, 16 channels
25:2 : [ Emu10k1 WaveTable : Emu10k1 Port 2 ], available, 16 channels
25:3 : [ Emu10k1 WaveTable : Emu10k1 Port 3 ], available, 16 channels
128:0 : [ FLUID Synth (491221) : Synth input port (491221:0) ], in use, 16 channels
129:0 : [ TiMidity : TiMidity port 0 ], available, 16 channels
129:1 : [ TiMidity : TiMidity port 1 ], available, 16 channels
129:2 : [ TiMidity : TiMidity port 2 ], available, 16 channels
129:3 : [ TiMidity : TiMidity port 3 ], available, 16 channels
ALSAMidiDriver: Can't subscribe to default MIDI port [65:0], looking for other MIDI ports
ALSAMidiDriver: ALSA client initialised on MIDI port [25:1] [ Emu10k1 WaveTable : Emu10k1 Port 1 ]
Success!
Midi Output: Enabled
In Alsa the notation is clientNo:portNo,
with [ clientName : portName ]
.
The only portName
that should be cleaned up for the Audio Options gump comes from FluidSynth.
That's a very verbose but useful output :)
And yes, Synth input port (491221:0)
, is long and doesn't even mention Fluidsynth.
I have a few changes to offer, mostly in the Audio support for Exult.
alsa_port
or 65:0 - fails to connect, try to detect a valid MIDI output port. Explanation : the port 65:0 come for MIDI synthesizer sound cards. Now, MIDI is provided by software synthesis, essentially by the three synthesizers natively supported by Exult : MT32Emu, Timidity, and FluidSynth. All three can register as ALSA servers at ports 128:0 and up, by time order of registration. My proposal, to avoid requesting the user to code analsa_port
in the configurationexult.cfg
, is to ask ALSA to name the ALSA clients with available output MIDI and connect to the first that accepts.I have a few questions :
alsa_port
in theexult.cfg
to the detected MIDI server when the default port address failed - whether coming fromexult.cfg
or being 65:0, or is the setting of thealsa_port
reserved to the human user ?fluidsynth_soundfont
tag of theexult.cfg
. It it acceptable to record it also in thefluidsynth_soundfont
tag of theexult.cfg
?I have also a pending change to the
exult.cfg
writer, which keeps each value tag in one like, reserving the indentation for nested tags : you now get :All the changes are ready for review. Please tell me about an acceptable delivery format, I mean, one commit per item, or one commit for all of them...
Dragon-Baroque, March 1st, 2021