mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- Fixed today's work now that I'm able to hear some sound again. Also some reorganization
This commit is contained in:
parent
ddedcd9fc2
commit
d25cc1baa0
10 changed files with 48 additions and 38 deletions
|
@ -1143,14 +1143,15 @@ set (PCH_SOURCES
|
||||||
sound/mididevices/music_softsynth_mididevice.cpp
|
sound/mididevices/music_softsynth_mididevice.cpp
|
||||||
sound/mididevices/music_timidity_mididevice.cpp
|
sound/mididevices/music_timidity_mididevice.cpp
|
||||||
sound/mididevices/music_wildmidi_mididevice.cpp
|
sound/mididevices/music_wildmidi_mididevice.cpp
|
||||||
|
sound/midisources/midisource.cpp
|
||||||
|
sound/midisources/midisource_mus.cpp
|
||||||
|
sound/midisources/midisource_smf.cpp
|
||||||
|
sound/midisources/midisource_hmi.cpp
|
||||||
|
sound/midisources/midisource_xmi.cpp
|
||||||
sound/musicformats/music_cd.cpp
|
sound/musicformats/music_cd.cpp
|
||||||
sound/musicformats/music_dumb.cpp
|
sound/musicformats/music_dumb.cpp
|
||||||
sound/musicformats/music_gme.cpp
|
sound/musicformats/music_gme.cpp
|
||||||
sound/musicformats/music_libsndfile.cpp
|
sound/musicformats/music_libsndfile.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_midistream.cpp
|
||||||
sound/musicformats/music_opl.cpp
|
sound/musicformats/music_opl.cpp
|
||||||
sound/musicformats/music_stream.cpp
|
sound/musicformats/music_stream.cpp
|
||||||
|
@ -1354,6 +1355,7 @@ source_group("Audio Files\\Timidity" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE
|
||||||
source_group("Audio Files\\Timiditypp" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/timiditypp/.+")
|
source_group("Audio Files\\Timiditypp" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/timiditypp/.+")
|
||||||
source_group("Audio Files\\WildMidi" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/wildmidi/.+")
|
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\\MIDI Devices" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/mididevices/.+")
|
||||||
|
source_group("Audio Files\\MIDI Sources" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/midisources/.+")
|
||||||
source_group("Audio Files\\Music formats" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/musicformats/.+")
|
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\\Math" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/math/.+")
|
||||||
source_group("External\\RapidJSON" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/.+")
|
source_group("External\\RapidJSON" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/.+")
|
||||||
|
|
|
@ -117,13 +117,13 @@ CUSTOM_CVAR (Float, snd_musicvolume, 0.5f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Set general music volume.
|
// Set general music volume.
|
||||||
if (GSnd != NULL)
|
if (GSnd != nullptr)
|
||||||
{
|
{
|
||||||
GSnd->SetMusicVolume(clamp<float>(self * relative_volume, 0, 1));
|
GSnd->SetMusicVolume(clamp<float>(self * relative_volume, 0, 1));
|
||||||
}
|
}
|
||||||
// For music not implemented through the digital sound system,
|
// For music not implemented through the digital sound system,
|
||||||
// let them know about the change.
|
// let them know about the change.
|
||||||
if (currSong != NULL)
|
if (currSong != nullptr)
|
||||||
{
|
{
|
||||||
currSong->MusicVolumeChanged();
|
currSong->MusicVolumeChanged();
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ void I_ShutdownMusic(bool onexit)
|
||||||
if (currSong)
|
if (currSong)
|
||||||
{
|
{
|
||||||
S_StopMusic (true);
|
S_StopMusic (true);
|
||||||
assert (currSong == NULL);
|
assert (currSong == nullptr);
|
||||||
}
|
}
|
||||||
Timidity::FreeAll();
|
Timidity::FreeAll();
|
||||||
if (onexit)
|
if (onexit)
|
||||||
|
@ -207,7 +207,7 @@ MusInfo::MusInfo()
|
||||||
|
|
||||||
MusInfo::~MusInfo ()
|
MusInfo::~MusInfo ()
|
||||||
{
|
{
|
||||||
if (currSong == this) currSong = NULL;
|
if (currSong == this) currSong = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -233,7 +233,7 @@ void MusInfo::Start(bool loop, float rel_vol, int subsong)
|
||||||
if (m_Status == MusInfo::STATE_Playing)
|
if (m_Status == MusInfo::STATE_Playing)
|
||||||
currSong = this;
|
currSong = this;
|
||||||
else
|
else
|
||||||
currSong = NULL;
|
currSong = nullptr;
|
||||||
|
|
||||||
// Notify the sound system of the changed relative volume
|
// Notify the sound system of the changed relative volume
|
||||||
snd_musicvolume.Callback();
|
snd_musicvolume.Callback();
|
||||||
|
@ -299,12 +299,12 @@ FString MusInfo::GetStats()
|
||||||
|
|
||||||
MusInfo *MusInfo::GetOPLDumper(const char *filename)
|
MusInfo *MusInfo::GetOPLDumper(const char *filename)
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MusInfo *MusInfo::GetWaveDumper(const char *filename, int rate)
|
MusInfo *MusInfo::GetWaveDumper(const char *filename, int rate)
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -331,7 +331,7 @@ static MIDISource *CreateMIDISource(FileReader &reader, EMIDIType miditype)
|
||||||
return new XMISong(reader);
|
return new XMISong(reader);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ static EMIDIType IdentifyMIDIType(uint32_t *id, int size)
|
||||||
|
|
||||||
MusInfo *I_RegisterSong (FileReader *reader, MidiDeviceSetting *device)
|
MusInfo *I_RegisterSong (FileReader *reader, MidiDeviceSetting *device)
|
||||||
{
|
{
|
||||||
MusInfo *info = NULL;
|
MusInfo *info = nullptr;
|
||||||
const char *fmt;
|
const char *fmt;
|
||||||
uint32_t id[32/4];
|
uint32_t id[32/4];
|
||||||
|
|
||||||
|
@ -431,11 +431,11 @@ MusInfo *I_RegisterSong (FileReader *reader, MidiDeviceSetting *device)
|
||||||
{
|
{
|
||||||
delete[] gzipped;
|
delete[] gzipped;
|
||||||
delete reader;
|
delete reader;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
delete reader;
|
delete reader;
|
||||||
|
|
||||||
MemoryArrayReader *memreader = new MemoryArrayReader(NULL, 0);
|
MemoryArrayReader *memreader = new MemoryArrayReader(nullptr, 0);
|
||||||
if (!ungzip(gzipped, len, memreader->GetArray()))
|
if (!ungzip(gzipped, len, memreader->GetArray()))
|
||||||
{
|
{
|
||||||
delete[] gzipped;
|
delete[] gzipped;
|
||||||
|
@ -460,32 +460,41 @@ MusInfo *I_RegisterSong (FileReader *reader, MidiDeviceSetting *device)
|
||||||
if (source == nullptr) return 0;
|
if (source == nullptr) return 0;
|
||||||
if (!source->isValid())
|
if (!source->isValid())
|
||||||
{
|
{
|
||||||
|
delete reader;
|
||||||
delete source;
|
delete source;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fixme: device and streamer need to be handled individually.
|
// fixme: device and streamer need to be handled individually.
|
||||||
EMidiDevice devtype = device == NULL? MDEV_DEFAULT : (EMidiDevice)device->device;
|
EMidiDevice devtype = device == nullptr? MDEV_DEFAULT : (EMidiDevice)device->device;
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
// non-Windows platforms don't support MDEV_MMAPI so map to MDEV_SNDSYS
|
// non-Windows platforms don't support MDEV_MMAPI so map to MDEV_SNDSYS
|
||||||
if (devtype == MDEV_MMAPI)
|
if (devtype == MDEV_MMAPI)
|
||||||
devtype = MDEV_SNDSYS;
|
devtype = MDEV_SNDSYS;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
MIDIStreamer *streamer = nullptr;
|
||||||
retry_as_sndsys:
|
retry_as_sndsys:
|
||||||
info = CreateMIDIStreamer(devtype, device != NULL? device->args.GetChars() : "");
|
streamer = CreateMIDIStreamer(devtype, device != nullptr? device->args.GetChars() : "");
|
||||||
|
|
||||||
if (info == NULL && devtype != MDEV_SNDSYS && snd_mididevice < 0)
|
if (streamer == nullptr && devtype != MDEV_SNDSYS && snd_mididevice < 0)
|
||||||
{
|
{
|
||||||
devtype = MDEV_SNDSYS;
|
devtype = MDEV_SNDSYS;
|
||||||
goto retry_as_sndsys;
|
goto retry_as_sndsys;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (info == NULL && devtype != MDEV_MMAPI && snd_mididevice >= 0)
|
if (streamer == nullptr && devtype != MDEV_MMAPI && snd_mididevice >= 0)
|
||||||
{
|
{
|
||||||
info = CreateMIDIStreamer(MDEV_MMAPI, "");
|
streamer = CreateMIDIStreamer(MDEV_MMAPI, "");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (streamer == nullptr)
|
||||||
|
{
|
||||||
|
delete reader;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
streamer->SetMIDISource(source);
|
||||||
|
info = streamer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for various raw OPL formats
|
// Check for various raw OPL formats
|
||||||
|
@ -494,10 +503,10 @@ retry_as_sndsys:
|
||||||
(id[0] == MAKE_ID('D','B','R','A') && id[1] == MAKE_ID('W','O','P','L')) || // DosBox Raw OPL
|
(id[0] == MAKE_ID('D','B','R','A') && id[1] == MAKE_ID('W','O','P','L')) || // DosBox Raw OPL
|
||||||
(id[0] == MAKE_ID('A','D','L','I') && *((uint8_t *)id + 4) == 'B')) // Martin Fernandez's modified IMF
|
(id[0] == MAKE_ID('A','D','L','I') && *((uint8_t *)id + 4) == 'B')) // Martin Fernandez's modified IMF
|
||||||
{
|
{
|
||||||
info = new OPLMUSSong (*reader, device != NULL? device->args.GetChars() : "");
|
info = new OPLMUSSong (*reader, device != nullptr? device->args.GetChars() : "");
|
||||||
}
|
}
|
||||||
// Check for game music
|
// Check for game music
|
||||||
else if ((fmt = GME_CheckFormat(id[0])) != NULL && fmt[0] != '\0')
|
else if ((fmt = GME_CheckFormat(id[0])) != nullptr && fmt[0] != '\0')
|
||||||
{
|
{
|
||||||
info = GME_OpenSong(*reader, fmt);
|
info = GME_OpenSong(*reader, fmt);
|
||||||
}
|
}
|
||||||
|
@ -512,7 +521,7 @@ retry_as_sndsys:
|
||||||
if (info != nullptr) reader = nullptr;
|
if (info != nullptr) reader = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info == NULL)
|
if (info == nullptr)
|
||||||
{
|
{
|
||||||
// Check for CDDA "format"
|
// Check for CDDA "format"
|
||||||
if (id[0] == (('R')|(('I')<<8)|(('F')<<16)|(('F')<<24)))
|
if (id[0] == (('R')|(('I')<<8)|(('F')<<16)|(('F')<<24)))
|
||||||
|
@ -535,12 +544,12 @@ retry_as_sndsys:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reader != NULL) delete reader;
|
if (reader != nullptr) delete reader;
|
||||||
|
|
||||||
if (info && !info->IsValid ())
|
if (info && !info->IsValid ())
|
||||||
{
|
{
|
||||||
delete info;
|
delete info;
|
||||||
info = NULL;
|
info = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
|
@ -559,7 +568,7 @@ MusInfo *I_RegisterCDSong (int track, int id)
|
||||||
if (info && !info->IsValid ())
|
if (info && !info->IsValid ())
|
||||||
{
|
{
|
||||||
delete info;
|
delete info;
|
||||||
info = NULL;
|
info = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
|
@ -649,7 +658,7 @@ static bool ungzip(uint8_t *data, int complen, TArray<uint8_t> &newdata)
|
||||||
|
|
||||||
void I_UpdateMusic()
|
void I_UpdateMusic()
|
||||||
{
|
{
|
||||||
if (currSong != NULL)
|
if (currSong != nullptr)
|
||||||
{
|
{
|
||||||
currSong->Update();
|
currSong->Update();
|
||||||
}
|
}
|
||||||
|
@ -686,7 +695,7 @@ CCMD(testmusicvol)
|
||||||
{
|
{
|
||||||
if (argv.argc() > 1)
|
if (argv.argc() > 1)
|
||||||
{
|
{
|
||||||
relative_volume = (float)strtod(argv[1], NULL);
|
relative_volume = (float)strtod(argv[1], nullptr);
|
||||||
snd_musicvolume.Callback();
|
snd_musicvolume.Callback();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -701,7 +710,7 @@ CCMD(testmusicvol)
|
||||||
|
|
||||||
ADD_STAT(music)
|
ADD_STAT(music)
|
||||||
{
|
{
|
||||||
if (currSong != NULL)
|
if (currSong != nullptr)
|
||||||
{
|
{
|
||||||
return currSong->GetStats();
|
return currSong->GetStats();
|
||||||
}
|
}
|
||||||
|
@ -721,14 +730,14 @@ UNSAFE_CCMD (writeopl)
|
||||||
{
|
{
|
||||||
if (argv.argc() == 2)
|
if (argv.argc() == 2)
|
||||||
{
|
{
|
||||||
if (currSong == NULL)
|
if (currSong == nullptr)
|
||||||
{
|
{
|
||||||
Printf ("No song is currently playing.\n");
|
Printf ("No song is currently playing.\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MusInfo *dumper = currSong->GetOPLDumper(argv[1]);
|
MusInfo *dumper = currSong->GetOPLDumper(argv[1]);
|
||||||
if (dumper == NULL)
|
if (dumper == nullptr)
|
||||||
{
|
{
|
||||||
Printf ("Current song cannot be saved as OPL data.\n");
|
Printf ("Current song cannot be saved as OPL data.\n");
|
||||||
}
|
}
|
||||||
|
@ -759,14 +768,14 @@ UNSAFE_CCMD (writewave)
|
||||||
{
|
{
|
||||||
if (argv.argc() >= 2 && argv.argc() <= 3)
|
if (argv.argc() >= 2 && argv.argc() <= 3)
|
||||||
{
|
{
|
||||||
if (currSong == NULL)
|
if (currSong == nullptr)
|
||||||
{
|
{
|
||||||
Printf ("No song is currently playing.\n");
|
Printf ("No song is currently playing.\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MusInfo *dumper = currSong->GetWaveDumper(argv[1], argv.argc() == 3 ? atoi(argv[2]) : 0);
|
MusInfo *dumper = currSong->GetWaveDumper(argv[1], argv.argc() == 3 ? atoi(argv[2]) : 0);
|
||||||
if (dumper == NULL)
|
if (dumper == nullptr)
|
||||||
{
|
{
|
||||||
Printf ("Current song cannot be saved as wave data.\n");
|
Printf ("Current song cannot be saved as wave data.\n");
|
||||||
}
|
}
|
||||||
|
@ -835,7 +844,7 @@ UNSAFE_CCMD (writemidi)
|
||||||
|
|
||||||
source->CreateSMF(midi, 1);
|
source->CreateSMF(midi, 1);
|
||||||
auto f = FileWriter::Open(argv[2]);
|
auto f = FileWriter::Open(argv[2]);
|
||||||
if (f == NULL)
|
if (f == nullptr)
|
||||||
{
|
{
|
||||||
Printf("Could not open %s.\n", argv[2]);
|
Printf("Could not open %s.\n", argv[2]);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "s_sound.h"
|
#include "s_sound.h"
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
#include "wildmidi/wildmidi_lib.h"
|
#include "wildmidi/wildmidi_lib.h"
|
||||||
#include "midisources.h"
|
#include "midisources/midisource.h"
|
||||||
|
|
||||||
void I_InitMusicWin32 ();
|
void I_InitMusicWin32 ();
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "i_musicinterns.h"
|
#include "i_musicinterns.h"
|
||||||
#include "midisources.h"
|
#include "midisource.h"
|
||||||
|
|
||||||
|
|
||||||
char MIDI_EventLengths[7] = { 2, 2, 2, 2, 1, 1, 2 };
|
char MIDI_EventLengths[7] = { 2, 2, 2, 2, 1, 1, 2 };
|
|
@ -39,7 +39,7 @@
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
#include "midisources.h"
|
#include "midisource.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
|
@ -54,7 +54,6 @@ static bool nummididevicesset;
|
||||||
|
|
||||||
static void AddDefaultMidiDevices(FOptionValues *opt)
|
static void AddDefaultMidiDevices(FOptionValues *opt)
|
||||||
{
|
{
|
||||||
int p;
|
|
||||||
FOptionValues::Pair *pair = &opt->mValues[opt->mValues.Reserve(NUM_DEF_DEVICES)];
|
FOptionValues::Pair *pair = &opt->mValues[opt->mValues.Reserve(NUM_DEF_DEVICES)];
|
||||||
pair[0].Text = "FluidSynth";
|
pair[0].Text = "FluidSynth";
|
||||||
pair[0].Value = -5.0;
|
pair[0].Value = -5.0;
|
||||||
|
|
Loading…
Reference in a new issue