OpenTTD
bemidi.cpp
Go to the documentation of this file.
1 /* $Id$ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * 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.
6  * 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.
7  * 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  */
9 
12 #include "../stdafx.h"
13 #include "../openttd.h"
14 #include "bemidi.h"
15 #include "../base_media_base.h"
16 #include "midifile.hpp"
17 
18 /* BeOS System Includes */
19 #include <MidiSynthFile.h>
20 
21 #include "../safeguards.h"
22 
24 static BMidiSynthFile midiSynthFile;
25 
28 
29 const char *MusicDriver_BeMidi::Start(const char * const *parm)
30 {
31  return NULL;
32 }
33 
35 {
36  midiSynthFile.UnloadFile();
37 }
38 
40 {
41  std::string filename = MidiFile::GetSMFFile(song);
42 
43  this->Stop();
44  if (!filename.empty()) {
45  entry_ref midiRef;
46  get_ref_for_path(filename.c_str(), &midiRef);
47  midiSynthFile.LoadFile(&midiRef);
48  midiSynthFile.Start();
49  }
50 }
51 
53 {
54  midiSynthFile.UnloadFile();
55 }
56 
58 {
59  return !midiSynthFile.IsFinished();
60 }
61 
63 {
64  fprintf(stderr, "BeMidi: Set volume not implemented\n");
65 }
Metadata about a music track.
static FMusicDriver_BeMidi iFMusicDriver_BeMidi
Factory for BeOS&#39; midi player.
Definition: bemidi.cpp:27
Factory for the BeOS midi player.
Definition: bemidi.h:35
Base of BeOS Midi support.
const char * Start(const char *const *param)
Start this driver.
Definition: bemidi.cpp:29
static std::string GetSMFFile(const MusicSongInfo &song)
Get the name of a Standard MIDI File for a given song.
Definition: midifile.cpp:1041
void PlaySong(const MusicSongInfo &song)
Play a particular song.
Definition: bemidi.cpp:39
void SetVolume(byte vol)
Set the volume, if possible.
Definition: bemidi.cpp:62
bool IsSongPlaying()
Are we currently playing a song?
Definition: bemidi.cpp:57
void StopSong()
Stop playing the current song.
Definition: bemidi.cpp:52
static BMidiSynthFile midiSynthFile
The file we&#39;re playing.
Definition: bemidi.cpp:24
void Stop()
Stop this driver.
Definition: bemidi.cpp:34