diff options
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 2 | ||||
-rw-r--r-- | alc/alu.cpp | 12 | ||||
-rw-r--r-- | alc/backends/opensl.cpp | 2 | ||||
-rw-r--r-- | alc/backends/pulseaudio.cpp | 22 | ||||
-rw-r--r-- | alc/bformatdec.cpp | 4 | ||||
-rw-r--r-- | alc/effects/pshifter.cpp | 4 | ||||
-rw-r--r-- | alc/effects/reverb.cpp | 2 | ||||
-rw-r--r-- | alc/helpers.cpp | 2 | ||||
-rw-r--r-- | alc/logging.h | 8 | ||||
-rw-r--r-- | alc/mastering.cpp | 2 | ||||
-rw-r--r-- | alc/mixer/mixer_neon.cpp | 6 | ||||
-rw-r--r-- | alc/mixer/mixer_sse.cpp | 6 | ||||
-rw-r--r-- | alc/mixvoice.cpp | 16 |
13 files changed, 44 insertions, 44 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 615fc154..f66654c2 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -4193,7 +4193,7 @@ START_API_FUNC device->Connected.store(true); ALCenum err{UpdateDeviceParams(dev.get(), attribs)}; - if(LIKELY(err == ALC_NO_ERROR)) return ALC_TRUE; + if LIKELY(err == ALC_NO_ERROR) return ALC_TRUE; alcSetError(dev.get(), err); if(err == ALC_INVALID_DEVICE) diff --git a/alc/alu.cpp b/alc/alu.cpp index 253dbe48..412bfffa 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -383,7 +383,7 @@ bool CalcEffectSlotParams(ALeffectslot *slot, ALCcontext *context, bool force) */ RingBuffer *ring{context->mAsyncEvents.get()}; auto evt_vec = ring->getWriteVector(); - if(LIKELY(evt_vec.first.len > 0)) + if LIKELY(evt_vec.first.len > 0) { AsyncEvent *evt{new (evt_vec.first.buf) AsyncEvent{EventType_ReleaseEffectState}}; evt->u.mEffectState = oldstate; @@ -1347,7 +1347,7 @@ void ProcessParamUpdates(ALCcontext *ctx, const ALeffectslotArray &slots, const al::span<ALvoice> voices) { IncrementRef(ctx->mUpdateCount); - if(LIKELY(!ctx->mHoldUpdates.load(std::memory_order_acquire))) + if LIKELY(!ctx->mHoldUpdates.load(std::memory_order_acquire)) { bool cforce{CalcContextParams(ctx)}; bool force{CalcListenerParams(ctx) || cforce}; @@ -1463,7 +1463,7 @@ void ApplyStablizer(FrontStablizer *Stablizer, const al::span<FloatBufferLine> B auto &DelayBuf = Stablizer->DelayBuf[i]; auto buffer_end = Buffer[i].begin() + SamplesToDo; - if(LIKELY(SamplesToDo >= ALsizei{FrontStablizer::DelayLength})) + if LIKELY(SamplesToDo >= ALsizei{FrontStablizer::DelayLength}) { auto delay_end = std::rotate(Buffer[i].begin(), buffer_end - FrontStablizer::DelayLength, buffer_end); @@ -1556,7 +1556,7 @@ void ApplyDistanceComp(const al::span<FloatBufferLine> Samples, const ALsizei Sa ALfloat *inout{al::assume_aligned<16>(chanbuffer.data())}; auto inout_end = inout + SamplesToDo; - if(LIKELY(SamplesToDo >= base)) + if LIKELY(SamplesToDo >= base) { auto delay_end = std::rotate(inout, inout_end - base, inout_end); std::swap_ranges(inout, delay_end, distbuf); @@ -1690,7 +1690,7 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples) /* Apply any needed post-process for finalizing the Dry mix to the * RealOut (Ambisonic decode, UHJ encode, etc). */ - if(LIKELY(device->PostProcess)) + if LIKELY(device->PostProcess) device->PostProcess(device, SamplesToDo); const al::span<FloatBufferLine> RealOut{device->RealOut.Buffer}; @@ -1718,7 +1718,7 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples) if(device->DitherDepth > 0.0f) ApplyDither(RealOut, &device->DitherSeed, device->DitherDepth, SamplesToDo); - if(LIKELY(OutBuffer)) + if LIKELY(OutBuffer) { /* Finally, interleave and convert samples, writing to the device's * output buffer. diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp index b34dc0cb..d9a7836e 100644 --- a/alc/backends/opensl.cpp +++ b/alc/backends/opensl.cpp @@ -136,7 +136,7 @@ const char *res_str(SLresult result) } #define PRINTERR(x, s) do { \ - if(UNLIKELY((x) != SL_RESULT_SUCCESS)) \ + if UNLIKELY((x) != SL_RESULT_SUCCESS) \ ERR("%s: %s\n", (s), res_str((x))); \ } while(0) diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index da209c8d..2ddcc86d 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -379,7 +379,7 @@ pa_context *connect_context(std::unique_lock<std::mutex> &plock) if(!binname.fname.empty()) name = binname.fname.c_str(); - if(UNLIKELY(!pulse_mainloop)) + if UNLIKELY(!pulse_mainloop) { std::thread{pulse_mainloop_thread}.detach(); while(!pulse_mainloop) @@ -744,7 +744,7 @@ void PulsePlayback::streamWriteCallback(pa_stream *stream, size_t nbytes) aluMixData(mDevice, buf, nbytes/mFrameSize); int ret{pa_stream_write(stream, buf, nbytes, pa_xfree, 0, PA_SEEK_RELATIVE)}; - if(UNLIKELY(ret != PA_OK)) + if UNLIKELY(ret != PA_OK) ERR("Failed to write to stream: %d, %s\n", ret, pa_strerror(ret)); } @@ -1064,7 +1064,7 @@ ClockLatency PulsePlayback::getClockLatency() err = pa_stream_get_latency(mStream, &latency, &neg); } - if(UNLIKELY(err != 0)) + if UNLIKELY(err != 0) { /* FIXME: if err = -PA_ERR_NODATA, it means we were called too soon * after starting the stream and no timing info has been received from @@ -1075,7 +1075,7 @@ ClockLatency PulsePlayback::getClockLatency() latency = 0; neg = 0; } - else if(UNLIKELY(neg)) + else if UNLIKELY(neg) latency = 0; ret.Latency = std::chrono::microseconds{latency}; @@ -1328,24 +1328,24 @@ ALCenum PulseCapture::captureSamples(ALCvoid *buffer, ALCuint samples) { if(mCapBuffer.empty()) { - if(UNLIKELY(!mDevice->Connected.load(std::memory_order_acquire))) + if UNLIKELY(!mDevice->Connected.load(std::memory_order_acquire)) break; const pa_stream_state_t state{pa_stream_get_state(mStream)}; - if(UNLIKELY(!PA_STREAM_IS_GOOD(state))) + if UNLIKELY(!PA_STREAM_IS_GOOD(state)) { aluHandleDisconnect(mDevice, "Bad capture state: %u", state); break; } const void *capbuf; size_t caplen; - if(UNLIKELY(pa_stream_peek(mStream, &capbuf, &caplen) < 0)) + if UNLIKELY(pa_stream_peek(mStream, &capbuf, &caplen) < 0) { aluHandleDisconnect(mDevice, "Failed retrieving capture samples: %s", pa_strerror(pa_context_errno(mContext))); break; } if(caplen == 0) break; - if(UNLIKELY(!capbuf)) + if UNLIKELY(!capbuf) mCapLen = -static_cast<ssize_t>(caplen); else mCapLen = static_cast<ssize_t>(caplen); @@ -1353,7 +1353,7 @@ ALCenum PulseCapture::captureSamples(ALCvoid *buffer, ALCuint samples) } const size_t rem{minz(dstbuf.size(), mCapBuffer.size())}; - if(UNLIKELY(mCapLen < 0)) + if UNLIKELY(mCapLen < 0) std::fill_n(dstbuf.begin(), rem, mSilentVal); else std::copy_n(mCapBuffer.begin(), rem, dstbuf.begin()); @@ -1409,13 +1409,13 @@ ClockLatency PulseCapture::getClockLatency() err = pa_stream_get_latency(mStream, &latency, &neg); } - if(UNLIKELY(err != 0)) + if UNLIKELY(err != 0) { ERR("Failed to get stream latency: 0x%x\n", err); latency = 0; neg = 0; } - else if(UNLIKELY(neg)) + else if UNLIKELY(neg) latency = 0; ret.Latency = std::chrono::microseconds{latency}; diff --git a/alc/bformatdec.cpp b/alc/bformatdec.cpp index 6b20dd84..8319600e 100644 --- a/alc/bformatdec.cpp +++ b/alc/bformatdec.cpp @@ -160,7 +160,7 @@ void BFormatDec::process(const al::span<FloatBufferLine> OutBuffer, ALuint enabled{mEnabled}; for(FloatBufferLine &outbuf : OutBuffer) { - if(LIKELY(enabled&1)) + if LIKELY(enabled&1) { MixRowSamples(outbuf, (*mixmtx)[sHFBand], hfsamples, 0, SamplesToDo); MixRowSamples(outbuf, (*mixmtx)[sLFBand], lfsamples, 0, SamplesToDo); @@ -176,7 +176,7 @@ void BFormatDec::process(const al::span<FloatBufferLine> OutBuffer, ALuint enabled{mEnabled}; for(FloatBufferLine &outbuf : OutBuffer) { - if(LIKELY(enabled&1)) + if LIKELY(enabled&1) MixRowSamples(outbuf, *mixmtx, insamples, 0, SamplesToDo); ++mixmtx; enabled >>= 1; diff --git a/alc/effects/pshifter.cpp b/alc/effects/pshifter.cpp index a08052b9..819e510c 100644 --- a/alc/effects/pshifter.cpp +++ b/alc/effects/pshifter.cpp @@ -68,11 +68,11 @@ inline int double2int(double d) shift = ((conv.i64>>52)&0x7ff) - (1023+52); /* Over/underflow */ - if(UNLIKELY(shift >= 63 || shift < -52)) + if UNLIKELY(shift >= 63 || shift < -52) return 0; mant = (conv.i64&0xfffffffffffff_i64) | 0x10000000000000_i64; - if(LIKELY(shift < 0)) + if LIKELY(shift < 0) return (int)(mant >> -shift) * sign; return (int)(mant << shift) * sign; diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index 51a57360..a8c4523e 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -1484,7 +1484,7 @@ void ReverbState::process(const ALsizei samplesToDo, const FloatBufferLine *REST mDelay.write(offset, c, afmt[c].data()+base, todo); /* Process the samples for reverb. */ - if(UNLIKELY(fadeCount < FADE_SAMPLES)) + if UNLIKELY(fadeCount < FADE_SAMPLES) { auto fade = static_cast<ALfloat>(fadeCount); diff --git a/alc/helpers.cpp b/alc/helpers.cpp index e86af6ce..7a547168 100644 --- a/alc/helpers.cpp +++ b/alc/helpers.cpp @@ -478,7 +478,7 @@ void al_print(FILE *logfile, const char *fmt, ...) va_start(args, fmt); va_copy(args2, args); int msglen{std::vsnprintf(str, sizeof(stcmsg), fmt, args)}; - if(UNLIKELY(msglen >= 0 && static_cast<size_t>(msglen) >= sizeof(stcmsg))) + if UNLIKELY(msglen >= 0 && static_cast<size_t>(msglen) >= sizeof(stcmsg)) { dynmsg.resize(static_cast<size_t>(msglen) + 1u); str = dynmsg.data(); diff --git a/alc/logging.h b/alc/logging.h index 0bb0c87b..8a3e75e6 100644 --- a/alc/logging.h +++ b/alc/logging.h @@ -39,24 +39,24 @@ enum LogLevel { extern LogLevel gLogLevel; #define TRACEREF(...) do { \ - if(UNLIKELY(gLogLevel >= LogRef)) \ + if UNLIKELY(gLogLevel >= LogRef) \ AL_PRINT("(--)", __VA_ARGS__); \ } while(0) #define TRACE(...) do { \ - if(UNLIKELY(gLogLevel >= LogTrace)) \ + if UNLIKELY(gLogLevel >= LogTrace) \ AL_PRINT("(II)", __VA_ARGS__); \ LOG_ANDROID(ANDROID_LOG_DEBUG, __VA_ARGS__); \ } while(0) #define WARN(...) do { \ - if(UNLIKELY(gLogLevel >= LogWarning)) \ + if UNLIKELY(gLogLevel >= LogWarning) \ AL_PRINT("(WW)", __VA_ARGS__); \ LOG_ANDROID(ANDROID_LOG_WARN, __VA_ARGS__); \ } while(0) #define ERR(...) do { \ - if(UNLIKELY(gLogLevel >= LogError)) \ + if UNLIKELY(gLogLevel >= LogError) \ AL_PRINT("(EE)", __VA_ARGS__); \ LOG_ANDROID(ANDROID_LOG_ERROR, __VA_ARGS__); \ } while(0) diff --git a/alc/mastering.cpp b/alc/mastering.cpp index ec40001b..d4d87c25 100644 --- a/alc/mastering.cpp +++ b/alc/mastering.cpp @@ -314,7 +314,7 @@ void SignalDelay(Compressor *Comp, const ALsizei SamplesToDo, FloatBufferLine *O ALfloat *delaybuf{al::assume_aligned<16>(Comp->mDelay[c].data())}; auto inout_end = inout + SamplesToDo; - if(LIKELY(SamplesToDo >= lookAhead)) + if LIKELY(SamplesToDo >= lookAhead) { auto delay_end = std::rotate(inout, inout_end - lookAhead, inout_end); std::swap_ranges(inout, delay_end, delaybuf); diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp index b4ca61d7..f43063ce 100644 --- a/alc/mixer/mixer_neon.cpp +++ b/alc/mixer/mixer_neon.cpp @@ -209,7 +209,7 @@ void Mix_<NEONTag>(const ALfloat *data, const al::span<FloatBufferLine> OutBuffe const ALfloat step{diff * delta}; ALfloat step_count{0.0f}; /* Mix with applying gain steps in aligned multiples of 4. */ - if(LIKELY(minsize > 3)) + if LIKELY(minsize > 3) { const float32x4_t four4{vdupq_n_f32(4.0f)}; const float32x4_t step4{vdupq_n_f32(step)}; @@ -258,7 +258,7 @@ void Mix_<NEONTag>(const ALfloat *data, const al::span<FloatBufferLine> OutBuffe if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD)) continue; - if(LIKELY(BufferSize-pos > 3)) + if LIKELY(BufferSize-pos > 3) { ALsizei todo{(BufferSize-pos) >> 2}; const float32x4_t gain4 = vdupq_n_f32(gain); @@ -289,7 +289,7 @@ void MixRow_<NEONTag>(FloatBufferLine &OutBuffer, const ALfloat *Gains, continue; ALsizei pos{0}; - if(LIKELY(BufferSize > 3)) + if LIKELY(BufferSize > 3) { ALsizei todo{BufferSize >> 2}; float32x4_t gain4{vdupq_n_f32(gain)}; diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp index b52ef256..cff37d2b 100644 --- a/alc/mixer/mixer_sse.cpp +++ b/alc/mixer/mixer_sse.cpp @@ -165,7 +165,7 @@ void Mix_<SSETag>(const ALfloat *data, const al::span<FloatBufferLine> OutBuffer const ALfloat step{diff * delta}; ALfloat step_count{0.0f}; /* Mix with applying gain steps in aligned multiples of 4. */ - if(LIKELY(minsize > 3)) + if LIKELY(minsize > 3) { const __m128 four4{_mm_set1_ps(4.0f)}; const __m128 step4{_mm_set1_ps(step)}; @@ -211,7 +211,7 @@ void Mix_<SSETag>(const ALfloat *data, const al::span<FloatBufferLine> OutBuffer if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD)) continue; - if(LIKELY(BufferSize-pos > 3)) + if LIKELY(BufferSize-pos > 3) { ALsizei todo{(BufferSize-pos) >> 2}; const __m128 gain4{_mm_set1_ps(gain)}; @@ -242,7 +242,7 @@ void MixRow_<SSETag>(FloatBufferLine &OutBuffer, const ALfloat *Gains, continue; ALsizei pos{0}; - if(LIKELY(BufferSize > 3)) + if LIKELY(BufferSize > 3) { ALsizei todo{BufferSize >> 2}; const __m128 gain4 = _mm_set1_ps(gain); diff --git a/alc/mixvoice.cpp b/alc/mixvoice.cpp index 06324397..df955719 100644 --- a/alc/mixvoice.cpp +++ b/alc/mixvoice.cpp @@ -635,7 +635,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc SrcData.begin()); std::fill(srciter, SrcData.end(), 0.0f); - if(UNLIKELY(!BufferListItem)) + if UNLIKELY(!BufferListItem) srciter = std::copy(chandata.mPrevSamples.begin()+MAX_RESAMPLE_PADDING, chandata.mPrevSamples.end(), srciter); else if(isstatic) @@ -645,7 +645,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc srciter = LoadBufferQueue(BufferListItem, BufferLoopItem, NumChannels, SampleSize, chan, DataPosInt, {srciter, SrcData.end()}); - if(UNLIKELY(srciter != SrcData.end())) + if UNLIKELY(srciter != SrcData.end()) { /* If the source buffer wasn't filled, copy the last sample for * the remaining buffer. Ideally it should have ended with @@ -734,7 +734,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc * and new target gains given how much of the fade time * this mix handles. */ - if(LIKELY(Counter > fademix)) + if LIKELY(Counter > fademix) { const ALfloat a{static_cast<ALfloat>(fademix) / static_cast<ALfloat>(Counter)}; @@ -758,7 +758,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc parms.Hrtf.Old.Gain = TargetGain; } - if(LIKELY(fademix < DstBufferSize)) + if LIKELY(fademix < DstBufferSize) { const ALsizei todo{DstBufferSize - fademix}; ALfloat gain{TargetGain}; @@ -856,7 +856,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc OutPos += DstBufferSize; Counter = maxi(DstBufferSize, Counter) - DstBufferSize; - if(UNLIKELY(!BufferListItem)) + if UNLIKELY(!BufferListItem) { /* Do nothing extra when there's no buffers. */ } @@ -879,7 +879,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc /* Handle non-looping static source */ if(DataPosInt >= BufferListItem->mMaxSamples) { - if(LIKELY(vstate == ALvoice::Playing)) + if LIKELY(vstate == ALvoice::Playing) vstate = ALvoice::Stopped; BufferListItem = nullptr; break; @@ -898,7 +898,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc BufferListItem = BufferListItem->mNext.load(std::memory_order_relaxed); if(!BufferListItem && !(BufferListItem=BufferLoopItem)) { - if(LIKELY(vstate == ALvoice::Playing)) + if LIKELY(vstate == ALvoice::Playing) vstate = ALvoice::Stopped; break; } @@ -908,7 +908,7 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc voice->mFlags |= VOICE_IS_FADING; /* Don't update positions and buffers if we were stopping. */ - if(UNLIKELY(vstate == ALvoice::Stopping)) + if UNLIKELY(vstate == ALvoice::Stopping) { voice->mPlayState.store(ALvoice::Stopped, std::memory_order_release); return; |