2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
8 /** @file bemidi.cpp Support for BeOS midi. */
10 #include "../stdafx.h"
11 #include "../openttd.h"
13 #include "../base_media_base.h"
14 #include "midifile.hpp"
16 /* BeOS System Includes */
17 #include <MidiSynthFile.h>
19 #include "../safeguards.h"
21 /** The file we're playing. */
22 static BMidiSynthFile midiSynthFile
;
24 /** Factory for BeOS' midi player. */
25 static FMusicDriver_BeMidi iFMusicDriver_BeMidi
;
27 const char *MusicDriver_BeMidi::Start(const char * const *parm
)
32 void MusicDriver_BeMidi::Stop()
34 midiSynthFile
.UnloadFile();
37 void MusicDriver_BeMidi::PlaySong(const MusicSongInfo
&song
)
39 std::string filename
= MidiFile::GetSMFFile(song
);
42 if (!filename
.empty()) {
44 get_ref_for_path(filename
.c_str(), &midiRef
);
45 midiSynthFile
.LoadFile(&midiRef
);
46 midiSynthFile
.Start();
50 void MusicDriver_BeMidi::StopSong()
52 midiSynthFile
.UnloadFile();
55 bool MusicDriver_BeMidi::IsSongPlaying()
57 return !midiSynthFile
.IsFinished();
60 void MusicDriver_BeMidi::SetVolume(byte vol
)
62 fprintf(stderr
, "BeMidi: Set volume not implemented\n");