diff options
-rw-r--r-- | config.lib | 24 | ||||
-rwxr-xr-x | configure | 1 | ||||
-rwxr-xr-x | projects/generate | 1 | ||||
-rw-r--r-- | source.list | 4 | ||||
-rw-r--r-- | src/music/libtimidity.cpp | 128 | ||||
-rw-r--r-- | src/music/libtimidity.h | 41 |
6 files changed, 0 insertions, 199 deletions
diff --git a/config.lib b/config.lib index 6013ab34b..fa27a8ec5 100644 --- a/config.lib +++ b/config.lib @@ -82,7 +82,6 @@ set_default() { with_iconv="1" with_midi="" with_midi_arg="" - with_libtimidity="1" with_fluidsynth="1" with_freetype="1" with_fontconfig="1" @@ -160,7 +159,6 @@ set_default() { with_iconv with_midi with_midi_arg - with_libtimidity with_fluidsynth with_freetype with_fontconfig @@ -370,10 +368,6 @@ detect_params() { --without-libpng) with_png="0";; --with-libpng=*) with_png="$optarg";; - --with-libtimidity) with_libtimidity="2";; - --without-libtimidity) with_libtimidity="0";; - --with-libtimidity=*) with_libtimidity="$optarg";; - --with-fluidsynth) with_fluidsynth="2";; --without-fluidsynth) with_fluidsynth="0";; --with-fluidsynth=*) with_fluidsynth="$optarg";; @@ -895,7 +889,6 @@ check_params() { detect_fontconfig detect_icu_layout detect_icu_sort - detect_libtimidity detect_fluidsynth if [ "$with_direct_music" != "0" ]; then @@ -1812,17 +1805,6 @@ make_cflags_and_ldflags() { CFLAGS="$CFLAGS -DWITH_XAUDIO2" fi - if [ -n "$libtimidity_config" ]; then - CFLAGS="$CFLAGS -DLIBTIMIDITY" - CFLAGS="$CFLAGS `$libtimidity_config --cflags | tr '\n\r' ' '`" - - if [ "$enable_static" != "0" ]; then - LIBS="$LIBS `$libtimidity_config --libs --static | tr '\n\r' ' '`" - else - LIBS="$LIBS `$libtimidity_config --libs | tr '\n\r' ' '`" - fi - fi - if [ -n "$fluidsynth" ]; then LIBS="$LIBS -lfluidsynth" CFLAGS="$CFLAGS -DFLUIDSYNTH" @@ -2752,10 +2734,6 @@ detect_lzo2() { detect_library "$with_lzo2" "lzo2" "liblzo2.a" "lzo/" "lzo1x.h" } -detect_libtimidity() { - detect_pkg_config "$with_libtimidity" "libtimidity" "libtimidity_config" "0.1" "1" -} - detect_fluidsynth() { detect_library "$with_fluidsynth" "fluidsynth" "" "" "fluidsynth.h" } @@ -3544,8 +3522,6 @@ showhelp() { echo " --with-midi=midi define which midi-player to use" echo " --with-midi-arg=arg define which args to use for the" echo " midi-player" - echo " --with-libtimidity[=\"pkg-config libtimidity\"]" - echo " enables libtimidity support" echo " --with-fluidsynth enables fluidsynth support" echo " --with-allegro[=\"pkg-config allegro\"]" echo " enables Allegro video driver support" @@ -122,7 +122,6 @@ AWKCOMMAND=' "'$os'" != "CYGWIN" && "'$os'" != "MSVC") { next; } if ($0 == "MSVC" && "'$os'" != "MSVC") { next; } if ($0 == "DIRECTMUSIC" && "'$with_direct_music'" == "0") { next; } - if ($0 == "LIBTIMIDITY" && "'$libtimidity'" == "" ) { next; } if ($0 == "FLUIDSYNTH" && "'$fluidsynth'" == "" ) { next; } if ($0 == "HAVE_THREAD" && "'$with_threads'" == "0") { next; } if ($0 == "SSE" && "'$with_sse'" != "1") { next; } diff --git a/projects/generate b/projects/generate index b7d7da26b..38a9e8e1f 100755 --- a/projects/generate +++ b/projects/generate @@ -138,7 +138,6 @@ load_main_data() { if ($0 == "MSVC" && "'$os'" != "MSVC") { next; } if ($0 == "DIRECTMUSIC" && "'$enable_directmusic'" != "1") { next; } if ($0 == "FLUIDSYNTH" && "'$enable_fluidsynth'" != "1") { next; } - if ($0 == "LIBTIMIDITY" && "'$libtimidity'" == "" ) { next; } if ($0 == "HAVE_THREAD" && "'$with_threads'" == "0") { next; } skip += 1; diff --git a/source.list b/source.list index 22d647dbb..5bc395a84 100644 --- a/source.list +++ b/source.list @@ -403,7 +403,6 @@ zoom_type.h music/bemidi.h music/cocoa_m.h music/extmidi.h -music/libtimidity.h music/fluidsynth.h music/os2_m.h music/qtmidi.h @@ -1120,9 +1119,6 @@ music/midifile.cpp #if HAIKU music/bemidi.cpp #end -#if LIBTIMIDITY - music/libtimidity.cpp -#end #if FLUIDSYNTH music/fluidsynth.cpp #end diff --git a/src/music/libtimidity.cpp b/src/music/libtimidity.cpp deleted file mode 100644 index 42c1e3c15..000000000 --- a/src/music/libtimidity.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* $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. - * 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/>. - */ - -/** @file libtimidity.cpp Playing music via the timidity library. */ - -#include "../stdafx.h" -#include "../openttd.h" -#include "../sound_type.h" -#include "../debug.h" -#include "libtimidity.h" -#include "midifile.hpp" -#include "../base_media_base.h" -#include <fcntl.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <unistd.h> -#include <signal.h> -#include <sys/stat.h> -#include <errno.h> -#include <timidity.h> - -#include "../safeguards.h" - -/** The state of playing. */ -enum MidiState { - MIDI_STOPPED = 0, - MIDI_PLAYING = 1, -}; - -static struct { - MidIStream *stream; - MidSongOptions options; - MidSong *song; - - MidiState status; - uint32 song_length; - uint32 song_position; -} _midi; ///< Metadata about the midi we're playing. - -/** Factory for the libtimidity driver. */ -static FMusicDriver_LibTimidity iFMusicDriver_LibTimidity; - -const char *MusicDriver_LibTimidity::Start(const char * const *param) -{ - _midi.status = MIDI_STOPPED; - _midi.song = NULL; - - if (mid_init(param == NULL ? NULL : const_cast<char *>(param[0])) < 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) { - return "error initializing timidity"; - } - } - DEBUG(driver, 1, "successfully initialised timidity"); - - _midi.options.rate = 44100; - _midi.options.format = MID_AUDIO_S16LSB; - _midi.options.channels = 2; - _midi.options.buffer_size = _midi.options.rate; - - return NULL; -} - -void MusicDriver_LibTimidity::Stop() -{ - if (_midi.status == MIDI_PLAYING) this->StopSong(); - mid_exit(); -} - -void MusicDriver_LibTimidity::PlaySong(const MusicSongInfo &song) -{ - std::string filename = MidiFile::GetSMFFile(song); - - this->StopSong(); - if (filename.empty()) return; - - _midi.stream = mid_istream_open_file(filename.c_str()); - if (_midi.stream == NULL) { - DEBUG(driver, 0, "Could not open music file"); - return; - } - - _midi.song = mid_song_load(_midi.stream, &_midi.options); - mid_istream_close(_midi.stream); - _midi.song_length = mid_song_get_total_time(_midi.song); - - if (_midi.song == NULL) { - DEBUG(driver, 1, "Invalid MIDI file"); - return; - } - - mid_song_start(_midi.song); - _midi.status = MIDI_PLAYING; -} - -void MusicDriver_LibTimidity::StopSong() -{ - _midi.status = MIDI_STOPPED; - /* mid_song_free cannot handle NULL! */ - if (_midi.song != NULL) mid_song_free(_midi.song); - _midi.song = NULL; -} - -bool MusicDriver_LibTimidity::IsSongPlaying() -{ - if (_midi.status == MIDI_PLAYING) { - _midi.song_position = mid_song_get_time(_midi.song); - if (_midi.song_position >= _midi.song_length) { - _midi.status = MIDI_STOPPED; - _midi.song_position = 0; - } - } - - return (_midi.status == MIDI_PLAYING); -} - -void MusicDriver_LibTimidity::SetVolume(byte vol) -{ - if (_midi.song != NULL) mid_song_set_volume(_midi.song, vol); -} diff --git a/src/music/libtimidity.h b/src/music/libtimidity.h deleted file mode 100644 index badb05bab..000000000 --- a/src/music/libtimidity.h +++ /dev/null @@ -1,41 +0,0 @@ -/* $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. - * 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/>. - */ - -/** @file libtimidity.h Base for LibTimidity music playback. */ - -#ifndef MUSIC_LIBTIMIDITY_H -#define MUSIC_LIBTIMIDITY_H - -#include "music_driver.hpp" - -/** Music driver making use of libtimidity. */ -class MusicDriver_LibTimidity : public MusicDriver { -public: - /* virtual */ const char *Start(const char * const *param); - - /* virtual */ void Stop(); - - /* virtual */ void PlaySong(const MusicSongInfo &song); - - /* virtual */ void StopSong(); - - /* virtual */ bool IsSongPlaying(); - - /* virtual */ void SetVolume(byte vol); - /* virtual */ const char *GetName() const { return "libtimidity"; } -}; - -/** Factory for the libtimidity driver. */ -class FMusicDriver_LibTimidity : public DriverFactoryBase { -public: - FMusicDriver_LibTimidity() : DriverFactoryBase(Driver::DT_MUSIC, 5, "libtimidity", "LibTimidity MIDI Driver") {} - /* virtual */ Driver *CreateInstance() const { return new MusicDriver_LibTimidity(); } -}; - -#endif /* MUSIC_LIBTIMIDITY_H */ |