From 8734511e802640dcc335b59a84ed7a108d71cbbe Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 23 Feb 2018 09:21:42 +0100 Subject: [PATCH] Removed PathExpander and PseudoMidiDevice which are no longer being used PathExpander has been integrated into the sound font manager and PseudoMidiDevice was only used as the base class for the old Timidity++ device with the external executable. --- src/CMakeLists.txt | 16 +- src/pathexpander.cpp | 134 --------- src/pathexpander.h | 32 --- src/sound/i_musicinterns.h | 35 --- .../mididevices/music_pseudo_mididevice.cpp | 264 ------------------ src/sound/timidity/timidity.h | 1 - src/sound/timiditypp/common.cpp | 4 - src/sound/wildmidi/file_io.cpp | 1 - 8 files changed, 7 insertions(+), 480 deletions(-) delete mode 100644 src/pathexpander.cpp delete mode 100644 src/pathexpander.h delete mode 100644 src/sound/mididevices/music_pseudo_mididevice.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c85c0a586f..1f273bb4b5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,16 +52,16 @@ if( WIN32 ) set( WIN_TYPE Win32 ) set( XBITS x86 ) endif() - + add_definitions( -D_WIN32 ) - - + + if( ( MSVC14 AND NOT CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" ) OR # For VS 2015. ( MSVC15 AND NOT CMAKE_GENERATOR_TOOLSET STREQUAL "v141_xp" ) ) # For VS 2017. # for modern Windows SDKs the DirectX headers should be available by default. set( DX_dinput8_LIBRARY dinput8 ) else() - + find_path( D3D_INCLUDE_DIR d3d9.h PATHS ENV DXSDK_DIR PATH_SUFFIXES Include ) @@ -76,7 +76,7 @@ if( WIN32 ) else() include_directories( ${D3D_INCLUDE_DIR} ) endif() - + find_path( XINPUT_INCLUDE_DIR xinput.h PATHS ENV DXSDK_DIR PATH_SUFFIXES Include ) @@ -161,7 +161,7 @@ else() endif() endif() endif() - + if( NO_GTK ) add_definitions( -DNO_GTK ) elseif( DYN_GTK ) @@ -537,7 +537,7 @@ if( WIN32 ) set( SYSTEM_SOURCES_DIR win32 ) set( SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ) set( OTHER_SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} ${PLAT_UNIX_SOURCES} ) - + set( SYSTEM_SOURCES ${SYSTEM_SOURCES} win32/zdoom.rc ) elseif( APPLE ) if( OSX_COCOA_BACKEND ) @@ -910,7 +910,6 @@ set (PCH_SOURCES nodebuild_extract.cpp nodebuild_gl.cpp nodebuild_utility.cpp - pathexpander.cpp p_3dfloors.cpp p_3dmidtex.cpp p_acs.cpp @@ -1140,7 +1139,6 @@ set (PCH_SOURCES sound/i_soundfont.cpp sound/mididevices/music_opldumper_mididevice.cpp sound/mididevices/music_opl_mididevice.cpp - sound/mididevices/music_pseudo_mididevice.cpp sound/mididevices/music_fluidsynth_mididevice.cpp sound/mididevices/music_softsynth_mididevice.cpp sound/mididevices/music_timidity_mididevice.cpp diff --git a/src/pathexpander.cpp b/src/pathexpander.cpp deleted file mode 100644 index 70f9fccc30..0000000000 --- a/src/pathexpander.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* -** pathexpander.cpp -** Utility class for expanding a given path with a range of directories -** -**--------------------------------------------------------------------------- -** Copyright 2015 Christoph Oelckers -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**--------------------------------------------------------------------------- -** -*/ - -#include "pathexpander.h" -#include "cmdlib.h" -#include "w_wad.h" - -//============================================================================ -// -// -// -//============================================================================ - -static FString BuildPath(const FString &base, const char *name) -{ - FString current; - if (base.IsNotEmpty()) - { - current = base; - if (current.Back() != '/') current += '/'; - } - current += name; - return current; -} - -//============================================================================ -// -// This is meant to find and open files for reading. -// -//============================================================================ - -FileReader *PathExpander::openFileReader(const char *name, int *plumpnum) -{ - FileReader *fp; - FString current_filename; - - if (!name || !(*name)) - { - return 0; - } - - /* First try the given name */ - current_filename = name; - FixPathSeperator(current_filename); - - - if (openmode != OM_FILE) - { - int lumpnum = Wads.CheckNumForFullName(current_filename); - if (lumpnum >= 0) - { - fp = Wads.ReopenLumpNum(lumpnum); - if (plumpnum) *plumpnum = lumpnum; - return fp; - } - if (openmode == OM_LUMP) // search the path list when not loading the main config - { - for (unsigned int plp = PathList.Size(); plp-- != 0; ) - { /* Try along the path then */ - current_filename = BuildPath(PathList[plp], name); - lumpnum = Wads.CheckNumForFullName(current_filename); - if (lumpnum >= 0) - { - fp = Wads.ReopenLumpNum(lumpnum); - if (plumpnum) *plumpnum = lumpnum; - return fp; - } - } - return NULL; - } - } - if (plumpnum) *plumpnum = -1; - - - fp = new FileReader; - if (fp->Open(current_filename)) return fp; - - if (name[0] != '/') - { - for (unsigned int plp = PathList.Size(); plp-- != 0; ) - { /* Try along the path then */ - current_filename = BuildPath(PathList[plp], name); - if (fp->Open(current_filename)) return fp; - } - } - delete fp; - - /* Nothing could be opened. */ - return NULL; -} - -/* This adds a directory to the path list */ -void PathExpander::addToPathlist(const char *s) -{ - FString copy = s; - FixPathSeperator(copy); - PathList.Push(copy); -} - -void PathExpander::clearPathlist() -{ - PathList.Clear(); -} diff --git a/src/pathexpander.h b/src/pathexpander.h deleted file mode 100644 index 8582f3c7bc..0000000000 --- a/src/pathexpander.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __PATHEXPANDER_H -#define __PATHEXPANDER_H - -#include "tarray.h" -#include "zstring.h" -#include "files.h" - -class PathExpander -{ - TArray PathList; - -public: - int openmode; - - enum - { - OM_FILEORLUMP = 0, - OM_LUMP, - OM_FILE, - OM_ARCHIVE - }; - - PathExpander(int om = OM_FILEORLUMP) - { - openmode = om; - } - void addToPathlist(const char *s); - void clearPathlist(); - FileReader *openFileReader(const char *name, int *plumpnum); -}; - -#endif diff --git a/src/sound/i_musicinterns.h b/src/sound/i_musicinterns.h index 95ce0e876a..3af572cc78 100644 --- a/src/sound/i_musicinterns.h +++ b/src/sound/i_musicinterns.h @@ -94,41 +94,6 @@ MIDIDevice *CreateAudioToolboxMIDIDevice(); MIDIDevice *CreateTimidityPPMIDIDevice(const char *args); void TimidityPP_Shutdown(); -// Base class for pseudo-MIDI devices --------------------------------------- - -class PseudoMIDIDevice : public MIDIDevice -{ -public: - PseudoMIDIDevice(); - ~PseudoMIDIDevice(); - - void Close(); - bool IsOpen() const; - int GetTechnology() const; - bool Pause(bool paused); - int Resume(); - void Stop(); - int StreamOut(MidiHeader *data); - int StreamOutSync(MidiHeader *data); - int SetTempo(int tempo); - int SetTimeDiv(int timediv); - FString GetStats(); - -protected: - SoundStream *Stream; - bool Started; - bool bLooping; -}; - -// Sound System pseudo-MIDI device ------------------------------------------ - -class SndSysMIDIDevice : public PseudoMIDIDevice -{ -public: - int Open(MidiCallback, void *userdata); - bool Preprocess(MIDIStreamer *song, bool looping); -}; - // Base class for software synthesizer MIDI output devices ------------------ class SoftSynthMIDIDevice : public MIDIDevice diff --git a/src/sound/mididevices/music_pseudo_mididevice.cpp b/src/sound/mididevices/music_pseudo_mididevice.cpp deleted file mode 100644 index f85b3168d0..0000000000 --- a/src/sound/mididevices/music_pseudo_mididevice.cpp +++ /dev/null @@ -1,264 +0,0 @@ -/* -** music_pseudo_mididevice.cpp -** Common base class for pseudo MIDI devices. -** -**--------------------------------------------------------------------------- -** Copyright 2008-2010 Randy Heit -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**--------------------------------------------------------------------------- -** -*/ - -// HEADER FILES ------------------------------------------------------------ - -#include "i_musicinterns.h" -#include "templates.h" -#include "doomdef.h" -#include "m_swap.h" -#include "files.h" - -// MACROS ------------------------------------------------------------------ - -// TYPES ------------------------------------------------------------------- - -// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- - -// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- - -// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- - -// EXTERNAL DATA DECLARATIONS ---------------------------------------------- - -// PRIVATE DATA DEFINITIONS ------------------------------------------------ - -// PUBLIC DATA DEFINITIONS ------------------------------------------------- - -// CODE -------------------------------------------------------------------- - -//========================================================================== -// -// PseudoMIDIDevice Constructor -// -//========================================================================== - -PseudoMIDIDevice::PseudoMIDIDevice() -{ - Stream = NULL; - Started = false; - bLooping = true; -} - -//========================================================================== -// -// PseudoMIDIDevice Destructor -// -//========================================================================== - -PseudoMIDIDevice::~PseudoMIDIDevice() -{ - Close(); -} - -//========================================================================== -// -// PseudoMIDIDevice :: Close -// -//========================================================================== - -void PseudoMIDIDevice::Close() -{ - if (Stream != NULL) - { - delete Stream; - Stream = NULL; - } - Started = false; -} - -//========================================================================== -// -// PseudoMIDIDevice :: IsOpen -// -//========================================================================== - -bool PseudoMIDIDevice::IsOpen() const -{ - return Stream != NULL; -} - -//========================================================================== -// -// PseudoMIDIDevice :: GetTechnology -// -//========================================================================== - -int PseudoMIDIDevice::GetTechnology() const -{ - return MIDIDEV_MIDIPORT; -} - -//========================================================================== -// -// PseudoMIDIDevice :: Resume -// -//========================================================================== - -int PseudoMIDIDevice::Resume() -{ - if (!Started) - { - if (Stream && Stream->Play(bLooping, 1)) - { - Started = true; - return 0; - } - return 1; - } - return 0; -} - -//========================================================================== -// -// PseudoMIDIDevice :: Stop -// -//========================================================================== - -void PseudoMIDIDevice::Stop() -{ - if (Started) - { - if (Stream) - Stream->Stop(); - Started = false; - } -} - -//========================================================================== -// -// PseudoMIDIDevice :: Pause -// -//========================================================================== - -bool PseudoMIDIDevice::Pause(bool paused) -{ - if (Stream != NULL) - { - return Stream->SetPaused(paused); - } - return true; -} - -//========================================================================== -// -// PseudoMIDIDevice :: StreamOutSync -// -//========================================================================== - -int PseudoMIDIDevice::StreamOutSync(MidiHeader *header) -{ - assert(0); - return 0; -} - -//========================================================================== -// -// PseudoMIDIDevice :: StreamOut -// -//========================================================================== - -int PseudoMIDIDevice::StreamOut(MidiHeader *header) -{ - assert(0); - return 0; -} - -//========================================================================== -// -// PseudoMIDIDevice :: SetTempo -// -//========================================================================== - -int PseudoMIDIDevice::SetTempo(int tempo) -{ - return 0; -} - -//========================================================================== -// -// PseudoMIDIDevice :: SetTimeDiv -// -//========================================================================== - -int PseudoMIDIDevice::SetTimeDiv(int timediv) -{ - return 0; -} - -//========================================================================== -// -// PseudoMIDIDevice :: GetStats -// -//========================================================================== - -FString PseudoMIDIDevice::GetStats() -{ - if (Stream != NULL) - { - return Stream->GetStats(); - } - return "Pseudo MIDI device not open"; -} - - -//========================================================================== -// -// SndSysMIDIDevice :: Open -// -//========================================================================== - -int SndSysMIDIDevice::Open(MidiCallback callback, void *userdata) -{ - return 0; -} - -//========================================================================== -// -// SndSysMIDIDevice :: Preprocess -// -// Create a standard MIDI file and stream it. -// -//========================================================================== - -bool SndSysMIDIDevice::Preprocess(MIDIStreamer *song, bool looping) -{ - MemoryArrayReader *reader = new MemoryArrayReader(NULL, 0); - song->CreateSMF(reader->GetArray(), looping ? 0 : 1); - reader->UpdateLength(); - - bLooping = looping; - Stream = GSnd->OpenStream(reader, looping ? SoundStream::Loop : 0); - return false; -} diff --git a/src/sound/timidity/timidity.h b/src/sound/timidity/timidity.h index b44927f596..2f923b6977 100644 --- a/src/sound/timidity/timidity.h +++ b/src/sound/timidity/timidity.h @@ -21,7 +21,6 @@ #define TIMIDITY_H #include "doomtype.h" -#include "pathexpander.h" class FileReader; diff --git a/src/sound/timiditypp/common.cpp b/src/sound/timiditypp/common.cpp index 20cebc6167..b323a85d7e 100644 --- a/src/sound/timiditypp/common.cpp +++ b/src/sound/timiditypp/common.cpp @@ -30,15 +30,11 @@ #include #include "m_random.h" #include "common.h" -#include "pathexpander.h" #include "cmdlib.h" namespace TimidityPlus { -static PathExpander tppPathExpander; - - /* This'll allocate memory or die. */ void *safe_malloc(size_t count) { diff --git a/src/sound/wildmidi/file_io.cpp b/src/sound/wildmidi/file_io.cpp index 6e8b9628c0..fa7910a2c3 100644 --- a/src/sound/wildmidi/file_io.cpp +++ b/src/sound/wildmidi/file_io.cpp @@ -39,7 +39,6 @@ #include "files.h" #include "wm_error.h" #include "file_io.h" -#include "pathexpander.h" #include "cmdlib.h" #include "i_soundfont.h"