diff options
author | rubidium <rubidium@openttd.org> | 2009-12-16 23:49:21 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-12-16 23:49:21 +0000 |
commit | b0f1fcbead4c3aa03ab8d0544039fc2de0bc4f5d (patch) | |
tree | e53d5e6c113704650e2d81ae3e9a90211b07f7d1 /src/music | |
parent | 51cb9cc43fd220351d8a3f68f4e9f4f7a087b856 (diff) | |
download | openttd-b0f1fcbead4c3aa03ab8d0544039fc2de0bc4f5d.tar.xz |
(svn r18520) -Fix [FS#3272]: allegro doesn't like to work with extmidi; it causes 'random' (looks like a racing condition in allegro) crashes when songs are stopped.
Diffstat (limited to 'src/music')
-rw-r--r-- | src/music/allegro_m.h | 8 | ||||
-rw-r--r-- | src/music/extmidi.cpp | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/music/allegro_m.h b/src/music/allegro_m.h index 70d71733b..1d61b30f8 100644 --- a/src/music/allegro_m.h +++ b/src/music/allegro_m.h @@ -32,7 +32,15 @@ public: class FMusicDriver_Allegro: public MusicDriverFactory<FMusicDriver_Allegro> { public: +#if !defined(WITH_SDL) && defined(WITH_ALLEGRO) + /* If SDL is not compiled in but Allegro is, chances are quite big + * that Allegro is going to be used. Then favour this sound driver + * over extmidi because with extmidi we get crashes. */ + static const int priority = 9; +#else static const int priority = 2; +#endif + /* virtual */ const char *GetName() { return "allegro"; } /* virtual */ const char *GetDescription() { return "Allegro MIDI Driver"; } /* virtual */ Driver *CreateInstance() { return new MusicDriver_Allegro(); } diff --git a/src/music/extmidi.cpp b/src/music/extmidi.cpp index 451419801..260044268 100644 --- a/src/music/extmidi.cpp +++ b/src/music/extmidi.cpp @@ -12,6 +12,8 @@ #ifndef __MORPHOS__ #include "../stdafx.h" #include "../debug.h" +#include "../sound/sound_driver.hpp" +#include "../video/video_driver.hpp" #include "extmidi.h" #include <fcntl.h> #include <sys/types.h> @@ -29,6 +31,11 @@ static FMusicDriver_ExtMidi iFMusicDriver_ExtMidi; const char *MusicDriver_ExtMidi::Start(const char * const * parm) { + if (strcmp(_video_driver->GetName(), "allegro") == 0 || + strcmp(_sound_driver->GetName(), "allegro") == 0) { + return "the extmidi driver does not work when Allegro is loaded."; + } + const char *command = GetDriverParam(parm, "cmd"); if (StrEmpty(command)) command = EXTERNAL_PLAYER; |