diff --git a/src/mixer.cpp b/src/mixer.cpp index 0e92cd5333..ec46d786e3 100644 --- a/src/mixer.cpp +++ b/src/mixer.cpp @@ -19,7 +19,7 @@ struct MixerChannel { /* pointer to allocated buffer memory */ - std::shared_ptr> memory; + std::shared_ptr> memory; /* current position in memory */ uint32_t pos; @@ -180,7 +180,7 @@ MixerChannel *MxAllocateChannel() return mc; } -void MxSetChannelRawSrc(MixerChannel *mc, const std::shared_ptr> &mem, uint rate, bool is16bit) +void MxSetChannelRawSrc(MixerChannel *mc, const std::shared_ptr> &mem, uint rate, bool is16bit) { mc->memory = mem; mc->frac_pos = 0; diff --git a/src/mixer.h b/src/mixer.h index 265725696e..707967d234 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -24,7 +24,7 @@ bool MxInitialize(uint rate); void MxMixSamples(void *buffer, uint samples); MixerChannel *MxAllocateChannel(); -void MxSetChannelRawSrc(MixerChannel *mc, const std::shared_ptr> &mem, uint rate, bool is16bit); +void MxSetChannelRawSrc(MixerChannel *mc, const std::shared_ptr> &mem, uint rate, bool is16bit); void MxSetChannelVolume(MixerChannel *mc, uint volume, float pan); void MxActivateChannel(MixerChannel*); void MxCloseAllChannels(); diff --git a/src/sound_type.h b/src/sound_type.h index 8a2fa0140b..6c52ddc1cb 100644 --- a/src/sound_type.h +++ b/src/sound_type.h @@ -17,7 +17,7 @@ enum class SoundSource : uint8_t { }; struct SoundEntry { - std::shared_ptr> data; + std::shared_ptr> data; class RandomAccessFile *file; size_t file_offset; size_t file_size; diff --git a/src/soundloader.cpp b/src/soundloader.cpp index 4503392cbf..96405435fb 100644 --- a/src/soundloader.cpp +++ b/src/soundloader.cpp @@ -26,7 +26,7 @@ bool LoadSoundData(SoundEntry &sound, bool new_format, SoundID sound_id, const s if (sound.file_size == 0 || sound.file_size > SIZE_MAX - 2) return false; size_t pos = sound.file->GetPos(); - sound.data = std::make_shared>(); + sound.data = std::make_shared>(); for (auto &loader : ProviderManager::GetProviders()) { sound.file->SeekTo(pos, SEEK_SET); if (loader->Load(sound, new_format, *sound.data)) break; diff --git a/src/soundloader_opus.cpp b/src/soundloader_opus.cpp index 72efd806e9..5a9645759b 100644 --- a/src/soundloader_opus.cpp +++ b/src/soundloader_opus.cpp @@ -32,7 +32,7 @@ public: static constexpr size_t DECODE_BUFFER_SAMPLES = 5760 * 2; static constexpr size_t DECODE_BUFFER_BYTES = DECODE_BUFFER_SAMPLES * sizeof(opus_int16); - bool Load(SoundEntry &sound, bool new_format, std::vector &data) override + bool Load(SoundEntry &sound, bool new_format, std::vector &data) override { if (!new_format) return false; diff --git a/src/soundloader_raw.cpp b/src/soundloader_raw.cpp index 7a5cea2edc..a1d71ed035 100644 --- a/src/soundloader_raw.cpp +++ b/src/soundloader_raw.cpp @@ -22,7 +22,7 @@ public: static constexpr uint16_t RAW_SAMPLE_RATE = 11025; ///< Sample rate of raw pcm samples. static constexpr uint8_t RAW_SAMPLE_BITS = 8; ///< Bit depths of raw pcm samples. - bool Load(SoundEntry &sound, bool new_format, std::vector &data) override + bool Load(SoundEntry &sound, bool new_format, std::vector &data) override { /* Raw sounds are apecial case for the jackhammer sound (name in Windows sample.cat is "Corrupt sound") * It's not a RIFF file, but raw PCM data. @@ -42,7 +42,7 @@ public: /* Convert 8-bit samples from unsigned to signed. */ for (auto &sample : data) { - sample = sample - 128; + sample ^= std::byte{0x80}; } return true; diff --git a/src/soundloader_type.h b/src/soundloader_type.h index 978a1b94b6..2f00cc8284 100644 --- a/src/soundloader_type.h +++ b/src/soundloader_type.h @@ -26,7 +26,7 @@ public: ProviderManager::Unregister(*this); } - virtual bool Load(SoundEntry &sound, bool new_format, std::vector &data) = 0; + virtual bool Load(SoundEntry &sound, bool new_format, std::vector &data) = 0; }; #endif /* SOUNDLOADER_TYPE_H */ diff --git a/src/soundloader_wav.cpp b/src/soundloader_wav.cpp index 1f968ab884..d8d915cc6b 100644 --- a/src/soundloader_wav.cpp +++ b/src/soundloader_wav.cpp @@ -23,7 +23,7 @@ public: static constexpr uint16_t DEFAULT_SAMPLE_RATE = 11025; - bool Load(SoundEntry &sound, bool new_format, std::vector &data) override + bool Load(SoundEntry &sound, bool new_format, std::vector &data) override { RandomAccessFile &file = *sound.file; @@ -71,7 +71,7 @@ public: case 8: /* Convert 8-bit samples from unsigned to signed. */ for (auto &sample : data) { - sample = sample - 128; + sample ^= std::byte{0x80}; } break;