2009-08-21 22:21:05 +02:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 17:11:33 +02:00
|
|
|
/** @file bemidi.cpp Support for BeOS midi. */
|
2007-04-17 22:23:13 +02:00
|
|
|
|
2005-07-25 10:16:05 +02:00
|
|
|
#include "../stdafx.h"
|
|
|
|
#include "../openttd.h"
|
|
|
|
#include "bemidi.h"
|
2018-03-17 14:51:30 +01:00
|
|
|
#include "../base_media_base.h"
|
2018-03-21 17:12:29 +01:00
|
|
|
#include "midifile.hpp"
|
2004-12-01 20:42:42 +01:00
|
|
|
|
2009-03-15 01:32:18 +01:00
|
|
|
/* BeOS System Includes */
|
2004-12-01 20:42:42 +01:00
|
|
|
#include <MidiSynthFile.h>
|
|
|
|
|
2014-04-23 22:13:33 +02:00
|
|
|
#include "../safeguards.h"
|
|
|
|
|
2011-05-02 18:14:23 +02:00
|
|
|
/** The file we're playing. */
|
2005-07-23 17:34:05 +02:00
|
|
|
static BMidiSynthFile midiSynthFile;
|
2004-12-01 20:42:42 +01:00
|
|
|
|
2011-05-02 18:14:23 +02:00
|
|
|
/** Factory for BeOS' midi player. */
|
2007-07-05 14:23:54 +02:00
|
|
|
static FMusicDriver_BeMidi iFMusicDriver_BeMidi;
|
|
|
|
|
|
|
|
const char *MusicDriver_BeMidi::Start(const char * const *parm)
|
2004-12-01 20:42:42 +01:00
|
|
|
{
|
2019-04-10 23:07:06 +02:00
|
|
|
return nullptr;
|
2004-12-01 20:42:42 +01:00
|
|
|
}
|
|
|
|
|
2007-07-05 14:23:54 +02:00
|
|
|
void MusicDriver_BeMidi::Stop()
|
2004-12-01 20:42:42 +01:00
|
|
|
{
|
|
|
|
midiSynthFile.UnloadFile();
|
|
|
|
}
|
|
|
|
|
2018-03-17 14:51:30 +01:00
|
|
|
void MusicDriver_BeMidi::PlaySong(const MusicSongInfo &song)
|
2004-12-01 20:42:42 +01:00
|
|
|
{
|
2018-03-21 17:12:29 +01:00
|
|
|
std::string filename = MidiFile::GetSMFFile(song);
|
2018-03-17 14:51:30 +01:00
|
|
|
|
2010-02-11 18:13:57 +01:00
|
|
|
this->Stop();
|
2018-03-21 17:12:29 +01:00
|
|
|
if (!filename.empty()) {
|
|
|
|
entry_ref midiRef;
|
|
|
|
get_ref_for_path(filename.c_str(), &midiRef);
|
|
|
|
midiSynthFile.LoadFile(&midiRef);
|
|
|
|
midiSynthFile.Start();
|
|
|
|
}
|
2004-12-01 20:42:42 +01:00
|
|
|
}
|
|
|
|
|
2007-07-05 14:23:54 +02:00
|
|
|
void MusicDriver_BeMidi::StopSong()
|
2004-12-01 20:42:42 +01:00
|
|
|
{
|
|
|
|
midiSynthFile.UnloadFile();
|
|
|
|
}
|
|
|
|
|
2007-07-05 14:23:54 +02:00
|
|
|
bool MusicDriver_BeMidi::IsSongPlaying()
|
2004-12-01 20:42:42 +01:00
|
|
|
{
|
|
|
|
return !midiSynthFile.IsFinished();
|
|
|
|
}
|
|
|
|
|
2007-07-05 14:23:54 +02:00
|
|
|
void MusicDriver_BeMidi::SetVolume(byte vol)
|
2004-12-01 20:42:42 +01:00
|
|
|
{
|
|
|
|
fprintf(stderr, "BeMidi: Set volume not implemented\n");
|
|
|
|
}
|