- 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();
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;

View file

@ -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

View file

@ -59,17 +59,17 @@ public:
FluidSynthMIDIDevice(int samplerate, std::vector<std::string> &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<std::string>& config);
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);
// try loading a patch set that got specified with $mididevice.
int res = 0;
if (LoadPatchSets(config))
{

View file

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

View file

@ -47,13 +47,13 @@ public:
~OPNMIDIDevice();
int OpenRenderer();
int OpenRenderer() override;
int GetDeviceType() const override { return MDEV_OPN; }
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 char *bankfile);

View file

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

View file

@ -71,16 +71,16 @@ public:
TimidityMIDIDevice(int samplerate);
~TimidityMIDIDevice();
int OpenRenderer();
void PrecacheInstruments(const uint16_t *instruments, int count);
int OpenRenderer() override;
void PrecacheInstruments(const uint16_t *instruments, int count) override;
int GetDeviceType() const override { return MDEV_GUS; }
protected:
Timidity::Renderer *Renderer;
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;
};
@ -265,7 +265,7 @@ bool GUS_SetupConfig(const char* args)
if (*args == 0) args = gusConfig.gus_config.c_str();
if (stricmp(gusConfig.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 | SF_SF2);

View file

@ -48,8 +48,8 @@ public:
TimidityPPMIDIDevice(int samplerate);
~TimidityPPMIDIDevice();
int OpenRenderer();
void PrecacheInstruments(const uint16_t *instruments, int count);
int OpenRenderer() override;
void PrecacheInstruments(const uint16_t *instruments, int count) override;
//std::string GetStats();
int GetDeviceType() const override { return MDEV_TIMIDITY; }
@ -58,9 +58,9 @@ public:
protected:
TimidityPlus::Player *Renderer;
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;
void LoadInstruments();
};
@ -198,7 +198,7 @@ bool Timidity_SetupConfig(const char* args)
if (*args == 0) args = timidityConfig.timidity_config.c_str();
if (stricmp(timidityConfig.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 | SF_SF2);

View file

@ -51,19 +51,19 @@ public:
WildMIDIDevice(int samplerate);
~WildMIDIDevice();
int OpenRenderer();
void PrecacheInstruments(const uint16_t *instruments, int count);
std::string GetStats();
int OpenRenderer() override;
void PrecacheInstruments(const uint16_t *instruments, int count) override;
std::string GetStats() override;
int GetDeviceType() const override { return MDEV_WILDMIDI; }
protected:
WildMidi::Renderer *Renderer;
std::shared_ptr<WildMidi::Instruments> 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);

View file

@ -177,7 +177,6 @@ std::vector<uint16_t> MUSSong2::PrecacheData()
std::vector<uint16_t> 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));

View file

@ -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

View file

@ -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)
{

View file

@ -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;

View file

@ -1,5 +1,6 @@
#pragma once
#include <string>
#include "mididefs.h"
// 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)
{
@ -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)
{

View file

@ -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;

View file

@ -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"