14 #include "../stdafx.h" 17 #include "midifile.hpp" 20 #include "../safeguards.h" 23 static MIDI *
_midi =
nullptr;
29 extern int _allegro_instance_count;
33 if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno,
nullptr)) {
34 DEBUG(driver, 0,
"allegro: install_allegro failed '%s'", allegro_error);
35 return "Failed to set up Allegro";
37 _allegro_instance_count++;
40 if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT,
nullptr) != 0) {
41 DEBUG(driver, 0,
"allegro: install_sound failed '%s'", allegro_error);
42 return "Failed to set up Allegro sound";
46 if (midi_card == MIDI_NONE) {
47 DEBUG(driver, 0,
"allegro: no midi card found");
48 return "No sound card found";
59 if (--_allegro_instance_count == 0) allegro_exit();
67 if (!filename.empty()) {
68 _midi = load_midi(filename.c_str());
69 play_midi(
_midi,
false);
Metadata about a music track.
void StopSong() override
Stop playing the current song.
bool IsSongPlaying() override
Are we currently playing a song?
const char * Start(const char *const *param) override
Start this driver.
Factory for allegro's music player.
void Stop() override
Stop this driver.
Base support for playing music via allegro.
void PlaySong(const MusicSongInfo &song) override
Play a particular song.
#define DEBUG(name, level,...)
Output a line of debugging information.
static std::string GetSMFFile(const MusicSongInfo &song)
Get the name of a Standard MIDI File for a given song.
static struct @24 _midi
Metadata about the midi we're playing.
void SetVolume(byte vol) override
Set the volume, if possible.