Added timidity support on Android
This commit is contained in:
@@ -11,6 +11,12 @@ if(NOT OPTION_DEDICATED)
|
||||
CONDITION Fluidsynth_FOUND
|
||||
)
|
||||
|
||||
add_files(
|
||||
libtimidity.cpp
|
||||
libtimidity.h
|
||||
CONDITION Timidity_FOUND
|
||||
)
|
||||
|
||||
add_files(
|
||||
cocoa_m.cpp
|
||||
cocoa_m.h
|
||||
|
||||
@@ -68,17 +68,17 @@ void Android_MidiMixMusic(Sint16 *stream, int len)
|
||||
static FMusicDriver_LibTimidity iFMusicDriver_LibTimidity;
|
||||
|
||||
enum { TIMIDITY_MAX_VOLUME = 50 };
|
||||
const char *MusicDriver_LibTimidity::Start(const char * const *param)
|
||||
const char *MusicDriver_LibTimidity::Start(const StringList ¶m)
|
||||
{
|
||||
_midi.status = MIDI_STOPPED;
|
||||
_midi.song = NULL;
|
||||
volume = TIMIDITY_MAX_VOLUME; // Avoid clipping
|
||||
|
||||
if (mid_init(param == NULL ? NULL : const_cast<char *>(param[0])) < 0) {
|
||||
if (mid_init(NULL) < 0) {
|
||||
/* If init fails, it can be because no configuration was found.
|
||||
* If it was not forced via param, try to load it without a
|
||||
* configuration. Who knows that works. */
|
||||
if (param != NULL || mid_init_no_config() < 0) {
|
||||
if (mid_init_no_config() < 0) {
|
||||
return "error initializing timidity";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* 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.
|
||||
@@ -18,18 +16,19 @@
|
||||
class MusicDriver_LibTimidity : public MusicDriver {
|
||||
int volume;
|
||||
public:
|
||||
/* virtual */ const char *Start(const char * const *param);
|
||||
const char *Start(const StringList ¶m) override;
|
||||
|
||||
/* virtual */ void Stop();
|
||||
void Stop() override;
|
||||
|
||||
/* virtual */ void PlaySong(const MusicSongInfo &song);
|
||||
void PlaySong(const MusicSongInfo &song) override;
|
||||
|
||||
/* virtual */ void StopSong();
|
||||
void StopSong() override;
|
||||
|
||||
/* virtual */ bool IsSongPlaying();
|
||||
bool IsSongPlaying() override;
|
||||
|
||||
/* virtual */ void SetVolume(byte vol);
|
||||
/* virtual */ const char *GetName() const { return "libtimidity"; }
|
||||
void SetVolume(byte vol) override;
|
||||
|
||||
const char *GetName() const override { return "libtimidity"; }
|
||||
};
|
||||
|
||||
/** Factory for the libtimidity driver. */
|
||||
|
||||
Reference in New Issue
Block a user