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.
This commit is contained in:
Christoph Oelckers 2018-02-23 09:21:42 +01:00
parent aae832386f
commit 8734511e80
8 changed files with 7 additions and 480 deletions

View file

@ -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

View file

@ -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();
}

View file

@ -1,32 +0,0 @@
#ifndef __PATHEXPANDER_H
#define __PATHEXPANDER_H
#include "tarray.h"
#include "zstring.h"
#include "files.h"
class PathExpander
{
TArray<FString> 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

View file

@ -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

View file

@ -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;
}

View file

@ -21,7 +21,6 @@
#define TIMIDITY_H
#include "doomtype.h"
#include "pathexpander.h"
class FileReader;

View file

@ -30,15 +30,11 @@
#include <ctype.h>
#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)
{

View file

@ -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"