2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-11-25 23:21:58 +00:00
|
|
|
/** @file allegro_m.h Base support for playing music via allegro. */
|
|
|
|
|
|
|
|
#ifndef MUSIC_ALLEGRO_H
|
|
|
|
#define MUSIC_ALLEGRO_H
|
|
|
|
|
|
|
|
#include "music_driver.hpp"
|
|
|
|
|
2011-05-02 16:14:23 +00:00
|
|
|
/** Allegro's music player. */
|
2013-11-25 14:30:22 +00:00
|
|
|
class MusicDriver_Allegro : public MusicDriver {
|
2008-11-25 23:21:58 +00:00
|
|
|
public:
|
2020-05-17 21:32:08 +00:00
|
|
|
const char *Start(const StringList ¶m) override;
|
2008-11-25 23:21:58 +00:00
|
|
|
|
2019-03-03 22:25:13 +00:00
|
|
|
void Stop() override;
|
2008-11-25 23:21:58 +00:00
|
|
|
|
2019-03-03 22:25:13 +00:00
|
|
|
void PlaySong(const MusicSongInfo &song) override;
|
2008-11-25 23:21:58 +00:00
|
|
|
|
2019-03-03 22:25:13 +00:00
|
|
|
void StopSong() override;
|
2008-11-25 23:21:58 +00:00
|
|
|
|
2019-03-03 22:25:13 +00:00
|
|
|
bool IsSongPlaying() override;
|
2008-11-25 23:21:58 +00:00
|
|
|
|
2019-03-03 22:25:13 +00:00
|
|
|
void SetVolume(byte vol) override;
|
|
|
|
const char *GetName() const override { return "allegro"; }
|
2008-11-25 23:21:58 +00:00
|
|
|
};
|
|
|
|
|
2011-05-02 16:14:23 +00:00
|
|
|
/** Factory for allegro's music player. */
|
2013-11-25 14:26:46 +00:00
|
|
|
class FMusicDriver_Allegro : public DriverFactoryBase {
|
2008-11-25 23:21:58 +00:00
|
|
|
public:
|
2009-12-16 23:49:21 +00:00
|
|
|
#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. */
|
2013-11-25 14:26:46 +00:00
|
|
|
static const int PRIORITY = 9;
|
2009-12-16 23:49:21 +00:00
|
|
|
#else
|
2013-11-25 14:26:46 +00:00
|
|
|
static const int PRIORITY = 2;
|
2009-12-16 23:49:21 +00:00
|
|
|
#endif
|
2013-11-25 14:26:46 +00:00
|
|
|
FMusicDriver_Allegro() : DriverFactoryBase(Driver::DT_MUSIC, PRIORITY, "allegro", "Allegro MIDI Driver") {}
|
2019-03-03 22:25:13 +00:00
|
|
|
Driver *CreateInstance() const override { return new MusicDriver_Allegro(); }
|
2008-11-25 23:21:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* MUSIC_ALLEGRO_H */
|