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);