diff options
-rw-r--r-- | README | 29 | ||||
-rw-r--r-- | backends/midi/alsa.cpp | 42 | ||||
-rw-r--r-- | base/commandLine.cpp | 3 |
3 files changed, 46 insertions, 28 deletions
@@ -1322,34 +1322,39 @@ sequencer support does not work, you can always fall back on Adlib emulation. 7.6.1) Playing sound with ALSA sequencer: [UNIX ONLY] ------ ---------------------------------- -If you have installed the ALSA driver with the sequencer support, then -set the environment variable SCUMMVM_PORT or the config file parameter -alsa_port to your sequencer port. The default is "65:0". +If you have installed the ALSA driver with the sequencer support, then set the +environment variable SCUMMVM_PORT or the config file parameter alsa_port to +your sequencer port. The default is to try both "65:0" and "17:0". Here is a little howto on how to use the ALSA sequencer with your soundcard. In all cases, to have a list of all the sequencer ports you have, try the command "aconnect -o -l". This should give output similar to: -client 64: 'External MIDI 0' [type=kernel] - 0 'MIDI 0-0 ' -client 65: 'Emu10k1 WaveTable' [type=kernel] + +client 14: 'Midi Through' [type=kernel] + 0 'Midi Through Port-0' +client 16: 'SBLive! Value [CT4832]' [type=kernel] + 0 'EMU10K1 MPU-401 (UART)' +client 17: 'Emu10k1 WaveTable' [type=kernel] 0 'Emu10k1 Port 0 ' 1 'Emu10k1 Port 1 ' 2 'Emu10k1 Port 2 ' 3 'Emu10k1 Port 3 ' -client 128: 'Client-128' [type=user] +client 128: 'TiMidity' [type=user] 0 'TiMidity port 0 ' 1 'TiMidity port 1 ' + 2 'TiMidity port 2 ' + 3 'TiMidity port 3 ' -This means the external MIDI output of the sound card is located on the -port 64:0, four WaveTable MIDI outputs in 65:0, 65:1, 65:2 -and 65:3, and two TiMidity ports, located at 128:0 and 128:1. +The most important bit here is that there are four WaveTable MIDI outputs +located at 17:0, 17:1, 17:2 and 17:3, and four TiMidity ports located at 128:0, +128:1, 128:2 and 128:3. If you have a FM-chip on your card, like the SB16, then you have to load the SoundFonts using the sbiload software. Example: - sbiload -p 65:0 /etc/std.o3 /etc/drums.o3 + sbiload -p 17:0 /etc/std.o3 /etc/drums.o3 If you have a WaveTable capable sound card, you have to load a sbk or sf2 -SoundFont using the sfxload software. Example: +SoundFont using the sfxload or asfxload software. Example: sfxload /path/to/8mbgmsfx.sf2 If you don't have a MIDI capable soundcard, there are two options: FluidSynth diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index 2a252b9323..5a978a0fd2 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -79,20 +79,18 @@ MidiDriver_ALSA::MidiDriver_ALSA() } int MidiDriver_ALSA::open() { - const char *var; + const char *var = NULL; if (_isOpen) return MERR_ALREADY_OPEN; _isOpen = true; - if (!(var = getenv("SCUMMVM_PORT"))) { - // use config option if no var specified + var = getenv("SCUMMVM_PORT"); + if (!var && ConfMan.hasKey("alsa_port")) { var = ConfMan.get("alsa_port").c_str(); - if (parse_addr(var, &seq_client, &seq_port) < 0) { - error("Invalid port %s", var); - return -1; - } - } else { + } + + if (var) { if (parse_addr(var, &seq_client, &seq_port) < 0) { error("Invalid port %s", var); return -1; @@ -120,14 +118,32 @@ int MidiDriver_ALSA::open() { return -1; } - if (seq_client != SND_SEQ_ADDRESS_SUBSCRIBERS) { - /* subscribe to MIDI port */ - if (snd_seq_connect_to(seq_handle, my_port, seq_client, seq_port) < 0) { - error("Can't subscribe to MIDI port (%d:%d) see README for help", seq_client, seq_port); + if (var) { + if (seq_client != SND_SEQ_ADDRESS_SUBSCRIBERS) { + // subscribe to MIDI port + if (snd_seq_connect_to(seq_handle, my_port, seq_client, seq_port) < 0) { + error("Can't subscribe to MIDI port (%d:%d) see README for help", seq_client, seq_port); + } } - else printf("Connected to Alsa sequencer client [%d:%d]\n", seq_client, seq_port); + } else { + int defaultPorts[] = { + 65, 0, + 17, 0 + }; + int i; + + for (i = 0; i < ARRAYSIZE(defaultPorts); i += 2) { + seq_client = defaultPorts[i]; + seq_port = defaultPorts[i + 1]; + if (snd_seq_connect_to(seq_handle, my_port, seq_client, seq_port) >= 0) + break; + } + + if (i >= ARRAYSIZE(defaultPorts)) + error("Can't subscribe to MIDI port (65:0) or (17:0)"); } + printf("Connected to Alsa sequencer client [%d:%d]\n", seq_client, seq_port); printf("ALSA client initialised [%d:0]\n", my_client); return 0; diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 84f2013ae9..f8ca8a90cd 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -193,9 +193,6 @@ void registerDefaults() { ConfMan.registerDefault("joystick_num", -1); ConfMan.registerDefault("confirm_exit", false); ConfMan.registerDefault("disable_sdl_parachute", false); -#ifdef USE_ALSA - ConfMan.registerDefault("alsa_port", "65:0"); -#endif ConfMan.registerDefault("record_mode", "none"); ConfMan.registerDefault("record_file_name", "record.bin"); |