- fixed compilation with XCode and silenced several warnings

This commit is contained in:
Christoph Oelckers 2019-09-30 01:51:53 +02:00
parent 2c33e47988
commit 6bfa1bf692
17 changed files with 72 additions and 76 deletions

View file

@ -70,18 +70,18 @@ public:
SoftSynthMIDIDevice(int samplerate, int minrate = 1, int maxrate = 1000000 /* something higher than any valid value */); SoftSynthMIDIDevice(int samplerate, int minrate = 1, int maxrate = 1000000 /* something higher than any valid value */);
~SoftSynthMIDIDevice(); ~SoftSynthMIDIDevice();
void Close(); void Close() override;
bool IsOpen() const; bool IsOpen() const override;
int GetTechnology() const; int GetTechnology() const override;
int SetTempo(int tempo); int SetTempo(int tempo) override;
int SetTimeDiv(int timediv); int SetTimeDiv(int timediv) override;
int StreamOut(MidiHeader *data); int StreamOut(MidiHeader *data) override;
int StreamOutSync(MidiHeader *data); int StreamOutSync(MidiHeader *data) override;
int Resume(); int Resume() override;
void Stop(); void Stop() override;
bool Pause(bool paused); bool Pause(bool paused) override;
virtual int Open(); virtual int Open() override;
virtual bool ServiceStream(void* buff, int numbytes); virtual bool ServiceStream(void* buff, int numbytes);
int GetSampleRate() const { return SampleRate; } int GetSampleRate() const { return SampleRate; }
SoundStreamInfo GetStreamInfo() const override; SoundStreamInfo GetStreamInfo() const override;

View file

@ -46,14 +46,14 @@ public:
ADLMIDIDevice(const ADLConfig *config); ADLMIDIDevice(const ADLConfig *config);
~ADLMIDIDevice(); ~ADLMIDIDevice();
int OpenRenderer(); int OpenRenderer() override;
int GetDeviceType() const override { return MDEV_ADL; } int GetDeviceType() const override { return MDEV_ADL; }
protected: protected:
void HandleEvent(int status, int parm1, int parm2); void HandleEvent(int status, int parm1, int parm2) override;
void HandleLongEvent(const uint8_t *data, int len); void HandleLongEvent(const uint8_t *data, int len) override;
void ComputeOutput(float *buffer, int len); void ComputeOutput(float *buffer, int len) override;
private: private:
int LoadCustomBank(const ADLConfig *config); int LoadCustomBank(const ADLConfig *config);
@ -236,7 +236,7 @@ MIDIDevice *CreateADLMIDIDevice(const char *Args)
if (*bank >= '0' && *bank <= '9') if (*bank >= '0' && *bank <= '9')
{ {
// Args specify a bank by index. // 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; config.adl_use_custom_bank = false;
} }
else else

View file

@ -59,17 +59,17 @@ public:
FluidSynthMIDIDevice(int samplerate, std::vector<std::string> &config, int (*printfunc_)(const char *, ...)); FluidSynthMIDIDevice(int samplerate, std::vector<std::string> &config, int (*printfunc_)(const char *, ...));
~FluidSynthMIDIDevice(); ~FluidSynthMIDIDevice();
int OpenRenderer(); int OpenRenderer() override;
std::string GetStats() override; std::string GetStats() override;
void ChangeSettingInt(const char *setting, int value); void ChangeSettingInt(const char *setting, int value) override;
void ChangeSettingNum(const char *setting, double value); void ChangeSettingNum(const char *setting, double value) override;
void ChangeSettingString(const char *setting, const char *value); void ChangeSettingString(const char *setting, const char *value) override;
int GetDeviceType() const override { return MDEV_FLUIDSYNTH; } int GetDeviceType() const override { return MDEV_FLUIDSYNTH; }
protected: protected:
void HandleEvent(int status, int parm1, int parm2); void HandleEvent(int status, int parm1, int parm2) override;
void HandleLongEvent(const uint8_t *data, int len); void HandleLongEvent(const uint8_t *data, int len) override;
void ComputeOutput(float *buffer, int len); void ComputeOutput(float *buffer, int len) override;
int LoadPatchSets(const std::vector<std::string>& config); int LoadPatchSets(const std::vector<std::string>& config);
fluid_settings_t *FluidSettings; fluid_settings_t *FluidSettings;
@ -199,7 +199,6 @@ FluidSynthMIDIDevice::FluidSynthMIDIDevice(int samplerate, std::vector<std::stri
fluidConfig.fluid_chorus_speed, fluidConfig.fluid_chorus_depth, fluidConfig.fluid_chorus_type); fluidConfig.fluid_chorus_speed, fluidConfig.fluid_chorus_depth, fluidConfig.fluid_chorus_type);
// try loading a patch set that got specified with $mididevice. // try loading a patch set that got specified with $mididevice.
int res = 0;
if (LoadPatchSets(config)) if (LoadPatchSets(config))
{ {

View file

@ -60,18 +60,18 @@ class OPLMIDIDevice : public SoftSynthMIDIDevice, protected OPLmusicBlock
{ {
public: public:
OPLMIDIDevice(int core); OPLMIDIDevice(int core);
int OpenRenderer(); int OpenRenderer() override;
void Close(); void Close() override;
int GetTechnology() const; int GetTechnology() const override;
std::string GetStats() override; std::string GetStats() override;
protected: protected:
void CalcTickRate(); void CalcTickRate() override;
int PlayTick(); int PlayTick() override;
void HandleEvent(int status, int parm1, int parm2); void HandleEvent(int status, int parm1, int parm2) override;
void HandleLongEvent(const uint8_t *data, int len); void HandleLongEvent(const uint8_t *data, int len) override;
void ComputeOutput(float *buffer, int len); void ComputeOutput(float *buffer, int len) override;
bool ServiceStream(void *buff, int numbytes); bool ServiceStream(void *buff, int numbytes) override;
int GetDeviceType() const override { return MDEV_OPL; } int GetDeviceType() const override { return MDEV_OPL; }
}; };

View file

@ -47,13 +47,13 @@ public:
~OPNMIDIDevice(); ~OPNMIDIDevice();
int OpenRenderer(); int OpenRenderer() override;
int GetDeviceType() const override { return MDEV_OPN; } int GetDeviceType() const override { return MDEV_OPN; }
protected: protected:
void HandleEvent(int status, int parm1, int parm2); void HandleEvent(int status, int parm1, int parm2) override;
void HandleLongEvent(const uint8_t *data, int len); void HandleLongEvent(const uint8_t *data, int len) override;
void ComputeOutput(float *buffer, int len); void ComputeOutput(float *buffer, int len) override;
private: private:
int LoadCustomBank(const char *bankfile); int LoadCustomBank(const char *bankfile);

View file

@ -369,7 +369,6 @@ bool SoftSynthMIDIDevice::ServiceStream (void *buff, int numbytes)
float *samples = (float *)buff; float *samples = (float *)buff;
float *samples1; float *samples1;
int numsamples = numbytes / sizeof(float) / 2; int numsamples = numbytes / sizeof(float) / 2;
bool prev_ended = false;
bool res = true; bool res = true;
samples1 = samples; samples1 = samples;

View file

@ -71,16 +71,16 @@ public:
TimidityMIDIDevice(int samplerate); TimidityMIDIDevice(int samplerate);
~TimidityMIDIDevice(); ~TimidityMIDIDevice();
int OpenRenderer(); int OpenRenderer() override;
void PrecacheInstruments(const uint16_t *instruments, int count); void PrecacheInstruments(const uint16_t *instruments, int count) override;
int GetDeviceType() const override { return MDEV_GUS; } int GetDeviceType() const override { return MDEV_GUS; }
protected: protected:
Timidity::Renderer *Renderer; Timidity::Renderer *Renderer;
void HandleEvent(int status, int parm1, int parm2); void HandleEvent(int status, int parm1, int parm2) override;
void HandleLongEvent(const uint8_t *data, int len); void HandleLongEvent(const uint8_t *data, int len) override;
void ComputeOutput(float *buffer, int len); void ComputeOutput(float *buffer, int len) override;
}; };
@ -265,7 +265,7 @@ bool GUS_SetupConfig(const char* args)
if (*args == 0) args = gusConfig.gus_config.c_str(); if (*args == 0) args = gusConfig.gus_config.c_str();
if (stricmp(gusConfig.loadedConfig.c_str(), args) == 0) return false; // aleady loaded if (stricmp(gusConfig.loadedConfig.c_str(), args) == 0) return false; // aleady loaded
MusicIO::SoundFontReaderInterface *reader; MusicIO::SoundFontReaderInterface *reader = nullptr;
if (musicCallbacks.OpenSoundFont) if (musicCallbacks.OpenSoundFont)
{ {
reader = musicCallbacks.OpenSoundFont(args, SF_GUS | SF_SF2); reader = musicCallbacks.OpenSoundFont(args, SF_GUS | SF_SF2);

View file

@ -48,8 +48,8 @@ public:
TimidityPPMIDIDevice(int samplerate); TimidityPPMIDIDevice(int samplerate);
~TimidityPPMIDIDevice(); ~TimidityPPMIDIDevice();
int OpenRenderer(); int OpenRenderer() override;
void PrecacheInstruments(const uint16_t *instruments, int count); void PrecacheInstruments(const uint16_t *instruments, int count) override;
//std::string GetStats(); //std::string GetStats();
int GetDeviceType() const override { return MDEV_TIMIDITY; } int GetDeviceType() const override { return MDEV_TIMIDITY; }
@ -58,9 +58,9 @@ public:
protected: protected:
TimidityPlus::Player *Renderer; TimidityPlus::Player *Renderer;
void HandleEvent(int status, int parm1, int parm2); void HandleEvent(int status, int parm1, int parm2) override;
void HandleLongEvent(const uint8_t *data, int len); void HandleLongEvent(const uint8_t *data, int len) override;
void ComputeOutput(float *buffer, int len); void ComputeOutput(float *buffer, int len) override;
void LoadInstruments(); void LoadInstruments();
}; };
@ -198,7 +198,7 @@ bool Timidity_SetupConfig(const char* args)
if (*args == 0) args = timidityConfig.timidity_config.c_str(); if (*args == 0) args = timidityConfig.timidity_config.c_str();
if (stricmp(timidityConfig.loadedConfig.c_str(), args) == 0) return false; // aleady loaded if (stricmp(timidityConfig.loadedConfig.c_str(), args) == 0) return false; // aleady loaded
MusicIO::SoundFontReaderInterface* reader; MusicIO::SoundFontReaderInterface* reader = nullptr;
if (musicCallbacks.OpenSoundFont) if (musicCallbacks.OpenSoundFont)
{ {
reader = musicCallbacks.OpenSoundFont(args, SF_GUS | SF_SF2); reader = musicCallbacks.OpenSoundFont(args, SF_GUS | SF_SF2);

View file

@ -51,19 +51,19 @@ public:
WildMIDIDevice(int samplerate); WildMIDIDevice(int samplerate);
~WildMIDIDevice(); ~WildMIDIDevice();
int OpenRenderer(); int OpenRenderer() override;
void PrecacheInstruments(const uint16_t *instruments, int count); void PrecacheInstruments(const uint16_t *instruments, int count) override;
std::string GetStats(); std::string GetStats() override;
int GetDeviceType() const override { return MDEV_WILDMIDI; } int GetDeviceType() const override { return MDEV_WILDMIDI; }
protected: protected:
WildMidi::Renderer *Renderer; WildMidi::Renderer *Renderer;
std::shared_ptr<WildMidi::Instruments> instruments; std::shared_ptr<WildMidi::Instruments> instruments;
void HandleEvent(int status, int parm1, int parm2); void HandleEvent(int status, int parm1, int parm2) override;
void HandleLongEvent(const uint8_t *data, int len); void HandleLongEvent(const uint8_t *data, int len) override;
void ComputeOutput(float *buffer, int len); void ComputeOutput(float *buffer, int len) override;
void ChangeSettingInt(const char *opt, int set); void ChangeSettingInt(const char *opt, int set) override;
void LoadInstruments(); void LoadInstruments();
}; };
@ -244,7 +244,7 @@ bool WildMidi_SetupConfig(const char* args)
if (*args == 0) args = wildMidiConfig.config.c_str(); if (*args == 0) args = wildMidiConfig.config.c_str();
if (stricmp(wildMidiConfig.loadedConfig.c_str(), args) == 0) return false; // aleady loaded if (stricmp(wildMidiConfig.loadedConfig.c_str(), args) == 0) return false; // aleady loaded
MusicIO::SoundFontReaderInterface* reader; MusicIO::SoundFontReaderInterface* reader = nullptr;
if (musicCallbacks.OpenSoundFont) if (musicCallbacks.OpenSoundFont)
{ {
reader = musicCallbacks.OpenSoundFont(args, SF_GUS); reader = musicCallbacks.OpenSoundFont(args, SF_GUS);

View file

@ -177,7 +177,6 @@ std::vector<uint16_t> MUSSong2::PrecacheData()
std::vector<uint16_t> work; std::vector<uint16_t> work;
const uint8_t *used = MusData.data() + sizeof(MUSHeader) / sizeof(uint8_t); const uint8_t *used = MusData.data() + sizeof(MUSHeader) / sizeof(uint8_t);
int i, k; int i, k;
size_t p = 0;
int numinstr = LittleShort(MusHeader->NumInstruments); int numinstr = LittleShort(MusHeader->NumInstruments);
work.reserve(LittleShort(MusHeader->NumInstruments)); work.reserve(LittleShort(MusHeader->NumInstruments));

View file

@ -152,17 +152,6 @@ typedef struct MODMIDICFG
// CODE -------------------------------------------------------------------- // 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 // ReadDUH

View file

@ -291,7 +291,6 @@ bool XASong::Start()
bool XASong::GetData(void *vbuff, size_t len) bool XASong::GetData(void *vbuff, size_t len)
{ {
auto olen = len;
float *dest = (float*)vbuff; float *dest = (float*)vbuff;
while (len > 0) while (len > 0)
{ {

View file

@ -148,6 +148,9 @@ bool ChangeMusicSetting(ZMusic::EIntConfigKey key, MusInfo *currSong, int value,
{ {
switch (key) switch (key)
{ {
default:
return false;
case adl_chips_count: case adl_chips_count:
ChangeAndReturn(adlConfig.adl_chips_count, value, pRealValue); ChangeAndReturn(adlConfig.adl_chips_count, value, pRealValue);
return devType() == MDEV_ADL; return devType() == MDEV_ADL;
@ -466,6 +469,9 @@ bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, MusInfo* currSong, float va
{ {
switch (key) switch (key)
{ {
default:
return false;
case fluid_gain: case fluid_gain:
if (value < 0) if (value < 0)
value = 0; value = 0;
@ -615,6 +621,9 @@ bool ChangeMusicSetting(ZMusic::EStringConfigKey key, MusInfo* currSong, const c
{ {
switch (key) switch (key)
{ {
default:
return false;
case adl_custom_bank: case adl_custom_bank:
adlConfig.adl_custom_bank = value; adlConfig.adl_custom_bank = value;
return devType() == MDEV_ADL; return devType() == MDEV_ADL;

View file

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <string>
#include "mididefs.h" #include "mididefs.h"
// The base music class. Everything is derived from this -------------------- // The base music class. Everything is derived from this --------------------

View file

@ -321,7 +321,7 @@ void I_ShutdownSound()
} }
} }
const char *GetSampleTypeName(enum SampleType type) const char *GetSampleTypeName(SampleType type)
{ {
switch(type) switch(type)
{ {
@ -331,7 +331,7 @@ const char *GetSampleTypeName(enum SampleType type)
return "(invalid sample type)"; return "(invalid sample type)";
} }
const char *GetChannelConfigName(enum ChannelConfig chan) const char *GetChannelConfigName(ChannelConfig chan)
{ {
switch(chan) switch(chan)
{ {

View file

@ -6,6 +6,7 @@
#include "doomtype.h" #include "doomtype.h"
#include "vectors.h" #include "vectors.h"
#include "tarray.h" #include "tarray.h"
#include "zmusic/sounddecoder.h"
#include "../../libraries/music_common/fileio.h" #include "../../libraries/music_common/fileio.h"
class FileReader; class FileReader;
@ -116,9 +117,6 @@ struct FISoundChannel
void FindLoopTags(MusicIO::FileInterface *fr, uint32_t *start, bool *startass, uint32_t *end, bool *endass); 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; class SoundStream;

View file

@ -47,6 +47,9 @@
#include "zmusic/sounddecoder.h" #include "zmusic/sounddecoder.h"
#include "filereadermusicinterface.h" #include "filereadermusicinterface.h"
const char *GetSampleTypeName(SampleType type);
const char *GetChannelConfigName(ChannelConfig chan);
FModule OpenALModule{"OpenAL"}; FModule OpenALModule{"OpenAL"};
#include "oalload.h" #include "oalload.h"