diff options
author | peter1138 <peter1138@openttd.org> | 2009-01-08 12:05:14 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2009-01-08 12:05:14 +0000 |
commit | 8591ff41cc4597785cf4841c67a93f8ab8e006bb (patch) | |
tree | fce554a01119cd5d6c7bf58f770a96d121a41f35 /src/music/extmidi.cpp | |
parent | 91866a381d3fbcb25702406a096829a8dab6861a (diff) | |
download | openttd-8591ff41cc4597785cf4841c67a93f8ab8e006bb.tar.xz |
(svn r14909) -Codechange: Remove global option for the extmidi driver and make it a driver parameter with the name cmd instead. This means if you have an "extmidi = ..." line in your config you must change it to "musicdriver = extmidi:cmd=...", in the [misc] section.
Diffstat (limited to 'src/music/extmidi.cpp')
-rw-r--r-- | src/music/extmidi.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/music/extmidi.cpp b/src/music/extmidi.cpp index cba772506..6179501a6 100644 --- a/src/music/extmidi.cpp +++ b/src/music/extmidi.cpp @@ -17,10 +17,18 @@ #include <sys/stat.h> #include <errno.h> +#ifndef EXTERNAL_PLAYER +#define EXTERNAL_PLAYER "timidity" +#endif + static FMusicDriver_ExtMidi iFMusicDriver_ExtMidi; const char* MusicDriver_ExtMidi::Start(const char* const * parm) { + const char *command = GetDriverParam(parm, "cmd"); + if (StrEmpty(command)) command = EXTERNAL_PLAYER; + + this->command = strdup(command); this->song[0] = '\0'; this->pid = -1; return NULL; @@ -28,6 +36,7 @@ const char* MusicDriver_ExtMidi::Start(const char* const * parm) void MusicDriver_ExtMidi::Stop() { + free(command); this->song[0] = '\0'; this->DoStop(); } @@ -68,9 +77,9 @@ void MusicDriver_ExtMidi::DoPlay() d = open("/dev/null", O_RDONLY); if (d != -1 && dup2(d, 1) != -1 && dup2(d, 2) != -1) { #if defined(MIDI_ARG) - execlp(msf.extmidi, "extmidi", MIDI_ARG, this->song, (char*)0); + execlp(this->command, "extmidi", MIDI_ARG, this->song, (char*)0); #else - execlp(msf.extmidi, "extmidi", this->song, (char*)0); + execlp(this->command, "extmidi", this->song, (char*)0); #endif } _exit(1); |