- moved the various music format files into their own directory.

This commit is contained in:
Christoph Oelckers 2017-03-10 22:26:02 +01:00
parent 95b181e618
commit 5eb9587135
13 changed files with 220 additions and 139 deletions

View file

@ -899,17 +899,7 @@ set( FASTMATH_SOURCES
sound/i_music.cpp
sound/i_sound.cpp
sound/mpg123_decoder.cpp
sound/music_cd.cpp
sound/music_dumb.cpp
sound/music_gme.cpp
sound/music_mus_midiout.cpp
sound/music_smf_midiout.cpp
sound/music_hmi_midiout.cpp
sound/music_xmi_midiout.cpp
sound/music_midistream.cpp
sound/music_midi_base.cpp
sound/music_mus_opl.cpp
sound/music_stream.cpp
sound/oalsound.cpp
sound/sndfile_decoder.cpp
sound/mididevices/music_timiditypp_mididevice.cpp
@ -1245,6 +1235,16 @@ set (PCH_SOURCES
sound/mididevices/music_softsynth_mididevice.cpp
sound/mididevices/music_timidity_mididevice.cpp
sound/mididevices/music_wildmidi_mididevice.cpp
sound/musicformats/music_cd.cpp
sound/musicformats/music_dumb.cpp
sound/musicformats/music_gme.cpp
sound/musicformats/music_mus_midiout.cpp
sound/musicformats/music_smf_midiout.cpp
sound/musicformats/music_hmi_midiout.cpp
sound/musicformats/music_xmi_midiout.cpp
sound/musicformats/music_midistream.cpp
sound/musicformats/music_opl.cpp
sound/musicformats/music_stream.cpp
sound/oplsynth/fmopl.cpp
sound/oplsynth/mlopl.cpp
sound/oplsynth/mlopl_io.cpp
@ -1445,6 +1445,7 @@ source_group("Audio Files\\OPL Synth\\DOSBox" FILES sound/oplsynth/dosbox/opl.cp
source_group("Audio Files\\Timidity" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/timidity/.+")
source_group("Audio Files\\WildMidi" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/wildmidi/.+")
source_group("Audio Files\\MIDI Devices" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/mididevices/.+")
source_group("Audio Files\\Music formats" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/musicformats/.+")
source_group("External\\Math" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/math/.+")
source_group("External\\RapidJSON" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/.+")
source_group("External\\SFMT" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sfmt/.+")

View file

@ -1,115 +0,0 @@
#include "i_musicinterns.h"
void StreamSong::Play (bool looping, int subsong)
{
m_Status = STATE_Stopped;
m_Looping = looping;
if (m_Stream->Play (m_Looping, 1))
{
if (subsong != 0)
{
m_Stream->SetOrder (subsong);
}
m_Status = STATE_Playing;
}
}
void StreamSong::Pause ()
{
if (m_Status == STATE_Playing && m_Stream != NULL)
{
if (m_Stream->SetPaused (true))
m_Status = STATE_Paused;
}
}
void StreamSong::Resume ()
{
if (m_Status == STATE_Paused && m_Stream != NULL)
{
if (m_Stream->SetPaused (false))
m_Status = STATE_Playing;
}
}
void StreamSong::Stop ()
{
if (m_Status != STATE_Stopped && m_Stream)
{
m_Stream->Stop ();
}
m_Status = STATE_Stopped;
}
StreamSong::~StreamSong ()
{
Stop ();
if (m_Stream != NULL)
{
delete m_Stream;
m_Stream = NULL;
}
}
StreamSong::StreamSong (FileReader *reader)
{
m_Stream = GSnd->OpenStream (reader, SoundStream::Loop);
}
StreamSong::StreamSong (const char *url)
{
m_Stream = GSnd->OpenStream (url, SoundStream::Loop);
}
bool StreamSong::IsPlaying ()
{
if (m_Status != STATE_Stopped)
{
if (m_Stream->IsEnded())
{
Stop();
return false;
}
return true;
}
return false;
}
//
// StreamSong :: SetPosition
//
// Sets the position in ms.
bool StreamSong::SetPosition(unsigned int pos)
{
if (m_Stream != NULL)
{
return m_Stream->SetPosition(pos);
}
else
{
return false;
}
}
bool StreamSong::SetSubsong(int subsong)
{
if (m_Stream != NULL)
{
return m_Stream->SetOrder(subsong);
}
else
{
return false;
}
}
FString StreamSong::GetStats()
{
if (m_Stream != NULL)
{
return m_Stream->GetStats();
}
return "No song loaded\n";
}

View file

@ -3,20 +3,34 @@
** Alternative module player, using a modified DUMB for decoding.
** Based on the Foobar2000 component foo_dumb, version 0.9.8.4.
**
** I tried doing this as an FMOD codec, but the built-in codecs
** take precedence over user-created ones, so this never saw any
** of the files.
**---------------------------------------------------------------------------
** Copyright 2008 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.
**---------------------------------------------------------------------------
**
** Note that if the replayer isn't fast enough to provide data
** for the stream in a timely manner, you'll hear random data at
** those points. I mention this because the debug version of DUMB
** is *MUCH, MUCH, MUCH* slower than the release version. If your
** processor only has a single core, you probably shouldn't even
** use the debug version of DUMB. Unfortunately, when I tried
** linking the debug build of ZDoom against a release build of DUMB,
** there were some files that would not load, even though they
** loaded fine when the DUMB build type matched the ZDoom build type.
** (Applies to Visual C++, GCC should be fine, I think.)
*/
// HEADER FILES ------------------------------------------------------------

View file

@ -1,3 +1,36 @@
/*
** music_opl.cpp
** Plays raw OPL formats
**
**---------------------------------------------------------------------------
** Copyright 1998-2008 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.
**---------------------------------------------------------------------------
*/
#include "i_musicinterns.h"
#include "oplsynth/muslib.h"
#include "oplsynth/opl.h"

View file

@ -0,0 +1,148 @@
/*
** music_stream.cpp
** Wrapper around the sound system's streaming feature for music.
**
**---------------------------------------------------------------------------
** Copyright 2008 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.
**---------------------------------------------------------------------------
*/
#include "i_musicinterns.h"
void StreamSong::Play (bool looping, int subsong)
{
m_Status = STATE_Stopped;
m_Looping = looping;
if (m_Stream->Play (m_Looping, 1))
{
if (subsong != 0)
{
m_Stream->SetOrder (subsong);
}
m_Status = STATE_Playing;
}
}
void StreamSong::Pause ()
{
if (m_Status == STATE_Playing && m_Stream != NULL)
{
if (m_Stream->SetPaused (true))
m_Status = STATE_Paused;
}
}
void StreamSong::Resume ()
{
if (m_Status == STATE_Paused && m_Stream != NULL)
{
if (m_Stream->SetPaused (false))
m_Status = STATE_Playing;
}
}
void StreamSong::Stop ()
{
if (m_Status != STATE_Stopped && m_Stream)
{
m_Stream->Stop ();
}
m_Status = STATE_Stopped;
}
StreamSong::~StreamSong ()
{
Stop ();
if (m_Stream != NULL)
{
delete m_Stream;
m_Stream = NULL;
}
}
StreamSong::StreamSong (FileReader *reader)
{
m_Stream = GSnd->OpenStream (reader, SoundStream::Loop);
}
StreamSong::StreamSong (const char *url)
{
m_Stream = GSnd->OpenStream (url, SoundStream::Loop);
}
bool StreamSong::IsPlaying ()
{
if (m_Status != STATE_Stopped)
{
if (m_Stream->IsEnded())
{
Stop();
return false;
}
return true;
}
return false;
}
//
// StreamSong :: SetPosition
//
// Sets the position in ms.
bool StreamSong::SetPosition(unsigned int pos)
{
if (m_Stream != NULL)
{
return m_Stream->SetPosition(pos);
}
else
{
return false;
}
}
bool StreamSong::SetSubsong(int subsong)
{
if (m_Stream != NULL)
{
return m_Stream->SetOrder(subsong);
}
else
{
return false;
}
}
FString StreamSong::GetStats()
{
if (m_Stream != NULL)
{
return m_Stream->GetStats();
}
return "No song loaded\n";
}

View file

@ -35,7 +35,7 @@
#include <errno.h>
#include "../files.h"
#include "files.h"
#include "wm_error.h"
#include "file_io.h"
#include "pathexpander.h"