diff options
author | Chris Robinson <[email protected]> | 2023-12-17 22:36:44 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-12-17 22:36:44 -0800 |
commit | 708a90ef8ef7ee00991556298073c50dfa6e72a1 (patch) | |
tree | 5d72e46977dc241febfcf6ad4ab2ffbe2fadf2c3 /alc | |
parent | bc83c874ff15b29fdab9b6c0bf40b268345b3026 (diff) |
Fix some implicit conversions
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 3 | ||||
-rw-r--r-- | alc/alu.cpp | 12 | ||||
-rw-r--r-- | alc/backends/base.h | 5 | ||||
-rw-r--r-- | alc/effects/modulator.cpp | 2 |
4 files changed, 12 insertions, 10 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 03d36de7..a0fbdb0f 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1532,7 +1532,7 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) case DevFmtAmbi3D: break; } - nanoseconds::rep sample_delay{0}; + size_t sample_delay{0}; if(auto *encoder{device->mUhjEncoder.get()}) sample_delay += encoder->getDelay(); @@ -1625,6 +1625,7 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) } /* Convert the sample delay from samples to nanosamples to nanoseconds. */ + sample_delay = std::min<size_t>(sample_delay, std::numeric_limits<int>::max()); device->FixedLatency += nanoseconds{seconds{sample_delay}} / device->Frequency; TRACE("Fixed device latency: %" PRId64 "ns\n", int64_t{device->FixedLatency.count()}); diff --git a/alc/alu.cpp b/alc/alu.cpp index 686f0ec5..1990aeeb 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -1181,7 +1181,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con * where it can be 0 or full (non-mono sources are always full * spread here). */ - const float spread{Spread * (voice->mFmtChannels == FmtMono)}; + const float spread{Spread * float(voice->mFmtChannels == FmtMono)}; /* Local sources on HRTF play with each channel panned to its * relative location around the listener, providing "virtual @@ -1329,7 +1329,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con * where it can be 0 or full (non-mono sources are always full * spread here). */ - const float spread{Spread * (voice->mFmtChannels == FmtMono)}; + const float spread{Spread * float(voice->mFmtChannels == FmtMono)}; for(size_t c{0};c < num_channels;c++) { /* Special-case LFE */ @@ -1587,13 +1587,15 @@ void CalcAttnSourceParams(Voice *voice, const VoiceProps *props, const ContextBa if(Angle >= props->OuterAngle) { ConeGain = props->OuterGain; - ConeHF = lerpf(1.0f, props->OuterGainHF, props->DryGainHFAuto); + if(props->DryGainHFAuto) + ConeHF = props->OuterGainHF; } else if(Angle >= props->InnerAngle) { const float scale{(Angle-props->InnerAngle) / (props->OuterAngle-props->InnerAngle)}; ConeGain = lerpf(1.0f, props->OuterGain, scale); - ConeHF = lerpf(1.0f, props->OuterGainHF, scale * props->DryGainHFAuto); + if(props->DryGainHFAuto) + ConeHF = lerpf(1.0f, props->OuterGainHF, scale); } DryGainBase *= ConeGain; @@ -1770,7 +1772,7 @@ void CalcSourceParams(Voice *voice, ContextBase *context, bool force) if(props) { - voice->mProps = *props; + voice->mProps = static_cast<VoiceProps&>(*props); AtomicReplaceHead(context->mFreeVoiceProps, props); } diff --git a/alc/backends/base.h b/alc/backends/base.h index ecca6b2e..6726cd9a 100644 --- a/alc/backends/base.h +++ b/alc/backends/base.h @@ -64,6 +64,8 @@ inline ClockLatency GetClockLatency(DeviceBase *device, BackendBase *backend) struct BackendFactory { + virtual ~BackendFactory() = default; + virtual bool init() = 0; virtual bool querySupport(BackendType type) = 0; @@ -74,9 +76,6 @@ struct BackendFactory { virtual std::string probe(BackendType type) = 0; virtual BackendPtr createBackend(DeviceBase *device, BackendType type) = 0; - -protected: - virtual ~BackendFactory() = default; }; namespace al { diff --git a/alc/effects/modulator.cpp b/alc/effects/modulator.cpp index 29c225e3..8144061a 100644 --- a/alc/effects/modulator.cpp +++ b/alc/effects/modulator.cpp @@ -52,7 +52,7 @@ inline float Saw(uint index, float scale) { return static_cast<float>(index)*scale - 1.0f; } inline float Square(uint index, float scale) -{ return (static_cast<float>(index)*scale < 0.5f)*2.0f - 1.0f; } +{ return float(static_cast<float>(index)*scale < 0.5f)*2.0f - 1.0f; } inline float One(uint, float) { return 1.0f; } |