From 28287d70b6879ab140b90150d9bc747fbc17510d Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 17 Nov 2019 08:20:01 +0000 Subject: AUDIO: Fix Missing Default Switch Cases These are flagged by GCC if -Wswitch-default is enabled. --- audio/adlib.cpp | 3 ++ audio/alsa_opl.cpp | 15 ++++++ audio/decoders/iff_sound.cpp | 6 +++ audio/fmopl.cpp | 3 ++ audio/midiparser.cpp | 2 + audio/midiparser_qt.cpp | 4 ++ audio/midiparser_smf.cpp | 5 ++ audio/midiparser_xmidi.cpp | 6 +++ audio/mods/infogrames.cpp | 3 ++ audio/mods/mod_xm_s3m.cpp | 14 ++++++ audio/mods/protracker.cpp | 4 ++ audio/mods/rjp1.cpp | 6 +++ audio/mods/soundfx.cpp | 4 ++ audio/mpu401.cpp | 2 + audio/softsynth/cms.cpp | 1 + .../softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp | 5 ++ audio/softsynth/mt32.cpp | 2 + audio/softsynth/opl/dbopl.cpp | 15 ++++++ audio/softsynth/opl/dosbox.cpp | 54 +++++++++++++--------- audio/softsynth/opl/mame.cpp | 6 +++ audio/softsynth/opl/nuked.cpp | 20 ++++++++ audio/softsynth/sid.cpp | 4 ++ 22 files changed, 163 insertions(+), 21 deletions(-) (limited to 'audio') diff --git a/audio/adlib.cpp b/audio/adlib.cpp index 9ea3b88cbe..c1e68fcad2 100644 --- a/audio/adlib.cpp +++ b/audio/adlib.cpp @@ -1549,6 +1549,9 @@ uint32 MidiDriver_ADLIB::property(int prop, uint32 param) { _opl3Mode = (param > 0); #endif return 1; + + default: + break; } return 0; diff --git a/audio/alsa_opl.cpp b/audio/alsa_opl.cpp index faad4018cd..9a745e8df9 100644 --- a/audio/alsa_opl.cpp +++ b/audio/alsa_opl.cpp @@ -210,6 +210,9 @@ void OPL::write(int port, int val) { break; case Config::kOpl3: writeOplReg(chip, index[chip], val); + break; + default: + break; } } else { switch(_type) { @@ -225,6 +228,9 @@ void OPL::write(int port, int val) { break; case Config::kOpl3: index[chip] = val; + break; + default: + break; } } } @@ -244,6 +250,9 @@ void OPL::writeReg(int r, int v) { break; case Config::kOpl3: writeOplReg(r >= 0x100, r & 0xff, v); + break; + default: + break; } } @@ -305,6 +314,9 @@ void OPL::writeOplReg(int c, int r, int v) { case 0xf0: _oper[idx].waveform = v & (_type == Config::kOpl3 ? 0x7 : 0x3); snd_hwdep_ioctl(_opl, SNDRV_DM_FM_IOCTL_SET_VOICE, (void *)&_oper[idx]); + break; + default: + break; } } else { // Voice @@ -337,6 +349,9 @@ void OPL::writeOplReg(int c, int r, int v) { _oper[opIdx].right = _oper[opIdx + 3].right = (v >> 5) & 0x1; } snd_hwdep_ioctl(_opl, SNDRV_DM_FM_IOCTL_SET_VOICE, (void *)&_oper[opIdx]); + break; + default: + break; } } } diff --git a/audio/decoders/iff_sound.cpp b/audio/decoders/iff_sound.cpp index e42918cb62..7af082128b 100644 --- a/audio/decoders/iff_sound.cpp +++ b/audio/decoders/iff_sound.cpp @@ -79,6 +79,9 @@ struct A8SVXLoader { assert(_data); loadData(chunk._stream); return true; + + default: + break; } return false; @@ -94,6 +97,9 @@ struct A8SVXLoader { // implement other formats here error("compressed IFF audio is not supported"); break; + + default: + break; } } diff --git a/audio/fmopl.cpp b/audio/fmopl.cpp index d1389d79e9..56cdcd5526 100644 --- a/audio/fmopl.cpp +++ b/audio/fmopl.cpp @@ -118,6 +118,9 @@ Config::DriverId Config::detect(OplType type) { case kOpl3: flags = kFlagOpl3; break; + + default: + break; } DriverId drv = parse(ConfMan.get("opl_driver")); diff --git a/audio/midiparser.cpp b/audio/midiparser.cpp index 9a8f0f7a77..4731d1f982 100644 --- a/audio/midiparser.cpp +++ b/audio/midiparser.cpp @@ -68,6 +68,8 @@ void MidiParser::property(int prop, int value) { case mpSendSustainOffOnNotesOff: _sendSustainOffOnNotesOff = (value != 0); break; + default: + break; } } diff --git a/audio/midiparser_qt.cpp b/audio/midiparser_qt.cpp index 8821dbfaa8..87bc96ab2b 100644 --- a/audio/midiparser_qt.cpp +++ b/audio/midiparser_qt.cpp @@ -176,6 +176,8 @@ uint32 MidiParser_QT::readNextEvent() { // General handleGeneralEvent(control); break; + default: + break; } return 0; @@ -236,6 +238,8 @@ void MidiParser_QT::handleControllerEvent(uint32 control, uint32 part, byte intP case 10: _partMap[part].pan = intPart; break; + default: + break; } } diff --git a/audio/midiparser_smf.cpp b/audio/midiparser_smf.cpp index d1d86b918f..e1d574e219 100644 --- a/audio/midiparser_smf.cpp +++ b/audio/midiparser_smf.cpp @@ -142,7 +142,12 @@ void MidiParser_SMF::parseNextEvent(EventInfo &info) { default: warning("MidiParser_SMF::parseNextEvent: Unsupported event code %x", info.event); + break; } + break; + + default: + break; } } diff --git a/audio/midiparser_xmidi.cpp b/audio/midiparser_xmidi.cpp index 042e663a13..9d8f08ad1e 100644 --- a/audio/midiparser_xmidi.cpp +++ b/audio/midiparser_xmidi.cpp @@ -183,6 +183,7 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) { warning("Unsupported XMIDI controller %d (0x%2x)", info.basic.param1, info.basic.param1); } + break; } // Should we really keep passing the XMIDI controller events to @@ -234,7 +235,12 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) { default: warning("MidiParser_XMIDI::parseNextEvent: Unsupported event code %x", info.event); + break; } + break; + + default: + break; } } diff --git a/audio/mods/infogrames.cpp b/audio/mods/infogrames.cpp index 320261b1b0..2c62c37713 100644 --- a/audio/mods/infogrames.cpp +++ b/audio/mods/infogrames.cpp @@ -346,8 +346,11 @@ void Infogrames::getNextSample(Channel &chn) { break; default: warning("Unknown Infogrames command: %X", cmd); + break; } break; + default: + break; } } else { // 0xxxxxxx - Set period if (cmd != 0) diff --git a/audio/mods/mod_xm_s3m.cpp b/audio/mods/mod_xm_s3m.cpp index 264dfdc46c..3542d2c2fc 100644 --- a/audio/mods/mod_xm_s3m.cpp +++ b/audio/mods/mod_xm_s3m.cpp @@ -278,6 +278,8 @@ void ModXmS3mStream::tickChannel(Channel &channel) { case 0xF0: /* Tone Porta.*/ tonePorta(channel); break; + default: + break; } } switch (channel.note.effect) { @@ -375,6 +377,8 @@ void ModXmS3mStream::tickChannel(Channel &channel) { channel.vibratoPhase += channel.vibratoSpeed; vibrato(channel, 1); break; + default: + break; } autoVibrato(channel); calculateFreq(channel); @@ -567,6 +571,8 @@ void ModXmS3mStream::retrigVolSlide(Channel &channel) { case 0xF: channel.volume = channel.volume << 1; break; + default: + break; } if (channel.volume < 0) { channel.volume = 0; @@ -639,6 +645,8 @@ void ModXmS3mStream::trigger(Channel &channel) { channel.tonePortaParam = channel.note.volume & 0xF; } break; + default: + break; } if (channel.note.key > 0) { if (channel.note.key > 96) { @@ -883,6 +891,8 @@ void ModXmS3mStream::updateChannelRow(Channel &channel, Note note) { case 0x20: portaDown(channel, 0xE0 | (channel.xfinePortaParam & 0xF)); break; + default: + break; } break; case 0x71: /* Fine Porta Up. */ @@ -950,6 +960,8 @@ void ModXmS3mStream::updateChannelRow(Channel &channel, Note note) { case 0xF8: /* Set Panning. */ channel.panning = channel.note.param * 17; break; + default: + break; } autoVibrato(channel); calculateFreq(channel); @@ -1091,6 +1103,8 @@ void ModXmS3mStream::updateRow() { case 0xFE: /* Pattern Delay.*/ _tick = _speed + _speed * note.param; break; + default: + break; } } } diff --git a/audio/mods/protracker.cpp b/audio/mods/protracker.cpp index 2838b58d61..74df6d9697 100644 --- a/audio/mods/protracker.cpp +++ b/audio/mods/protracker.cpp @@ -398,8 +398,12 @@ void ProtrackerStream::updateEffects() { _track[track].vol = _module.sample[_track[track].sample - 1].vol; } break; + default: + break; } break; + default: + break; } } } diff --git a/audio/mods/rjp1.cpp b/audio/mods/rjp1.cpp index f2b811c9ef..f4b6dd5713 100644 --- a/audio/mods/rjp1.cpp +++ b/audio/mods/rjp1.cpp @@ -163,6 +163,8 @@ bool Rjp1::load(Common::SeekableReadStream *songData, Common::SeekableReadStream case 6: // sequence data break; + default: + break; } } @@ -284,6 +286,8 @@ bool Rjp1::executeSfxSequenceOp(Rjp1Channel *channel, uint8 code, const uint8 *& case 7: loop = false; break; + default: + break; } return loop; } @@ -345,6 +349,8 @@ bool Rjp1::executeSongSequenceOp(Rjp1Channel *channel, uint8 code, const uint8 * case 7: loop = false; break; + default: + break; } return loop; } diff --git a/audio/mods/soundfx.cpp b/audio/mods/soundfx.cpp index 5744429856..2b4c4c9dba 100644 --- a/audio/mods/soundfx.cpp +++ b/audio/mods/soundfx.cpp @@ -198,6 +198,8 @@ void SoundFx::handlePattern(int ch, uint32 pat) { volume = 0; } break; + default: + break; } setChannelVolume(ch, volume); } @@ -218,6 +220,8 @@ void SoundFx::updateEffects(int ch) { case 8: // set step down warning("Unhandled effect %d", _effects[ch]); break; + default: + break; } } } diff --git a/audio/mpu401.cpp b/audio/mpu401.cpp index 3e03ec53f1..9ac1341334 100644 --- a/audio/mpu401.cpp +++ b/audio/mpu401.cpp @@ -121,6 +121,8 @@ uint32 MidiDriver_MPU401::property(int prop, uint32 param) { case PROP_CHANNEL_MASK: _channel_mask = param & 0xFFFF; return 1; + default: + break; } return 0; diff --git a/audio/softsynth/cms.cpp b/audio/softsynth/cms.cpp index ce058b515b..4ea2a9c67a 100644 --- a/audio/softsynth/cms.cpp +++ b/audio/softsynth/cms.cpp @@ -179,6 +179,7 @@ void CMSEmulator::update(int chip, int16 *buffer, int length) { case 1: saa->noise[ch].freq = 15625.0 * 2; break; case 2: saa->noise[ch].freq = 7812.5 * 2; break; case 3: saa->noise[ch].freq = saa->channels[ch * 3].freq; break; + default: break; } } diff --git a/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp b/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp index 0cdf18378d..540c1d943a 100644 --- a/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp +++ b/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp @@ -230,6 +230,9 @@ void TownsPC98_FmSynthOperator::generateOutput(int32 phasebuf, int32 *feed, int3 targetLevel = 1023; levelIncrement = _adTbl[fs_r.rate + ((_tickCount >> fs_r.shift) & 7)]; break; + + default: + break; } loop = false; } @@ -1536,6 +1539,8 @@ void TownsPC98_FmSynth::nextTick(int32 *buffer, uint32 bufferSize) { o[3]->generateOutput(0, 0, output); *del = 0; break; + default: + break; }; int32 finOut = (output << 2) / ((_numChan + _numSSG - 3) / 3); diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp index 09a8083f7b..47ac9f1cdc 100644 --- a/audio/softsynth/mt32.cpp +++ b/audio/softsynth/mt32.cpp @@ -290,6 +290,8 @@ uint32 MidiDriver_MT32::property(int prop, uint32 param) { case PROP_CHANNEL_MASK: _channelMask = param & 0xFFFF; return 1; + default: + break; } return 0; diff --git a/audio/softsynth/opl/dbopl.cpp b/audio/softsynth/opl/dbopl.cpp index 19be94cf69..275a1caa00 100644 --- a/audio/softsynth/opl/dbopl.cpp +++ b/audio/softsynth/opl/dbopl.cpp @@ -422,6 +422,8 @@ Bits Operator::TemplateVolume( ) { return ENV_MAX; } break; + default: + break; } volume = vol; return vol; @@ -753,6 +755,8 @@ void Channel::WriteC0( const Chip* chip, Bit8u val ) { case 3: chan0->synthHandler = &Channel::BlockTemplate< sm3AMAM >; break; + default: + break; } //Disable updating percussion channels } else if ((fourMask & 0x40) && ( chip->regBD & 0x20) ) { @@ -900,6 +904,8 @@ Channel* Channel::BlockTemplate( Chip* chip, Bit32u samples, Bit32s* output ) { // thus we leave this blank. // TODO: Consider checking this. break; + default: + break; } //Init the operators with the the current vibrato and tremolo values Op( 0 )->Prepare( chip ); @@ -985,6 +991,8 @@ Channel* Channel::BlockTemplate( Chip* chip, Bit32u samples, Bit32s* output ) { // thus we leave this blank. // TODO: Consider checking this. break; + default: + break; } } switch( mode ) { @@ -1011,6 +1019,8 @@ Channel* Channel::BlockTemplate( Chip* chip, Bit32u samples, Bit32s* output ) { // thus we leave this blank. // TODO: Consider checking this. break; + default: + break; } return 0; } @@ -1203,6 +1213,8 @@ void Chip::WriteReg( Bit32u reg, Bit8u val ) { case 0xf0 >> 4: REGOP( WriteE0 ); break; + default: + break; } } @@ -1216,6 +1228,9 @@ Bit32u Chip::WriteAddr( Bit32u port, Bit8u val ) { return 0x100 | val; else return val; + break; + default: + break; } return 0; } diff --git a/audio/softsynth/opl/dosbox.cpp b/audio/softsynth/opl/dosbox.cpp index 3d90ec93d0..91e81d6bf2 100644 --- a/audio/softsynth/opl/dosbox.cpp +++ b/audio/softsynth/opl/dosbox.cpp @@ -92,36 +92,40 @@ bool Chip::write(uint32 reg, uint8 val) { timer[1].counter = val; return true; case 0x04: - double time = g_system->getMillis() / 1000.0; + { + double time = g_system->getMillis() / 1000.0; - if (val & 0x80) { - timer[0].reset(time); - timer[1].reset(time); - } else { - timer[0].update(time); - timer[1].update(time); + if (val & 0x80) { + timer[0].reset(time); + timer[1].reset(time); + } else { + timer[0].update(time); + timer[1].update(time); - if (val & 0x1) - timer[0].start(time, 80); - else - timer[0].stop(); + if (val & 0x1) + timer[0].start(time, 80); + else + timer[0].stop(); - timer[0].masked = (val & 0x40) > 0; + timer[0].masked = (val & 0x40) > 0; - if (timer[0].masked) - timer[0].overflow = false; + if (timer[0].masked) + timer[0].overflow = false; - if (val & 0x2) - timer[1].start(time, 320); - else - timer[1].stop(); + if (val & 0x2) + timer[1].start(time, 320); + else + timer[1].stop(); - timer[1].masked = (val & 0x20) > 0; + timer[1].masked = (val & 0x20) > 0; - if (timer[1].masked) - timer[1].overflow = false; + if (timer[1].masked) + timer[1].overflow = false; + } } return true; + default: + break; } return false; } @@ -203,6 +207,8 @@ void OPL::write(int port, int val) { dualWrite(1, _reg.dual[1], val); } break; + default: + break; } } else { // Ask the handler to write the address @@ -224,6 +230,8 @@ void OPL::write(int port, int val) { _reg.dual[1] = val & 0xff; } break; + default: + break; } } } @@ -245,6 +253,8 @@ byte OPL::read(int port) { return 0xff; // Make sure the low bits are 6 on opl2 return _chip[(port >> 1) & 1].read() | 0x6; + default: + break; } return 0; } @@ -282,6 +292,8 @@ void OPL::writeReg(int r, int v) { write(0x388, tempReg); } break; + default: + break; }; } diff --git a/audio/softsynth/opl/mame.cpp b/audio/softsynth/opl/mame.cpp index 0903f335cf..6574b46497 100644 --- a/audio/softsynth/opl/mame.cpp +++ b/audio/softsynth/opl/mame.cpp @@ -409,6 +409,8 @@ inline uint OPL_CALC_SLOT(OPL_SLOT *SLOT) { SLOT->eve = EG_OFF + 1; SLOT->evs = 0; break; + default: + break; } } /* calcrate envelope */ @@ -859,6 +861,8 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) { } } return; + default: + break; } break; case 0x20: /* am,vib,ksr,eg type,mul */ @@ -995,6 +999,8 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) { CH->SLOT[slot&1].wavetable = &SIN_TABLE[(v & 0x03) * SIN_ENT]; } return; + default: + break; } } diff --git a/audio/softsynth/opl/nuked.cpp b/audio/softsynth/opl/nuked.cpp index 273cbdfa18..ce81926ae6 100644 --- a/audio/softsynth/opl/nuked.cpp +++ b/audio/softsynth/opl/nuked.cpp @@ -403,6 +403,8 @@ static void OPL3_EnvelopeCalc(opl3_slot *slot) case envelope_gen_num_release: reg_rate = slot->reg_rr; break; + default: + break; } } slot->pg_reset = reset; @@ -498,6 +500,8 @@ static void OPL3_EnvelopeCalc(opl3_slot *slot) eg_inc = 1 << (shift - 1); } break; + default: + break; } slot->eg_rout = (eg_rout + eg_inc) & 0x1ff; // Key off @@ -845,6 +849,8 @@ static void OPL3_ChannelSetupAlg(opl3_channel *channel) channel->slots[0]->mod = &channel->slots[0]->fbmod; channel->slots[1]->mod = &channel->chip->zeromod; break; + default: + break; } return; } @@ -900,6 +906,8 @@ static void OPL3_ChannelSetupAlg(opl3_channel *channel) channel->out[2] = &channel->slots[1]->out; channel->out[3] = &channel->chip->zeromod; break; + default: + break; } } else @@ -922,6 +930,8 @@ static void OPL3_ChannelSetupAlg(opl3_channel *channel) channel->out[2] = &channel->chip->zeromod; channel->out[3] = &channel->chip->zeromod; break; + default: + break; } } } @@ -1262,6 +1272,8 @@ void OPL3_WriteReg(opl3_chip *chip, Bit16u reg, Bit8u v) case 0x05: chip->newm = v & 0x01; break; + default: + break; } } else @@ -1271,6 +1283,8 @@ void OPL3_WriteReg(opl3_chip *chip, Bit16u reg, Bit8u v) case 0x08: chip->nts = (v >> 6) & 0x01; break; + default: + break; } } break; @@ -1341,6 +1355,8 @@ void OPL3_WriteReg(opl3_chip *chip, Bit16u reg, Bit8u v) OPL3_ChannelWriteC0(&chip->channel[9 * high + (regm & 0x0f)], v); } break; + default: + break; } } @@ -1424,6 +1440,8 @@ void OPL::write(int port, int val) { dualWrite(1, address[1], val); } break; + default: + break; } } else { switch (_type) { @@ -1444,6 +1462,8 @@ void OPL::write(int port, int val) { case Config::kOpl3: address[0] = (val & 0xff) | ((port << 7) & 0x100); break; + default: + break; } } } diff --git a/audio/softsynth/sid.cpp b/audio/softsynth/sid.cpp index ac26922514..760916f1d6 100644 --- a/audio/softsynth/sid.cpp +++ b/audio/softsynth/sid.cpp @@ -951,6 +951,8 @@ RESID_INLINE void EnvelopeGenerator::updateClock(cycle_count delta_t) { // --envelope_counter &= 0xff; break; + default: + break; } // Check for change of exponential counter period. @@ -980,6 +982,8 @@ RESID_INLINE void EnvelopeGenerator::updateClock(cycle_count delta_t) { // This has been verified by sampling ENV3. hold_zero = true; break; + default: + break; } } -- cgit v1.2.3