[Scummvm-cvs-logs] SF.net SVN: scummvm:[33648] scummvm/trunk
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Tue Aug 5 23:43:11 CEST 2008
Revision: 33648
http://scummvm.svn.sourceforge.net/scummvm/?rev=33648&view=rev
Author: eriktorbjorn
Date: 2008-08-05 21:43:10 +0000 (Tue, 05 Aug 2008)
Log Message:
-----------
Committed my patch #2026097 ("ALSA: Try both 65:0 and 17:0 by default"), with a
slight modification to the README changes. (I don't know how to interpret all
the output from aconnect, so I'm only documenting "the most important bit".)
Modified Paths:
--------------
scummvm/trunk/README
scummvm/trunk/backends/midi/alsa.cpp
scummvm/trunk/base/commandLine.cpp
Modified: scummvm/trunk/README
===================================================================
--- scummvm/trunk/README 2008-08-05 21:38:59 UTC (rev 33647)
+++ scummvm/trunk/README 2008-08-05 21:43:10 UTC (rev 33648)
@@ -1322,34 +1322,39 @@
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
Modified: scummvm/trunk/backends/midi/alsa.cpp
===================================================================
--- scummvm/trunk/backends/midi/alsa.cpp 2008-08-05 21:38:59 UTC (rev 33647)
+++ scummvm/trunk/backends/midi/alsa.cpp 2008-08-05 21:43:10 UTC (rev 33648)
@@ -79,24 +79,22 @@
}
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 (var) {
if (parse_addr(var, &seq_client, &seq_port) < 0) {
error("Invalid port %s", var);
return -1;
}
- } else {
- if (parse_addr(var, &seq_client, &seq_port) < 0) {
- error("Invalid port %s", var);
- return -1;
- }
}
if (my_snd_seq_open(&seq_handle) < 0) {
@@ -120,14 +118,32 @@
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;
Modified: scummvm/trunk/base/commandLine.cpp
===================================================================
--- scummvm/trunk/base/commandLine.cpp 2008-08-05 21:38:59 UTC (rev 33647)
+++ scummvm/trunk/base/commandLine.cpp 2008-08-05 21:43:10 UTC (rev 33648)
@@ -193,9 +193,6 @@
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");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list