10 #include "../stdafx.h"
11 #include "../openttd.h"
13 #include "../base_media_base.h"
14 #include "midifile.hpp"
16 #include "../safeguards.h"
36 this->midi_synth_file =
new BMidiSynthFile();
37 if (!filename.empty()) {
39 get_ref_for_path(filename.c_str(), &midiRef);
40 if (this->midi_synth_file->LoadFile(&midiRef) == B_OK) {
41 this->midi_synth_file->SetVolume(this->current_volume);
42 this->midi_synth_file->Start();
43 this->just_started =
true;
54 delete this->midi_synth_file;
55 this->midi_synth_file =
nullptr;
60 if (this->midi_synth_file ==
nullptr)
return false;
65 if (this->just_started) {
66 if (!this->midi_synth_file->IsFinished()) this->just_started =
false;
69 return !this->midi_synth_file->IsFinished();
74 this->current_volume = vol / 128.0;
75 if (this->midi_synth_file !=
nullptr) this->midi_synth_file->SetVolume(this->current_volume);
static FMusicDriver_BeMidi iFMusicDriver_BeMidi
Factory for BeOS' midi player.
Base of BeOS Midi support.
Factory for the BeOS midi player.
void PlaySong(const MusicSongInfo &song) override
Play a particular song.
void StopSong() override
Stop playing the current song.
void Stop() override
Stop this driver.
bool IsSongPlaying() override
Are we currently playing a song?
std::optional< std::string_view > Start(const StringList ¶m) override
Start this driver.
void SetVolume(uint8_t vol) override
Set the volume, if possible.
std::vector< std::string > StringList
Type for a list of strings.
static std::string GetSMFFile(const MusicSongInfo &song)
Get the name of a Standard MIDI File for a given song.
Metadata about a music track.