OpenTTD: src/music/bemidi.cpp Source File

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

bemidi.cpp
Go to the documentation of this file.
1 /* $Id: bemidi.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
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
16 /* BeOS System Includes */
17 #include <MidiSynthFile.h>
18
19 #include "../safeguards.h"
20
22 static BMidiSynthFile midiSynthFile;
23
25 static FMusicDriver_BeMidi iFMusicDriver_BeMidi;
26
27 const char *MusicDriver_BeMidi::Start(const char * const *parm)
28 {
29 return NULL;
30 }
31
32 void MusicDriver_BeMidi::Stop()
33 {
34 midiSynthFile.UnloadFile();
35 }
36
37 void MusicDriver_BeMidi::PlaySong(const char *filename)
38 {
39 this->Stop();
40 entry_ref midiRef;
41 get_ref_for_path(filename, &midiRef);
42 midiSynthFile.LoadFile(&midiRef);
43 midiSynthFile.Start();
44 }
45
46 void MusicDriver_BeMidi::StopSong()
47 {
48 midiSynthFile.UnloadFile();
49 }
50
51 bool MusicDriver_BeMidi::IsSongPlaying()
52 {
53 return !midiSynthFile.IsFinished();
54 }
55
56 void MusicDriver_BeMidi::SetVolume(byte vol)
57 {
58 fprintf(stderr, "BeMidi: Set volume not implemented\n");
59 }