- moved the stream sources to zmusic project.

This commit is contained in:
Christoph Oelckers 2019-09-29 13:33:09 +02:00
parent 247346e821
commit 859028b35a
12 changed files with 59 additions and 20 deletions

View file

@ -38,7 +38,7 @@ elseif( FLUIDSYNTH_FOUND )
endif()
include_directories( "${ADL_INCLUDE_DIR}" "${OPN_INCLUDE_DIR}" "${TIMIDITYPP_INCLUDE_DIR}" "${TIMIDITY_INCLUDE_DIR}" "${WILDMIDI_INCLUDE_DIR}" "${OPLSYNTH_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" )
include_directories( "../libraries/dumb/include" "${ADL_INCLUDE_DIR}" "${OPN_INCLUDE_DIR}" "${TIMIDITYPP_INCLUDE_DIR}" "${TIMIDITY_INCLUDE_DIR}" "${WILDMIDI_INCLUDE_DIR}" "${OPLSYNTH_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" )
if (WIN32)
set( PLAT_WIN32_SOURCES
@ -50,6 +50,7 @@ file( GLOB HEADER_FILES
mididevices/*.h
midisources/*.h
decoder/*.h
streamsources/*.h
thirdparty/*.h
)
add_library( zmusic STATIC
@ -70,6 +71,11 @@ add_library( zmusic STATIC
midisources/midisource_smf.cpp
midisources/midisource_hmi.cpp
midisources/midisource_xmi.cpp
streamsources/music_dumb.cpp
streamsources/music_gme.cpp
streamsources/music_libsndfile.cpp
streamsources/music_opl.cpp
streamsources/music_xa.cpp
decoder/sounddecoder.cpp
decoder/sndfile_decoder.cpp
decoder/mpg123_decoder.cpp
@ -82,4 +88,5 @@ source_group("MIDI Devices" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/mid
source_group("MIDI Sources" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/midisources/.+")
source_group("MIDI Headers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/zmusic/.+")
source_group("Sound Decoding" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/decoder/.+")
source_group("Stream Sources" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/streamsources/.+")
source_group("Third Party" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/.+")

View file

@ -45,7 +45,7 @@
#undef CDECL // w32api's windef.h defines this
#include "../dumb/include/dumb.h"
#include "../dumb/include/internal/it.h"
#include "m_swap.h"
#include "zmusic/m_swap.h"
#include "zmusic/mididefs.h"
#include "zmusic/midiconfig.h"
#include "../../libraries/music_common/fileio.h"

View file

@ -35,6 +35,7 @@
// HEADER FILES ------------------------------------------------------------
#include <mutex>
#include <algorithm>
#include "streamsource.h"
#include "zmusic/sounddecoder.h"

View file

@ -32,9 +32,9 @@
*/
#include "streamsource.h"
#include "../libraries/oplsynth/oplsynth/opl.h"
#include "../libraries/oplsynth/oplsynth/opl_mus_player.h"
#include "../libraries/music_common/fileio.h"
#include "oplsynth/opl.h"
#include "oplsynth/opl_mus_player.h"
#include "../../libraries/music_common/fileio.h"
#include "zmusic/midiconfig.h"

View file

@ -1,5 +1,6 @@
#include <algorithm>
#include "streamsource.h"
#include "../libraries/music_common/fileio.h"
#include "../../libraries/music_common/fileio.h"
/**
* PlayStation XA (ADPCM) source support for MultiVoc

View file

@ -0,0 +1,39 @@
#pragma once
// Anything streamed to the sound system as raw wave data, except MIDIs --------------------
#include <stdlib.h>
#include "zmusic/mididefs.h" // for StreamSourceInfo
#include "zmusic/midiconfig.h"
class StreamSource
{
protected:
bool m_Looping = true;
int m_OutputRate;
public:
StreamSource (int outputRate) { m_OutputRate = outputRate; }
virtual ~StreamSource () {}
virtual void SetPlayMode(bool looping) { m_Looping = looping; }
virtual bool Start() { return true; }
virtual bool SetPosition(unsigned position) { return false; }
virtual bool SetSubsong(int subsong) { return false; }
virtual bool GetData(void *buffer, size_t len) = 0;
virtual SoundStreamInfo GetFormat() { return {65536, m_OutputRate, 2 }; } // Default format is: System's output sample rate, 32 bit float, stereo
virtual std::string GetStats() { return ""; }
virtual void ChangeSettingInt(const char *name, int value) { }
virtual void ChangeSettingNum(const char *name, double value) { }
virtual void ChangeSettingString(const char *name, const char *value) { }
protected:
StreamSource() = default;
};
StreamSource *MOD_OpenSong(MusicIO::FileInterface* reader, DumbConfig* config, int samplerate);
StreamSource* GME_OpenSong(MusicIO::FileInterface* reader, const char* fmt, float stereo_depth, int sample_rate);
StreamSource *SndFile_OpenSong(MusicIO::FileInterface* fr);
StreamSource* XA_OpenSong(MusicIO::FileInterface* reader);
StreamSource* OPL_OpenSong(MusicIO::FileInterface* reader, OPLConfig *config);

View file

@ -1,5 +1,7 @@
#pragma once
#include <stdint.h>
enum
{
MAX_MIDI_EVENTS = 128

View file

@ -463,7 +463,7 @@ set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ZLIB_LIBRARIES}" "${JPEG_LIBRARIES}" "${BZIP2_L
if (HAVE_VULKAN)
set( ZDOOM_LIBS ${ZDOOM_LIBS} "glslang" "SPIRV" "OGLCompiler")
endif()
include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" )
include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" )
if( ${HAVE_VM_JIT} )
add_definitions( -DHAVE_VM_JIT )
@ -1161,13 +1161,8 @@ set (PCH_SOURCES
sound/backend/i_sound.cpp
sound/music/midi_cvars.cpp
sound/musicformats/music_cd.cpp
sound/musicformats/music_dumb.cpp
sound/musicformats/music_gme.cpp
sound/musicformats/music_libsndfile.cpp
sound/musicformats/music_midistream.cpp
sound/musicformats/music_opl.cpp
sound/musicformats/music_stream.cpp
sound/musicformats/music_xa.cpp
rendering/swrenderer/textures/r_swtexture.cpp
rendering/swrenderer/textures/warptexture.cpp
rendering/swrenderer/textures/swcanvastexture.cpp
@ -1288,7 +1283,6 @@ include_directories( .
rendering
rendering/vulkan/thirdparty
../libraries/gdtoa
../libraries/dumb/include
../libraries/glslang/glslang/Public
../libraries/glslang/spirv
${CMAKE_BINARY_DIR}/libraries/gdtoa

View file

@ -47,6 +47,7 @@
#include "stats.h"
#include "vm.h"
#include "s_music.h"
#include "streamsources/streamsource.h"
#include "filereadermusicinterface.h"
#include "../libraries/zmusic/midisources/midisource.h"
#include "../libraries/dumb/include/dumb.h"

View file

@ -152,12 +152,6 @@ void Dumb_SetupConfig(DumbConfig* config);
class StreamSource;
StreamSource *MOD_OpenSong(MusicIO::FileInterface* reader, DumbConfig* config, int samplerate);
StreamSource* GME_OpenSong(MusicIO::FileInterface* reader, const char* fmt, float stereo_depth, int sample_rate);
StreamSource *SndFile_OpenSong(MusicIO::FileInterface* fr);
StreamSource* XA_OpenSong(MusicIO::FileInterface* reader);
StreamSource* OPL_OpenSong(MusicIO::FileInterface* reader, OPLConfig *config);
// stream song ------------------------------------------
MusInfo *OpenStreamSong(StreamSource *source);

View file

@ -33,7 +33,7 @@
*/
#include "i_musicinterns.h"
#include "streamsource.h"
#include "streamsources/streamsource.h"
class StreamSong : public MusInfo
{