00001 /* $Id: allegro_m.h 22410 2011-05-02 16:14:23Z rubidium $ */ 00002 00003 /* 00004 * This file is part of OpenTTD. 00005 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. 00006 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00007 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. 00008 */ 00009 00012 #ifndef MUSIC_ALLEGRO_H 00013 #define MUSIC_ALLEGRO_H 00014 00015 #include "music_driver.hpp" 00016 00018 class MusicDriver_Allegro: public MusicDriver { 00019 public: 00020 /* virtual */ const char *Start(const char * const *param); 00021 00022 /* virtual */ void Stop(); 00023 00024 /* virtual */ void PlaySong(const char *filename); 00025 00026 /* virtual */ void StopSong(); 00027 00028 /* virtual */ bool IsSongPlaying(); 00029 00030 /* virtual */ void SetVolume(byte vol); 00031 /* virtual */ const char *GetName() const { return "allegro"; } 00032 }; 00033 00035 class FMusicDriver_Allegro: public MusicDriverFactory<FMusicDriver_Allegro> { 00036 public: 00037 #if !defined(WITH_SDL) && defined(WITH_ALLEGRO) 00038 /* If SDL is not compiled in but Allegro is, chances are quite big 00039 * that Allegro is going to be used. Then favour this sound driver 00040 * over extmidi because with extmidi we get crashes. */ 00041 static const int priority = 9; 00042 #else 00043 static const int priority = 2; 00044 #endif 00045 00046 /* virtual */ const char *GetName() { return "allegro"; } 00047 /* virtual */ const char *GetDescription() { return "Allegro MIDI Driver"; } 00048 /* virtual */ Driver *CreateInstance() { return new MusicDriver_Allegro(); } 00049 }; 00050 00051 #endif /* MUSIC_ALLEGRO_H */