diff --git a/libraries/zmusic/mididevices/mididevice.h b/libraries/zmusic/mididevices/mididevice.h index 27e06e170..5cda68017 100644 --- a/libraries/zmusic/mididevices/mididevice.h +++ b/libraries/zmusic/mididevices/mididevice.h @@ -70,18 +70,18 @@ public: SoftSynthMIDIDevice(int samplerate, int minrate = 1, int maxrate = 1000000 /* something higher than any valid value */); ~SoftSynthMIDIDevice(); - void Close(); - bool IsOpen() const; - int GetTechnology() const; - int SetTempo(int tempo); - int SetTimeDiv(int timediv); - int StreamOut(MidiHeader *data); - int StreamOutSync(MidiHeader *data); - int Resume(); - void Stop(); - bool Pause(bool paused); + void Close() override; + bool IsOpen() const override; + int GetTechnology() const override; + int SetTempo(int tempo) override; + int SetTimeDiv(int timediv) override; + int StreamOut(MidiHeader *data) override; + int StreamOutSync(MidiHeader *data) override; + int Resume() override; + void Stop() override; + bool Pause(bool paused) override; - virtual int Open(); + virtual int Open() override; virtual bool ServiceStream(void* buff, int numbytes); int GetSampleRate() const { return SampleRate; } SoundStreamInfo GetStreamInfo() const override; diff --git a/libraries/zmusic/mididevices/music_adlmidi_mididevice.cpp b/libraries/zmusic/mididevices/music_adlmidi_mididevice.cpp index 54f7e6ef3..acb0c695b 100644 --- a/libraries/zmusic/mididevices/music_adlmidi_mididevice.cpp +++ b/libraries/zmusic/mididevices/music_adlmidi_mididevice.cpp @@ -46,14 +46,14 @@ public: ADLMIDIDevice(const ADLConfig *config); ~ADLMIDIDevice(); - int OpenRenderer(); + int OpenRenderer() override; int GetDeviceType() const override { return MDEV_ADL; } protected: - void HandleEvent(int status, int parm1, int parm2); - void HandleLongEvent(const uint8_t *data, int len); - void ComputeOutput(float *buffer, int len); + void HandleEvent(int status, int parm1, int parm2) override; + void HandleLongEvent(const uint8_t *data, int len) override; + void ComputeOutput(float *buffer, int len) override; private: int LoadCustomBank(const ADLConfig *config); @@ -236,7 +236,7 @@ MIDIDevice *CreateADLMIDIDevice(const char *Args) if (*bank >= '0' && *bank <= '9') { // Args specify a bank by index. - int newbank = (int)strtoll(bank, nullptr, 10); + config.adl_bank = (int)strtoll(bank, nullptr, 10); config.adl_use_custom_bank = false; } else diff --git a/libraries/zmusic/mididevices/music_fluidsynth_mididevice.cpp b/libraries/zmusic/mididevices/music_fluidsynth_mididevice.cpp index e9b009950..2021b7451 100644 --- a/libraries/zmusic/mididevices/music_fluidsynth_mididevice.cpp +++ b/libraries/zmusic/mididevices/music_fluidsynth_mididevice.cpp @@ -59,17 +59,17 @@ public: FluidSynthMIDIDevice(int samplerate, std::vector &config, int (*printfunc_)(const char *, ...)); ~FluidSynthMIDIDevice(); - int OpenRenderer(); + int OpenRenderer() override; std::string GetStats() override; - void ChangeSettingInt(const char *setting, int value); - void ChangeSettingNum(const char *setting, double value); - void ChangeSettingString(const char *setting, const char *value); + void ChangeSettingInt(const char *setting, int value) override; + void ChangeSettingNum(const char *setting, double value) override; + void ChangeSettingString(const char *setting, const char *value) override; int GetDeviceType() const override { return MDEV_FLUIDSYNTH; } protected: - void HandleEvent(int status, int parm1, int parm2); - void HandleLongEvent(const uint8_t *data, int len); - void ComputeOutput(float *buffer, int len); + void HandleEvent(int status, int parm1, int parm2) override; + void HandleLongEvent(const uint8_t *data, int len) override; + void ComputeOutput(float *buffer, int len) override; int LoadPatchSets(const std::vector& config); fluid_settings_t *FluidSettings; @@ -199,7 +199,6 @@ FluidSynthMIDIDevice::FluidSynthMIDIDevice(int samplerate, std::vector instruments; - void HandleEvent(int status, int parm1, int parm2); - void HandleLongEvent(const uint8_t *data, int len); - void ComputeOutput(float *buffer, int len); - void ChangeSettingInt(const char *opt, int set); + void HandleEvent(int status, int parm1, int parm2) override; + void HandleLongEvent(const uint8_t *data, int len) override; + void ComputeOutput(float *buffer, int len) override; + void ChangeSettingInt(const char *opt, int set) override; void LoadInstruments(); }; @@ -244,7 +244,7 @@ bool WildMidi_SetupConfig(const char* args) if (*args == 0) args = wildMidiConfig.config.c_str(); if (stricmp(wildMidiConfig.loadedConfig.c_str(), args) == 0) return false; // aleady loaded - MusicIO::SoundFontReaderInterface* reader; + MusicIO::SoundFontReaderInterface* reader = nullptr; if (musicCallbacks.OpenSoundFont) { reader = musicCallbacks.OpenSoundFont(args, SF_GUS); diff --git a/libraries/zmusic/midisources/midisource_mus.cpp b/libraries/zmusic/midisources/midisource_mus.cpp index b5c2dfc8c..0791bfdcf 100644 --- a/libraries/zmusic/midisources/midisource_mus.cpp +++ b/libraries/zmusic/midisources/midisource_mus.cpp @@ -177,7 +177,6 @@ std::vector MUSSong2::PrecacheData() std::vector work; const uint8_t *used = MusData.data() + sizeof(MUSHeader) / sizeof(uint8_t); int i, k; - size_t p = 0; int numinstr = LittleShort(MusHeader->NumInstruments); work.reserve(LittleShort(MusHeader->NumInstruments)); diff --git a/libraries/zmusic/streamsources/music_dumb.cpp b/libraries/zmusic/streamsources/music_dumb.cpp index 95de21e77..1fbc78651 100644 --- a/libraries/zmusic/streamsources/music_dumb.cpp +++ b/libraries/zmusic/streamsources/music_dumb.cpp @@ -152,17 +152,6 @@ typedef struct MODMIDICFG // CODE -------------------------------------------------------------------- -//========================================================================== -// -// time_to_samples -// -//========================================================================== - -static inline uint64_t time_to_samples(double p_time,int p_sample_rate) -{ - return (uint64_t)floor((double)p_sample_rate * p_time + 0.5); -} - //========================================================================== // // ReadDUH diff --git a/libraries/zmusic/streamsources/music_xa.cpp b/libraries/zmusic/streamsources/music_xa.cpp index 45f2d6614..8bd0eb23d 100644 --- a/libraries/zmusic/streamsources/music_xa.cpp +++ b/libraries/zmusic/streamsources/music_xa.cpp @@ -291,7 +291,6 @@ bool XASong::Start() bool XASong::GetData(void *vbuff, size_t len) { - auto olen = len; float *dest = (float*)vbuff; while (len > 0) { diff --git a/libraries/zmusic/zmusic/configuration.cpp b/libraries/zmusic/zmusic/configuration.cpp index 547485a55..c583b17fe 100644 --- a/libraries/zmusic/zmusic/configuration.cpp +++ b/libraries/zmusic/zmusic/configuration.cpp @@ -148,6 +148,9 @@ bool ChangeMusicSetting(ZMusic::EIntConfigKey key, MusInfo *currSong, int value, { switch (key) { + default: + return false; + case adl_chips_count: ChangeAndReturn(adlConfig.adl_chips_count, value, pRealValue); return devType() == MDEV_ADL; @@ -466,6 +469,9 @@ bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, MusInfo* currSong, float va { switch (key) { + default: + return false; + case fluid_gain: if (value < 0) value = 0; @@ -615,6 +621,9 @@ bool ChangeMusicSetting(ZMusic::EStringConfigKey key, MusInfo* currSong, const c { switch (key) { + default: + return false; + case adl_custom_bank: adlConfig.adl_custom_bank = value; return devType() == MDEV_ADL; diff --git a/libraries/zmusic/zmusic/musinfo.h b/libraries/zmusic/zmusic/musinfo.h index 04661d10e..ed907fb22 100644 --- a/libraries/zmusic/zmusic/musinfo.h +++ b/libraries/zmusic/zmusic/musinfo.h @@ -1,5 +1,6 @@ #pragma once +#include #include "mididefs.h" // The base music class. Everything is derived from this -------------------- diff --git a/src/sound/backend/i_sound.cpp b/src/sound/backend/i_sound.cpp index 25ce6f6d5..b593fee3f 100644 --- a/src/sound/backend/i_sound.cpp +++ b/src/sound/backend/i_sound.cpp @@ -321,7 +321,7 @@ void I_ShutdownSound() } } -const char *GetSampleTypeName(enum SampleType type) +const char *GetSampleTypeName(SampleType type) { switch(type) { @@ -331,7 +331,7 @@ const char *GetSampleTypeName(enum SampleType type) return "(invalid sample type)"; } -const char *GetChannelConfigName(enum ChannelConfig chan) +const char *GetChannelConfigName(ChannelConfig chan) { switch(chan) { diff --git a/src/sound/backend/i_soundinternal.h b/src/sound/backend/i_soundinternal.h index 80a57b7ec..75874b6c3 100644 --- a/src/sound/backend/i_soundinternal.h +++ b/src/sound/backend/i_soundinternal.h @@ -6,6 +6,7 @@ #include "doomtype.h" #include "vectors.h" #include "tarray.h" +#include "zmusic/sounddecoder.h" #include "../../libraries/music_common/fileio.h" class FileReader; @@ -116,9 +117,6 @@ struct FISoundChannel void FindLoopTags(MusicIO::FileInterface *fr, uint32_t *start, bool *startass, uint32_t *end, bool *endass); - -const char *GetSampleTypeName(enum SampleType type); -const char *GetChannelConfigName(enum ChannelConfig chan); class SoundStream; diff --git a/src/sound/backend/oalsound.cpp b/src/sound/backend/oalsound.cpp index d5265cdbf..3236b2b32 100644 --- a/src/sound/backend/oalsound.cpp +++ b/src/sound/backend/oalsound.cpp @@ -47,6 +47,9 @@ #include "zmusic/sounddecoder.h" #include "filereadermusicinterface.h" +const char *GetSampleTypeName(SampleType type); +const char *GetChannelConfigName(ChannelConfig chan); + FModule OpenALModule{"OpenAL"}; #include "oalload.h"