aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
Diffstat (limited to 'alc')
-rw-r--r--alc/backends/portaudio.cpp34
-rw-r--r--alc/backends/pulseaudio.cpp4
-rw-r--r--alc/backends/sndio.cpp2
-rw-r--r--alc/effects/autowah.cpp26
-rw-r--r--alc/effects/chorus.cpp4
-rw-r--r--alc/effects/dedicated.cpp4
-rw-r--r--alc/effects/echo.cpp2
-rw-r--r--alc/effects/fshifter.cpp2
-rw-r--r--alc/effects/pshifter.cpp32
-rw-r--r--alc/effects/reverb.cpp6
10 files changed, 58 insertions, 58 deletions
diff --git a/alc/backends/portaudio.cpp b/alc/backends/portaudio.cpp
index dc9725b0..b6013dcc 100644
--- a/alc/backends/portaudio.cpp
+++ b/alc/backends/portaudio.cpp
@@ -79,13 +79,6 @@ struct PortPlayback final : public BackendBase {
int writeCallback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo *timeInfo, const PaStreamCallbackFlags statusFlags) noexcept;
- static int writeCallbackC(const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *timeInfo,
- const PaStreamCallbackFlags statusFlags, void *userData) noexcept
- {
- return static_cast<PortPlayback*>(userData)->writeCallback(inputBuffer, outputBuffer,
- framesPerBuffer, timeInfo, statusFlags);
- }
void open(std::string_view name) override;
bool reset() override;
@@ -156,9 +149,16 @@ void PortPlayback::open(std::string_view name)
}
retry_open:
+ static constexpr auto writeCallback = [](const void *inputBuffer, void *outputBuffer,
+ unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *timeInfo,
+ const PaStreamCallbackFlags statusFlags, void *userData) noexcept
+ {
+ return static_cast<PortPlayback*>(userData)->writeCallback(inputBuffer, outputBuffer,
+ framesPerBuffer, timeInfo, statusFlags);
+ };
PaStream *stream{};
PaError err{Pa_OpenStream(&stream, nullptr, &params, mDevice->Frequency, mDevice->UpdateSize,
- paNoFlag, &PortPlayback::writeCallbackC, this)};
+ paNoFlag, writeCallback, this)};
if(err != paNoError)
{
if(params.sampleFormat == paFloat32)
@@ -236,13 +236,6 @@ struct PortCapture final : public BackendBase {
int readCallback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo *timeInfo, const PaStreamCallbackFlags statusFlags) noexcept;
- static int readCallbackC(const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *timeInfo,
- const PaStreamCallbackFlags statusFlags, void *userData) noexcept
- {
- return static_cast<PortCapture*>(userData)->readCallback(inputBuffer, outputBuffer,
- framesPerBuffer, timeInfo, statusFlags);
- }
void open(std::string_view name) override;
void start() override;
@@ -251,7 +244,7 @@ struct PortCapture final : public BackendBase {
uint availableSamples() override;
PaStream *mStream{nullptr};
- PaStreamParameters mParams;
+ PaStreamParameters mParams{};
RingBufferPtr mRing{nullptr};
};
@@ -317,8 +310,15 @@ void PortCapture::open(std::string_view name)
}
mParams.channelCount = static_cast<int>(mDevice->channelsFromFmt());
+ static constexpr auto readCallback = [](const void *inputBuffer, void *outputBuffer,
+ unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *timeInfo,
+ const PaStreamCallbackFlags statusFlags, void *userData) noexcept
+ {
+ return static_cast<PortCapture*>(userData)->readCallback(inputBuffer, outputBuffer,
+ framesPerBuffer, timeInfo, statusFlags);
+ };
PaError err{Pa_OpenStream(&mStream, &mParams, nullptr, mDevice->Frequency,
- paFramesPerBufferUnspecified, paNoFlag, &PortCapture::readCallbackC, this)};
+ paFramesPerBufferUnspecified, paNoFlag, readCallback, this)};
if(err != paNoError)
throw al::backend_exception{al::backend_error::NoDevice, "Failed to open stream: %s",
Pa_GetErrorText(err)};
diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp
index 8533cdb9..aec91229 100644
--- a/alc/backends/pulseaudio.cpp
+++ b/alc/backends/pulseaudio.cpp
@@ -658,8 +658,8 @@ struct PulsePlayback final : public BackendBase {
std::optional<std::string> mDeviceName{std::nullopt};
bool mIs51Rear{false};
- pa_buffer_attr mAttr;
- pa_sample_spec mSpec;
+ pa_buffer_attr mAttr{};
+ pa_sample_spec mSpec{};
pa_stream *mStream{nullptr};
diff --git a/alc/backends/sndio.cpp b/alc/backends/sndio.cpp
index 8477ed1f..2cb577fd 100644
--- a/alc/backends/sndio.cpp
+++ b/alc/backends/sndio.cpp
@@ -47,7 +47,7 @@ namespace {
constexpr char sndio_device[] = "SndIO Default";
struct SioPar : public sio_par {
- SioPar() { sio_initpar(this); }
+ SioPar() : sio_par{} { sio_initpar(this); }
void clear() { sio_initpar(this); }
};
diff --git a/alc/effects/autowah.cpp b/alc/effects/autowah.cpp
index 20c790b6..e9e14e35 100644
--- a/alc/effects/autowah.cpp
+++ b/alc/effects/autowah.cpp
@@ -50,18 +50,18 @@ constexpr float QFactor{5.0f};
struct AutowahState final : public EffectState {
/* Effect parameters */
- float mAttackRate;
- float mReleaseRate;
- float mResonanceGain;
- float mPeakGain;
- float mFreqMinNorm;
- float mBandwidthNorm;
- float mEnvDelay;
+ float mAttackRate{};
+ float mReleaseRate{};
+ float mResonanceGain{};
+ float mPeakGain{};
+ float mFreqMinNorm{};
+ float mBandwidthNorm{};
+ float mEnvDelay{};
/* Filter components derived from the envelope. */
struct FilterParam {
- float cos_w0;
- float alpha;
+ float cos_w0{};
+ float alpha{};
};
std::array<FilterParam,BufferLineSize> mEnv;
@@ -70,17 +70,17 @@ struct AutowahState final : public EffectState {
/* Effect filters' history. */
struct {
- float z1, z2;
+ float z1{}, z2{};
} mFilter;
/* Effect gains for each output channel */
- float mCurrentGain;
- float mTargetGain;
+ float mCurrentGain{};
+ float mTargetGain{};
};
std::array<ChannelData,MaxAmbiChannels> mChans;
/* Effects buffers */
- alignas(16) FloatBufferLine mBufferOut;
+ alignas(16) FloatBufferLine mBufferOut{};
void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override;
diff --git a/alc/effects/chorus.cpp b/alc/effects/chorus.cpp
index d3bcd394..f56c9f2c 100644
--- a/alc/effects/chorus.cpp
+++ b/alc/effects/chorus.cpp
@@ -58,10 +58,10 @@ struct ChorusState final : public EffectState {
uint mLfoDisp{0};
/* Calculated delays to apply to the left and right outputs. */
- std::array<std::array<uint,BufferLineSize>,2> mModDelays;
+ std::array<std::array<uint,BufferLineSize>,2> mModDelays{};
/* Temp storage for the modulated left and right outputs. */
- alignas(16) std::array<FloatBufferLine,2> mBuffer;
+ alignas(16) std::array<FloatBufferLine,2> mBuffer{};
/* Gains for left and right outputs. */
struct OutGains {
diff --git a/alc/effects/dedicated.cpp b/alc/effects/dedicated.cpp
index 609776ad..a3d4298d 100644
--- a/alc/effects/dedicated.cpp
+++ b/alc/effects/dedicated.cpp
@@ -47,8 +47,8 @@ struct DedicatedState final : public EffectState {
* gains for all possible output channels and not just the main ambisonic
* buffer.
*/
- std::array<float,MaxOutputChannels> mCurrentGains;
- std::array<float,MaxOutputChannels> mTargetGains;
+ std::array<float,MaxOutputChannels> mCurrentGains{};
+ std::array<float,MaxOutputChannels> mTargetGains{};
void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override;
diff --git a/alc/effects/echo.cpp b/alc/effects/echo.cpp
index 8def5e71..2f3343e8 100644
--- a/alc/effects/echo.cpp
+++ b/alc/effects/echo.cpp
@@ -66,7 +66,7 @@ struct EchoState final : public EffectState {
BiquadFilter mFilter;
float mFeedGain{0.0f};
- alignas(16) std::array<FloatBufferLine,2> mTempBuffer;
+ alignas(16) std::array<FloatBufferLine,2> mTempBuffer{};
void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override;
void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props,
diff --git a/alc/effects/fshifter.cpp b/alc/effects/fshifter.cpp
index 2add8379..433ebfe4 100644
--- a/alc/effects/fshifter.cpp
+++ b/alc/effects/fshifter.cpp
@@ -57,7 +57,7 @@ constexpr size_t HilStep{HilSize / OversampleFactor};
/* Define a Hann window, used to filter the HIL input and output. */
struct Windower {
- alignas(16) std::array<double,HilSize> mData;
+ alignas(16) std::array<double,HilSize> mData{};
Windower()
{
diff --git a/alc/effects/pshifter.cpp b/alc/effects/pshifter.cpp
index 24171082..9714510f 100644
--- a/alc/effects/pshifter.cpp
+++ b/alc/effects/pshifter.cpp
@@ -58,7 +58,7 @@ constexpr size_t StftStep{StftSize / OversampleFactor};
/* Define a Hann window, used to filter the STFT input and output. */
struct Windower {
- alignas(16) std::array<float,StftSize> mData;
+ alignas(16) std::array<float,StftSize> mData{};
Windower()
{
@@ -82,29 +82,29 @@ struct FrequencyBin {
struct PshifterState final : public EffectState {
/* Effect parameters */
- size_t mCount;
- size_t mPos;
- uint mPitchShiftI;
- float mPitchShift;
+ size_t mCount{};
+ size_t mPos{};
+ uint mPitchShiftI{};
+ float mPitchShift{};
/* Effects buffers */
- std::array<float,StftSize> mFIFO;
- std::array<float,StftHalfSize+1> mLastPhase;
- std::array<float,StftHalfSize+1> mSumPhase;
- std::array<float,StftSize> mOutputAccum;
+ std::array<float,StftSize> mFIFO{};
+ std::array<float,StftHalfSize+1> mLastPhase{};
+ std::array<float,StftHalfSize+1> mSumPhase{};
+ std::array<float,StftSize> mOutputAccum{};
PFFFTSetup mFft;
- alignas(16) std::array<float,StftSize> mFftBuffer;
- alignas(16) std::array<float,StftSize> mFftWorkBuffer;
+ alignas(16) std::array<float,StftSize> mFftBuffer{};
+ alignas(16) std::array<float,StftSize> mFftWorkBuffer{};
- std::array<FrequencyBin,StftHalfSize+1> mAnalysisBuffer;
- std::array<FrequencyBin,StftHalfSize+1> mSynthesisBuffer;
+ std::array<FrequencyBin,StftHalfSize+1> mAnalysisBuffer{};
+ std::array<FrequencyBin,StftHalfSize+1> mSynthesisBuffer{};
- alignas(16) FloatBufferLine mBufferOut;
+ alignas(16) FloatBufferLine mBufferOut{};
/* Effect gains for each output channel */
- std::array<float,MaxAmbiChannels> mCurrentGains;
- std::array<float,MaxAmbiChannels> mTargetGains;
+ std::array<float,MaxAmbiChannels> mCurrentGains{};
+ std::array<float,MaxAmbiChannels> mTargetGains{};
void deviceUpdate(const DeviceBase *device, const BufferStorage *buffer) override;
diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp
index 4318fa28..cc5768e2 100644
--- a/alc/effects/reverb.cpp
+++ b/alc/effects/reverb.cpp
@@ -417,12 +417,12 @@ struct Modulation {
/* The vibrato time is tracked with an index over a (MOD_FRACONE)
* normalized range.
*/
- uint Index, Step;
+ uint Index{}, Step{};
/* The depth of frequency change, in samples. */
- float Depth;
+ float Depth{};
- std::array<float,MAX_UPDATE_SAMPLES> ModDelays;
+ std::array<float,MAX_UPDATE_SAMPLES> ModDelays{};
void updateModulator(float modTime, float modDepth, float frequency);