diff options
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 2 | ||||
-rw-r--r-- | alc/alconfig.cpp | 2 | ||||
-rw-r--r-- | alc/alu.cpp | 4 | ||||
-rw-r--r-- | alc/backends/alsa.cpp | 8 | ||||
-rw-r--r-- | alc/backends/jack.cpp | 2 | ||||
-rw-r--r-- | alc/backends/pulseaudio.cpp | 10 | ||||
-rw-r--r-- | alc/backends/wave.cpp | 2 | ||||
-rw-r--r-- | alc/context.cpp | 2 | ||||
-rw-r--r-- | alc/panning.cpp | 10 |
9 files changed, 21 insertions, 21 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index a7c36d5c..bf428e07 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1621,7 +1621,7 @@ std::unique_ptr<Compressor> CreateDeviceLimiter(const ALCdevice *device, const f * to jump forward or back. Must not be called while the device is running/ * mixing. */ -static inline void UpdateClockBase(ALCdevice *device) +inline void UpdateClockBase(ALCdevice *device) { IncrementRef(device->MixCount); device->ClockBase += nanoseconds{seconds{device->SamplesDone}} / device->Frequency; diff --git a/alc/alconfig.cpp b/alc/alconfig.cpp index 14b2580d..b0544b89 100644 --- a/alc/alconfig.cpp +++ b/alc/alconfig.cpp @@ -140,7 +140,7 @@ void LoadConfigFromFile(std::istream &f) if(buffer[0] == '[') { - char *line{&buffer[0]}; + auto line = const_cast<char*>(buffer.data()); char *section = line+1; char *endsection; diff --git a/alc/alu.cpp b/alc/alu.cpp index cb732738..a171067a 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -866,7 +866,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con * scaling. */ std::transform(coeffs.begin(), coeffs.end(), coeffs.begin(), - std::bind(std::multiplies<float>{}, _1, (1.0f-coverage)*scales[0])); + [coverage, &scales](auto a){ return a * ((1.0f-coverage)*scales[0]); }); if(!(coverage > 0.0f)) { @@ -1966,7 +1966,7 @@ void ApplyDistanceComp(const al::span<FloatBufferLine> Samples, const size_t Sam auto delay_start = std::swap_ranges(inout, inout_end, distbuf); std::rotate(distbuf, delay_start, distbuf + base); } - std::transform(inout, inout_end, inout, std::bind(std::multiplies<float>{}, _1, gain)); + std::transform(inout, inout_end, inout, [gain](auto a){ return a * gain; }); } } diff --git a/alc/backends/alsa.cpp b/alc/backends/alsa.cpp index e495a34d..d620a83c 100644 --- a/alc/backends/alsa.cpp +++ b/alc/backends/alsa.cpp @@ -132,7 +132,7 @@ constexpr char alsaDevice[] = "ALSA Default"; MAGIC(snd_card_next); \ MAGIC(snd_config_update_free_global) -static void *alsa_handle; +void *alsa_handle; #define MAKE_FUNC(f) decltype(f) * p##f ALSA_FUNCS(MAKE_FUNC); #undef MAKE_FUNC @@ -330,7 +330,7 @@ al::vector<DevMap> probe_devices(snd_pcm_stream_t stream) ConfigValueStr(nullptr, "alsa", name.c_str()).value_or(main_prefix)}; int dev{-1}; - while(1) + while(true) { if(snd_ctl_pcm_next_device(handle, &dev) < 0) ERR("snd_ctl_pcm_next_device failed\n"); @@ -692,7 +692,7 @@ bool AlsaPlayback::reset() break; } - bool allowmmap{!!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "mmap", 1)}; + bool allowmmap{!!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "mmap", true)}; uint periodLen{static_cast<uint>(mDevice->UpdateSize * 1000000_u64 / mDevice->Frequency)}; uint bufferLen{static_cast<uint>(mDevice->BufferSize * 1000000_u64 / mDevice->Frequency)}; uint rate{mDevice->Frequency}; @@ -750,7 +750,7 @@ bool AlsaPlayback::reset() else mDevice->FmtChans = DevFmtStereo; } /* set rate (implicitly constrains period/buffer parameters) */ - if(!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "allow-resampler", 0) + if(!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "allow-resampler", false) || !mDevice->Flags.test(FrequencyRequest)) { if(snd_pcm_hw_params_set_rate_resample(mPcmHandle, hp.get(), 0) < 0) diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp index 419eb7e7..95796862 100644 --- a/alc/backends/jack.cpp +++ b/alc/backends/jack.cpp @@ -497,7 +497,7 @@ void JackPlayback::open(const char *name) mPortPattern = iter->mPattern; } - mRTMixing = GetConfigValueBool(name, "jack", "rt-mix", 1); + mRTMixing = GetConfigValueBool(name, "jack", "rt-mix", true); jack_set_process_callback(mClient, mRTMixing ? &JackPlayback::processRtC : &JackPlayback::processC, this); diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index 3b235c78..9b7e2c08 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -776,7 +776,7 @@ void PulsePlayback::open(const char *name) pa_stream_flags_t flags{PA_STREAM_START_CORKED | PA_STREAM_FIX_FORMAT | PA_STREAM_FIX_RATE | PA_STREAM_FIX_CHANNELS}; - if(!GetConfigValueBool(nullptr, "pulse", "allow-moves", 1)) + if(!GetConfigValueBool(nullptr, "pulse", "allow-moves", true)) flags |= PA_STREAM_DONT_MOVE; pa_sample_spec spec{}; @@ -834,9 +834,9 @@ bool PulsePlayback::reset() pa_stream_flags_t flags{PA_STREAM_START_CORKED | PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_EARLY_REQUESTS}; - if(!GetConfigValueBool(nullptr, "pulse", "allow-moves", 1)) + if(!GetConfigValueBool(nullptr, "pulse", "allow-moves", true)) flags |= PA_STREAM_DONT_MOVE; - if(GetConfigValueBool(mDevice->DeviceName.c_str(), "pulse", "adjust-latency", 0)) + if(GetConfigValueBool(mDevice->DeviceName.c_str(), "pulse", "adjust-latency", false)) { /* ADJUST_LATENCY can't be specified with EARLY_REQUESTS, for some * reason. So if the user wants to adjust the overall device latency, @@ -845,7 +845,7 @@ bool PulsePlayback::reset() flags &= ~PA_STREAM_EARLY_REQUESTS; flags |= PA_STREAM_ADJUST_LATENCY; } - if(GetConfigValueBool(mDevice->DeviceName.c_str(), "pulse", "fix-rate", 0) + if(GetConfigValueBool(mDevice->DeviceName.c_str(), "pulse", "fix-rate", false) || !mDevice->Flags.test(FrequencyRequest)) flags |= PA_STREAM_FIX_RATE; @@ -1190,7 +1190,7 @@ void PulseCapture::open(const char *name) mAttr.fragsize = minu(samples, 50*mDevice->Frequency/1000) * frame_size; pa_stream_flags_t flags{PA_STREAM_START_CORKED | PA_STREAM_ADJUST_LATENCY}; - if(!GetConfigValueBool(nullptr, "pulse", "allow-moves", 1)) + if(!GetConfigValueBool(nullptr, "pulse", "allow-moves", true)) flags |= PA_STREAM_DONT_MOVE; TRACE("Connecting to \"%s\"\n", pulse_name ? pulse_name : "(default)"); diff --git a/alc/backends/wave.cpp b/alc/backends/wave.cpp index f97f42f5..1b40640c 100644 --- a/alc/backends/wave.cpp +++ b/alc/backends/wave.cpp @@ -234,7 +234,7 @@ bool WaveBackend::reset() fseek(mFile, 0, SEEK_SET); clearerr(mFile); - if(GetConfigValueBool(nullptr, "wave", "bformat", 0)) + if(GetConfigValueBool(nullptr, "wave", "bformat", false)) { mDevice->FmtChans = DevFmtAmbi3D; mDevice->mAmbiOrder = 1; diff --git a/alc/context.cpp b/alc/context.cpp index f9aec221..b1b95321 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -230,7 +230,7 @@ bool ALCcontext::deinit() * given context. */ std::copy_if(oldarray->begin(), oldarray->end(), newarray->begin(), - std::bind(std::not_equal_to<>{}, _1, this)); + [this](auto a){ return a != this; }); /* Store the new context array in the device. Wait for any current mix * to finish before deleting the old array. diff --git a/alc/panning.cpp b/alc/panning.cpp index 60b6cbf4..62d745f1 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -232,7 +232,7 @@ void InitNearFieldCtrl(ALCdevice *device, float ctrl_dist, uint order, bool is3d static const uint chans_per_order3d[MaxAmbiOrder+1]{ 1, 3, 5, 7 }; /* NFC is only used when AvgSpeakerDist is greater than 0. */ - if(!device->getConfigValueBool("decoder", "nfc", 0) || !(ctrl_dist > 0.0f)) + if(!device->getConfigValueBool("decoder", "nfc", false) || !(ctrl_dist > 0.0f)) return; device->AvgSpeakerDist = clampf(ctrl_dist, 0.1f, 10.0f); @@ -252,7 +252,7 @@ void InitDistanceComp(ALCdevice *device, const al::span<const Channel> channels, { const float maxdist{std::accumulate(std::begin(dists), std::end(dists), 0.0f, maxf)}; - if(!device->getConfigValueBool("decoder", "distance-comp", 1) || !(maxdist > 0.0f)) + if(!device->getConfigValueBool("decoder", "distance-comp", true) || !(maxdist > 0.0f)) return; const auto distSampleScale = static_cast<float>(device->Frequency) / SpeedOfSoundMetersPerSec; @@ -339,7 +339,7 @@ DecoderView MakeDecoderView(ALCdevice *device, const AmbDecConf *conf, switch(conf->CoeffScale) { - case AmbDecScale::Unset: ASSUME(0); break; + case AmbDecScale::Unset: ASSUME(false); break; case AmbDecScale::N3D: decoder.mScaling = DevAmbiScaling::N3D; break; case AmbDecScale::SN3D: decoder.mScaling = DevAmbiScaling::SN3D; break; case AmbDecScale::FuMa: decoder.mScaling = DevAmbiScaling::FuMa; break; @@ -1007,8 +1007,8 @@ void aluInitRenderer(ALCdevice *device, int hrtf_id, al::optional<StereoEncoding const bool stablize{device->RealOut.ChannelIndex[FrontCenter] != INVALID_CHANNEL_INDEX && device->RealOut.ChannelIndex[FrontLeft] != INVALID_CHANNEL_INDEX && device->RealOut.ChannelIndex[FrontRight] != INVALID_CHANNEL_INDEX - && device->getConfigValueBool(nullptr, "front-stablizer", 0) != 0}; - const bool hqdec{device->getConfigValueBool("decoder", "hq-mode", 1) != 0}; + && device->getConfigValueBool(nullptr, "front-stablizer", false) != 0}; + const bool hqdec{device->getConfigValueBool("decoder", "hq-mode", true) != 0}; InitPanning(device, hqdec, stablize, decoder); if(decoder) { |