aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/alsa.cpp252
-rw-r--r--Alc/backends/coreaudio.cpp184
-rw-r--r--Alc/backends/dsound.cpp14
-rw-r--r--Alc/backends/jack.cpp8
-rw-r--r--Alc/backends/null.cpp14
-rw-r--r--Alc/backends/oss.cpp58
-rw-r--r--Alc/backends/portaudio.cpp129
-rw-r--r--Alc/backends/pulseaudio.cpp18
-rw-r--r--Alc/backends/qsa.cpp12
-rw-r--r--Alc/backends/sndio.cpp18
-rw-r--r--Alc/backends/solaris.cpp10
-rw-r--r--Alc/backends/wave.cpp14
-rw-r--r--Alc/backends/winmm.cpp30
13 files changed, 378 insertions, 383 deletions
diff --git a/Alc/backends/alsa.cpp b/Alc/backends/alsa.cpp
index 1a048fc7..20ffc559 100644
--- a/Alc/backends/alsa.cpp
+++ b/Alc/backends/alsa.cpp
@@ -423,12 +423,12 @@ int verify_state(snd_pcm_t *handle)
struct ALCplaybackAlsa final : public ALCbackend {
- snd_pcm_t *pcmHandle{nullptr};
+ snd_pcm_t *PcmHandle{nullptr};
- al::vector<char> buffer;
+ al::vector<char> Buffer;
- std::atomic<ALenum> killNow{AL_TRUE};
- std::thread thread;
+ std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::thread mThread;
};
int ALCplaybackAlsa_mixerProc(ALCplaybackAlsa *self);
@@ -458,9 +458,9 @@ void ALCplaybackAlsa_Construct(ALCplaybackAlsa *self, ALCdevice *device)
void ALCplaybackAlsa_Destruct(ALCplaybackAlsa *self)
{
- if(self->pcmHandle)
- snd_pcm_close(self->pcmHandle);
- self->pcmHandle = nullptr;
+ if(self->PcmHandle)
+ snd_pcm_close(self->PcmHandle);
+ self->PcmHandle = nullptr;
ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
self->~ALCplaybackAlsa();
@@ -476,9 +476,9 @@ int ALCplaybackAlsa_mixerProc(ALCplaybackAlsa *self)
snd_pcm_uframes_t update_size{device->UpdateSize};
snd_pcm_uframes_t num_updates{device->NumUpdates};
- while(!self->killNow.load(std::memory_order_acquire))
+ while(!self->mKillNow.load(std::memory_order_acquire))
{
- int state{verify_state(self->pcmHandle)};
+ int state{verify_state(self->PcmHandle)};
if(state < 0)
{
ERR("Invalid state detected: %s\n", snd_strerror(state));
@@ -488,7 +488,7 @@ int ALCplaybackAlsa_mixerProc(ALCplaybackAlsa *self)
break;
}
- snd_pcm_sframes_t avail{snd_pcm_avail_update(self->pcmHandle)};
+ snd_pcm_sframes_t avail{snd_pcm_avail_update(self->PcmHandle)};
if(avail < 0)
{
ERR("available update failed: %s\n", snd_strerror(avail));
@@ -498,7 +498,7 @@ int ALCplaybackAlsa_mixerProc(ALCplaybackAlsa *self)
if((snd_pcm_uframes_t)avail > update_size*(num_updates+1))
{
WARN("available samples exceeds the buffer size\n");
- snd_pcm_reset(self->pcmHandle);
+ snd_pcm_reset(self->PcmHandle);
continue;
}
@@ -507,14 +507,14 @@ int ALCplaybackAlsa_mixerProc(ALCplaybackAlsa *self)
{
if(state != SND_PCM_STATE_RUNNING)
{
- int err{snd_pcm_start(self->pcmHandle)};
+ int err{snd_pcm_start(self->PcmHandle)};
if(err < 0)
{
ERR("start failed: %s\n", snd_strerror(err));
continue;
}
}
- if(snd_pcm_wait(self->pcmHandle, 1000) == 0)
+ if(snd_pcm_wait(self->PcmHandle, 1000) == 0)
ERR("Wait timeout... buffer size too low?\n");
continue;
}
@@ -528,7 +528,7 @@ int ALCplaybackAlsa_mixerProc(ALCplaybackAlsa *self)
const snd_pcm_channel_area_t *areas{};
snd_pcm_uframes_t offset{};
- int err{snd_pcm_mmap_begin(self->pcmHandle, &areas, &offset, &frames)};
+ int err{snd_pcm_mmap_begin(self->PcmHandle, &areas, &offset, &frames)};
if(err < 0)
{
ERR("mmap begin error: %s\n", snd_strerror(err));
@@ -538,7 +538,7 @@ int ALCplaybackAlsa_mixerProc(ALCplaybackAlsa *self)
char *WritePtr{(char*)areas->addr + (offset * areas->step / 8)};
aluMixData(device, WritePtr, frames);
- snd_pcm_sframes_t commitres{snd_pcm_mmap_commit(self->pcmHandle, offset, frames)};
+ snd_pcm_sframes_t commitres{snd_pcm_mmap_commit(self->PcmHandle, offset, frames)};
if(commitres < 0 || (commitres-frames) != 0)
{
ERR("mmap commit error: %s\n",
@@ -563,9 +563,9 @@ int ALCplaybackAlsa_mixerNoMMapProc(ALCplaybackAlsa *self)
snd_pcm_uframes_t update_size{device->UpdateSize};
snd_pcm_uframes_t num_updates{device->NumUpdates};
- while(!self->killNow.load(std::memory_order_acquire))
+ while(!self->mKillNow.load(std::memory_order_acquire))
{
- int state{verify_state(self->pcmHandle)};
+ int state{verify_state(self->PcmHandle)};
if(state < 0)
{
ERR("Invalid state detected: %s\n", snd_strerror(state));
@@ -575,7 +575,7 @@ int ALCplaybackAlsa_mixerNoMMapProc(ALCplaybackAlsa *self)
break;
}
- snd_pcm_sframes_t avail{snd_pcm_avail_update(self->pcmHandle)};
+ snd_pcm_sframes_t avail{snd_pcm_avail_update(self->PcmHandle)};
if(avail < 0)
{
ERR("available update failed: %s\n", snd_strerror(avail));
@@ -585,7 +585,7 @@ int ALCplaybackAlsa_mixerNoMMapProc(ALCplaybackAlsa *self)
if((snd_pcm_uframes_t)avail > update_size*num_updates)
{
WARN("available samples exceeds the buffer size\n");
- snd_pcm_reset(self->pcmHandle);
+ snd_pcm_reset(self->PcmHandle);
continue;
}
@@ -593,25 +593,25 @@ int ALCplaybackAlsa_mixerNoMMapProc(ALCplaybackAlsa *self)
{
if(state != SND_PCM_STATE_RUNNING)
{
- int err{snd_pcm_start(self->pcmHandle)};
+ int err{snd_pcm_start(self->PcmHandle)};
if(err < 0)
{
ERR("start failed: %s\n", snd_strerror(err));
continue;
}
}
- if(snd_pcm_wait(self->pcmHandle, 1000) == 0)
+ if(snd_pcm_wait(self->PcmHandle, 1000) == 0)
ERR("Wait timeout... buffer size too low?\n");
continue;
}
ALCplaybackAlsa_lock(self);
- char *WritePtr{self->buffer.data()};
- avail = snd_pcm_bytes_to_frames(self->pcmHandle, self->buffer.size());
+ char *WritePtr{self->Buffer.data()};
+ avail = snd_pcm_bytes_to_frames(self->PcmHandle, self->Buffer.size());
aluMixData(device, WritePtr, avail);
while(avail > 0)
{
- int ret = snd_pcm_writei(self->pcmHandle, WritePtr, avail);
+ int ret = snd_pcm_writei(self->PcmHandle, WritePtr, avail);
switch (ret)
{
case -EAGAIN:
@@ -621,21 +621,21 @@ int ALCplaybackAlsa_mixerNoMMapProc(ALCplaybackAlsa *self)
#endif
case -EPIPE:
case -EINTR:
- ret = snd_pcm_recover(self->pcmHandle, ret, 1);
+ ret = snd_pcm_recover(self->PcmHandle, ret, 1);
if(ret < 0)
avail = 0;
break;
default:
if (ret >= 0)
{
- WritePtr += snd_pcm_frames_to_bytes(self->pcmHandle, ret);
+ WritePtr += snd_pcm_frames_to_bytes(self->PcmHandle, ret);
avail -= ret;
}
break;
}
if (ret < 0)
{
- ret = snd_pcm_prepare(self->pcmHandle);
+ ret = snd_pcm_prepare(self->PcmHandle);
if(ret < 0)
break;
}
@@ -670,7 +670,7 @@ ALCenum ALCplaybackAlsa_open(ALCplaybackAlsa *self, const ALCchar *name)
}
TRACE("Opening device \"%s\"\n", driver);
- int err{snd_pcm_open(&self->pcmHandle, driver, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)};
+ int err{snd_pcm_open(&self->PcmHandle, driver, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)};
if(err < 0)
{
ERR("Could not open playback device '%s': %s\n", driver, snd_strerror(err));
@@ -730,15 +730,15 @@ ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self)
int dir, err;
snd_pcm_hw_params_malloc(&hp);
#define CHECK(x) if((funcerr=#x),(err=(x)) < 0) goto error
- CHECK(snd_pcm_hw_params_any(self->pcmHandle, hp));
+ CHECK(snd_pcm_hw_params_any(self->PcmHandle, hp));
/* set interleaved access */
- if(!allowmmap || snd_pcm_hw_params_set_access(self->pcmHandle, hp, SND_PCM_ACCESS_MMAP_INTERLEAVED) < 0)
+ if(!allowmmap || snd_pcm_hw_params_set_access(self->PcmHandle, hp, SND_PCM_ACCESS_MMAP_INTERLEAVED) < 0)
{
/* No mmap */
- CHECK(snd_pcm_hw_params_set_access(self->pcmHandle, hp, SND_PCM_ACCESS_RW_INTERLEAVED));
+ CHECK(snd_pcm_hw_params_set_access(self->PcmHandle, hp, SND_PCM_ACCESS_RW_INTERLEAVED));
}
/* test and set format (implicitly sets sample bits) */
- if(snd_pcm_hw_params_test_format(self->pcmHandle, hp, format) < 0)
+ if(snd_pcm_hw_params_test_format(self->PcmHandle, hp, format) < 0)
{
static const struct {
snd_pcm_format_t format;
@@ -756,16 +756,16 @@ ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self)
for(const auto &fmt : formatlist)
{
format = fmt.format;
- if(snd_pcm_hw_params_test_format(self->pcmHandle, hp, format) >= 0)
+ if(snd_pcm_hw_params_test_format(self->PcmHandle, hp, format) >= 0)
{
device->FmtType = fmt.fmttype;
break;
}
}
}
- CHECK(snd_pcm_hw_params_set_format(self->pcmHandle, hp, format));
+ CHECK(snd_pcm_hw_params_set_format(self->PcmHandle, hp, format));
/* test and set channels (implicitly sets frame bits) */
- if(snd_pcm_hw_params_test_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans, device->mAmbiOrder)) < 0)
+ if(snd_pcm_hw_params_test_channels(self->PcmHandle, hp, ChannelsFromDevFmt(device->FmtChans, device->mAmbiOrder)) < 0)
{
static const enum DevFmtChannels channellist[] = {
DevFmtStereo,
@@ -777,7 +777,7 @@ ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self)
for(const auto &chan : channellist)
{
- if(snd_pcm_hw_params_test_channels(self->pcmHandle, hp, ChannelsFromDevFmt(chan, 0)) >= 0)
+ if(snd_pcm_hw_params_test_channels(self->PcmHandle, hp, ChannelsFromDevFmt(chan, 0)) >= 0)
{
device->FmtChans = chan;
device->mAmbiOrder = 0;
@@ -785,25 +785,25 @@ ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self)
}
}
}
- CHECK(snd_pcm_hw_params_set_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans, device->mAmbiOrder)));
+ CHECK(snd_pcm_hw_params_set_channels(self->PcmHandle, hp, ChannelsFromDevFmt(device->FmtChans, device->mAmbiOrder)));
/* set rate (implicitly constrains period/buffer parameters) */
if(!GetConfigValueBool(device->DeviceName.c_str(), "alsa", "allow-resampler", 0) ||
!(device->Flags&DEVICE_FREQUENCY_REQUEST))
{
- if(snd_pcm_hw_params_set_rate_resample(self->pcmHandle, hp, 0) < 0)
+ if(snd_pcm_hw_params_set_rate_resample(self->PcmHandle, hp, 0) < 0)
ERR("Failed to disable ALSA resampler\n");
}
- else if(snd_pcm_hw_params_set_rate_resample(self->pcmHandle, hp, 1) < 0)
+ else if(snd_pcm_hw_params_set_rate_resample(self->PcmHandle, hp, 1) < 0)
ERR("Failed to enable ALSA resampler\n");
- CHECK(snd_pcm_hw_params_set_rate_near(self->pcmHandle, hp, &rate, nullptr));
+ CHECK(snd_pcm_hw_params_set_rate_near(self->PcmHandle, hp, &rate, nullptr));
/* set buffer time (implicitly constrains period/buffer parameters) */
- if((err=snd_pcm_hw_params_set_buffer_time_near(self->pcmHandle, hp, &bufferLen, nullptr)) < 0)
+ if((err=snd_pcm_hw_params_set_buffer_time_near(self->PcmHandle, hp, &bufferLen, nullptr)) < 0)
ERR("snd_pcm_hw_params_set_buffer_time_near failed: %s\n", snd_strerror(err));
/* set period time (implicitly sets buffer size/bytes/time and period size/bytes) */
- if((err=snd_pcm_hw_params_set_period_time_near(self->pcmHandle, hp, &periodLen, nullptr)) < 0)
+ if((err=snd_pcm_hw_params_set_period_time_near(self->PcmHandle, hp, &periodLen, nullptr)) < 0)
ERR("snd_pcm_hw_params_set_period_time_near failed: %s\n", snd_strerror(err));
/* install and prepare hardware configuration */
- CHECK(snd_pcm_hw_params(self->pcmHandle, hp));
+ CHECK(snd_pcm_hw_params(self->PcmHandle, hp));
/* retrieve configuration info */
CHECK(snd_pcm_hw_params_get_access(hp, &access));
@@ -815,10 +815,10 @@ ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self)
hp = nullptr;
snd_pcm_sw_params_malloc(&sp);
- CHECK(snd_pcm_sw_params_current(self->pcmHandle, sp));
- CHECK(snd_pcm_sw_params_set_avail_min(self->pcmHandle, sp, periodSizeInFrames));
- CHECK(snd_pcm_sw_params_set_stop_threshold(self->pcmHandle, sp, periodSizeInFrames*periods));
- CHECK(snd_pcm_sw_params(self->pcmHandle, sp));
+ CHECK(snd_pcm_sw_params_current(self->PcmHandle, sp));
+ CHECK(snd_pcm_sw_params_set_avail_min(self->PcmHandle, sp, periodSizeInFrames));
+ CHECK(snd_pcm_sw_params_set_stop_threshold(self->PcmHandle, sp, periodSizeInFrames*periods));
+ CHECK(snd_pcm_sw_params(self->PcmHandle, sp));
#undef CHECK
snd_pcm_sw_params_free(sp);
sp = nullptr;
@@ -849,7 +849,7 @@ ALCboolean ALCplaybackAlsa_start(ALCplaybackAlsa *self)
snd_pcm_hw_params_malloc(&hp);
#define CHECK(x) if((funcerr=#x),(err=(x)) < 0) goto error
- CHECK(snd_pcm_hw_params_current(self->pcmHandle, hp));
+ CHECK(snd_pcm_hw_params_current(self->PcmHandle, hp));
/* retrieve configuration info */
CHECK(snd_pcm_hw_params_get_access(hp, &access));
#undef CHECK
@@ -858,23 +858,23 @@ ALCboolean ALCplaybackAlsa_start(ALCplaybackAlsa *self)
if(access == SND_PCM_ACCESS_RW_INTERLEAVED)
{
- self->buffer.resize(snd_pcm_frames_to_bytes(self->pcmHandle, device->UpdateSize));
+ self->Buffer.resize(snd_pcm_frames_to_bytes(self->PcmHandle, device->UpdateSize));
thread_func = ALCplaybackAlsa_mixerNoMMapProc;
}
else
{
- err = snd_pcm_prepare(self->pcmHandle);
+ err = snd_pcm_prepare(self->PcmHandle);
if(err < 0)
{
- ERR("snd_pcm_prepare(data->pcmHandle) failed: %s\n", snd_strerror(err));
+ ERR("snd_pcm_prepare(data->PcmHandle) failed: %s\n", snd_strerror(err));
return ALC_FALSE;
}
thread_func = ALCplaybackAlsa_mixerProc;
}
try {
- self->killNow.store(AL_FALSE, std::memory_order_release);
- self->thread = std::thread(thread_func, self);
+ self->mKillNow.store(AL_FALSE, std::memory_order_release);
+ self->mThread = std::thread(thread_func, self);
return ALC_TRUE;
}
catch(std::exception& e) {
@@ -882,7 +882,7 @@ ALCboolean ALCplaybackAlsa_start(ALCplaybackAlsa *self)
}
catch(...) {
}
- self->buffer.clear();
+ self->Buffer.clear();
return ALC_FALSE;
error:
@@ -893,12 +893,12 @@ error:
void ALCplaybackAlsa_stop(ALCplaybackAlsa *self)
{
- if(self->killNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !self->thread.joinable())
+ if(self->mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !self->mThread.joinable())
return;
- self->thread.join();
+ self->mThread.join();
- self->buffer.clear();
+ self->Buffer.clear();
}
ClockLatency ALCplaybackAlsa_getClockLatency(ALCplaybackAlsa *self)
@@ -909,7 +909,7 @@ ClockLatency ALCplaybackAlsa_getClockLatency(ALCplaybackAlsa *self)
ALCplaybackAlsa_lock(self);
ret.ClockTime = GetDeviceClockTime(device);
snd_pcm_sframes_t delay{};
- int err{snd_pcm_delay(self->pcmHandle, &delay)};
+ int err{snd_pcm_delay(self->PcmHandle, &delay)};
if(err < 0)
{
ERR("Failed to get pcm delay: %s\n", snd_strerror(err));
@@ -924,14 +924,14 @@ ClockLatency ALCplaybackAlsa_getClockLatency(ALCplaybackAlsa *self)
struct ALCcaptureAlsa final : public ALCbackend {
- snd_pcm_t *pcmHandle{nullptr};
+ snd_pcm_t *PcmHandle{nullptr};
- al::vector<char> buffer;
+ al::vector<char> Buffer;
- bool doCapture{false};
- ll_ringbuffer_t *ring{nullptr};
+ bool DoCapture{false};
+ ll_ringbuffer_t *Ring{nullptr};
- snd_pcm_sframes_t last_avail{0};
+ snd_pcm_sframes_t mLastAvail{0};
};
void ALCcaptureAlsa_Construct(ALCcaptureAlsa *self, ALCdevice *device);
@@ -959,12 +959,12 @@ void ALCcaptureAlsa_Construct(ALCcaptureAlsa *self, ALCdevice *device)
void ALCcaptureAlsa_Destruct(ALCcaptureAlsa *self)
{
- if(self->pcmHandle)
- snd_pcm_close(self->pcmHandle);
- self->pcmHandle = nullptr;
+ if(self->PcmHandle)
+ snd_pcm_close(self->PcmHandle);
+ self->PcmHandle = nullptr;
- ll_ringbuffer_free(self->ring);
- self->ring = nullptr;
+ ll_ringbuffer_free(self->Ring);
+ self->Ring = nullptr;
ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
self->~ALCcaptureAlsa();
@@ -995,7 +995,7 @@ ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name)
}
TRACE("Opening device \"%s\"\n", driver);
- int err{snd_pcm_open(&self->pcmHandle, driver, SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK)};
+ int err{snd_pcm_open(&self->PcmHandle, driver, SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK)};
if(err < 0)
{
ERR("Could not open capture device '%s': %s\n", driver, snd_strerror(err));
@@ -1040,26 +1040,26 @@ ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name)
snd_pcm_hw_params_t *hp{};
snd_pcm_hw_params_malloc(&hp);
#define CHECK(x) if((funcerr=#x),(err=(x)) < 0) goto error
- CHECK(snd_pcm_hw_params_any(self->pcmHandle, hp));
+ CHECK(snd_pcm_hw_params_any(self->PcmHandle, hp));
/* set interleaved access */
- CHECK(snd_pcm_hw_params_set_access(self->pcmHandle, hp, SND_PCM_ACCESS_RW_INTERLEAVED));
+ CHECK(snd_pcm_hw_params_set_access(self->PcmHandle, hp, SND_PCM_ACCESS_RW_INTERLEAVED));
/* set format (implicitly sets sample bits) */
- CHECK(snd_pcm_hw_params_set_format(self->pcmHandle, hp, format));
+ CHECK(snd_pcm_hw_params_set_format(self->PcmHandle, hp, format));
/* set channels (implicitly sets frame bits) */
- CHECK(snd_pcm_hw_params_set_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans, device->mAmbiOrder)));
+ CHECK(snd_pcm_hw_params_set_channels(self->PcmHandle, hp, ChannelsFromDevFmt(device->FmtChans, device->mAmbiOrder)));
/* set rate (implicitly constrains period/buffer parameters) */
- CHECK(snd_pcm_hw_params_set_rate(self->pcmHandle, hp, device->Frequency, 0));
+ CHECK(snd_pcm_hw_params_set_rate(self->PcmHandle, hp, device->Frequency, 0));
/* set buffer size in frame units (implicitly sets period size/bytes/time and buffer time/bytes) */
- if(snd_pcm_hw_params_set_buffer_size_min(self->pcmHandle, hp, &bufferSizeInFrames) < 0)
+ if(snd_pcm_hw_params_set_buffer_size_min(self->PcmHandle, hp, &bufferSizeInFrames) < 0)
{
TRACE("Buffer too large, using intermediate ring buffer\n");
needring = true;
- CHECK(snd_pcm_hw_params_set_buffer_size_near(self->pcmHandle, hp, &bufferSizeInFrames));
+ CHECK(snd_pcm_hw_params_set_buffer_size_near(self->PcmHandle, hp, &bufferSizeInFrames));
}
/* set buffer size in frame units (implicitly sets period size/bytes/time and buffer time/bytes) */
- CHECK(snd_pcm_hw_params_set_period_size_near(self->pcmHandle, hp, &periodSizeInFrames, nullptr));
+ CHECK(snd_pcm_hw_params_set_period_size_near(self->PcmHandle, hp, &periodSizeInFrames, nullptr));
/* install and prepare hardware configuration */
- CHECK(snd_pcm_hw_params(self->pcmHandle, hp));
+ CHECK(snd_pcm_hw_params(self->PcmHandle, hp));
/* retrieve configuration info */
CHECK(snd_pcm_hw_params_get_period_size(hp, &periodSizeInFrames, nullptr));
#undef CHECK
@@ -1068,12 +1068,12 @@ ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name)
if(needring)
{
- self->ring = ll_ringbuffer_create(
+ self->Ring = ll_ringbuffer_create(
device->UpdateSize*device->NumUpdates,
FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder),
false
);
- if(!self->ring)
+ if(!self->Ring)
{
ERR("ring buffer create failed\n");
goto error2;
@@ -1089,22 +1089,22 @@ error:
if(hp) snd_pcm_hw_params_free(hp);
error2:
- ll_ringbuffer_free(self->ring);
- self->ring = nullptr;
- snd_pcm_close(self->pcmHandle);
- self->pcmHandle = nullptr;
+ ll_ringbuffer_free(self->Ring);
+ self->Ring = nullptr;
+ snd_pcm_close(self->PcmHandle);
+ self->PcmHandle = nullptr;
return ALC_INVALID_VALUE;
}
ALCboolean ALCcaptureAlsa_start(ALCcaptureAlsa *self)
{
- int err{snd_pcm_prepare(self->pcmHandle)};
+ int err{snd_pcm_prepare(self->PcmHandle)};
if(err < 0)
ERR("prepare failed: %s\n", snd_strerror(err));
else
{
- err = snd_pcm_start(self->pcmHandle);
+ err = snd_pcm_start(self->PcmHandle);
if(err < 0)
ERR("start failed: %s\n", snd_strerror(err));
}
@@ -1115,7 +1115,7 @@ ALCboolean ALCcaptureAlsa_start(ALCcaptureAlsa *self)
return ALC_FALSE;
}
- self->doCapture = true;
+ self->DoCapture = true;
return ALC_TRUE;
}
@@ -1125,60 +1125,60 @@ void ALCcaptureAlsa_stop(ALCcaptureAlsa *self)
* snd_pcm_drain is unreliable and snd_pcm_drop drops it. Capture what's
* available now so it'll be available later after the drop. */
ALCuint avail{ALCcaptureAlsa_availableSamples(self)};
- if(!self->ring && avail > 0)
+ if(!self->Ring && avail > 0)
{
/* The ring buffer implicitly captures when checking availability.
* Direct access needs to explicitly capture it into temp storage. */
- al::vector<char> temp(snd_pcm_frames_to_bytes(self->pcmHandle, avail));
+ al::vector<char> temp(snd_pcm_frames_to_bytes(self->PcmHandle, avail));
ALCcaptureAlsa_captureSamples(self, temp.data(), avail);
- self->buffer = std::move(temp);
+ self->Buffer = std::move(temp);
}
- int err{snd_pcm_drop(self->pcmHandle)};
+ int err{snd_pcm_drop(self->PcmHandle)};
if(err < 0)
ERR("drop failed: %s\n", snd_strerror(err));
- self->doCapture = false;
+ self->DoCapture = false;
}
ALCenum ALCcaptureAlsa_captureSamples(ALCcaptureAlsa *self, ALCvoid *buffer, ALCuint samples)
{
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
- if(self->ring)
+ if(self->Ring)
{
- ll_ringbuffer_read(self->ring, static_cast<char*>(buffer), samples);
+ ll_ringbuffer_read(self->Ring, static_cast<char*>(buffer), samples);
return ALC_NO_ERROR;
}
- self->last_avail -= samples;
+ self->mLastAvail -= samples;
while(ATOMIC_LOAD(&device->Connected, almemory_order_acquire) && samples > 0)
{
snd_pcm_sframes_t amt{0};
- if(!self->buffer.empty())
+ if(!self->Buffer.empty())
{
/* First get any data stored from the last stop */
- amt = snd_pcm_bytes_to_frames(self->pcmHandle, self->buffer.size());
+ amt = snd_pcm_bytes_to_frames(self->PcmHandle, self->Buffer.size());
if((snd_pcm_uframes_t)amt > samples) amt = samples;
- amt = snd_pcm_frames_to_bytes(self->pcmHandle, amt);
- memcpy(buffer, self->buffer.data(), amt);
+ amt = snd_pcm_frames_to_bytes(self->PcmHandle, amt);
+ memcpy(buffer, self->Buffer.data(), amt);
- self->buffer.erase(self->buffer.begin(), self->buffer.begin()+amt);
- amt = snd_pcm_bytes_to_frames(self->pcmHandle, amt);
+ self->Buffer.erase(self->Buffer.begin(), self->Buffer.begin()+amt);
+ amt = snd_pcm_bytes_to_frames(self->PcmHandle, amt);
}
- else if(self->doCapture)
- amt = snd_pcm_readi(self->pcmHandle, buffer, samples);
+ else if(self->DoCapture)
+ amt = snd_pcm_readi(self->PcmHandle, buffer, samples);
if(amt < 0)
{
ERR("read error: %s\n", snd_strerror(amt));
if(amt == -EAGAIN)
continue;
- if((amt=snd_pcm_recover(self->pcmHandle, amt, 1)) >= 0)
+ if((amt=snd_pcm_recover(self->PcmHandle, amt, 1)) >= 0)
{
- amt = snd_pcm_start(self->pcmHandle);
+ amt = snd_pcm_start(self->PcmHandle);
if(amt >= 0)
- amt = snd_pcm_avail_update(self->pcmHandle);
+ amt = snd_pcm_avail_update(self->PcmHandle);
}
if(amt < 0)
{
@@ -1198,7 +1198,7 @@ ALCenum ALCcaptureAlsa_captureSamples(ALCcaptureAlsa *self, ALCvoid *buffer, ALC
}
if(samples > 0)
memset(buffer, ((device->FmtType == DevFmtUByte) ? 0x80 : 0),
- snd_pcm_frames_to_bytes(self->pcmHandle, samples));
+ snd_pcm_frames_to_bytes(self->PcmHandle, samples));
return ALC_NO_ERROR;
}
@@ -1208,18 +1208,18 @@ ALCuint ALCcaptureAlsa_availableSamples(ALCcaptureAlsa *self)
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
snd_pcm_sframes_t avail{0};
- if(ATOMIC_LOAD(&device->Connected, almemory_order_acquire) && self->doCapture)
- avail = snd_pcm_avail_update(self->pcmHandle);
+ if(ATOMIC_LOAD(&device->Connected, almemory_order_acquire) && self->DoCapture)
+ avail = snd_pcm_avail_update(self->PcmHandle);
if(avail < 0)
{
ERR("avail update failed: %s\n", snd_strerror(avail));
- if((avail=snd_pcm_recover(self->pcmHandle, avail, 1)) >= 0)
+ if((avail=snd_pcm_recover(self->PcmHandle, avail, 1)) >= 0)
{
- if(self->doCapture)
- avail = snd_pcm_start(self->pcmHandle);
+ if(self->DoCapture)
+ avail = snd_pcm_start(self->PcmHandle);
if(avail >= 0)
- avail = snd_pcm_avail_update(self->pcmHandle);
+ avail = snd_pcm_avail_update(self->PcmHandle);
}
if(avail < 0)
{
@@ -1228,33 +1228,33 @@ ALCuint ALCcaptureAlsa_availableSamples(ALCcaptureAlsa *self)
}
}
- if(!self->ring)
+ if(!self->Ring)
{
if(avail < 0) avail = 0;
- avail += snd_pcm_bytes_to_frames(self->pcmHandle, self->buffer.size());
- if(avail > self->last_avail) self->last_avail = avail;
- return self->last_avail;
+ avail += snd_pcm_bytes_to_frames(self->PcmHandle, self->Buffer.size());
+ if(avail > self->mLastAvail) self->mLastAvail = avail;
+ return self->mLastAvail;
}
while(avail > 0)
{
- auto vec = ll_ringbuffer_get_write_vector(self->ring);
+ auto vec = ll_ringbuffer_get_write_vector(self->Ring);
if(vec.first.len == 0) break;
snd_pcm_sframes_t amt{std::min<snd_pcm_sframes_t>(vec.first.len, avail)};
- amt = snd_pcm_readi(self->pcmHandle, vec.first.buf, amt);
+ amt = snd_pcm_readi(self->PcmHandle, vec.first.buf, amt);
if(amt < 0)
{
ERR("read error: %s\n", snd_strerror(amt));
if(amt == -EAGAIN)
continue;
- if((amt=snd_pcm_recover(self->pcmHandle, amt, 1)) >= 0)
+ if((amt=snd_pcm_recover(self->PcmHandle, amt, 1)) >= 0)
{
- if(self->doCapture)
- amt = snd_pcm_start(self->pcmHandle);
+ if(self->DoCapture)
+ amt = snd_pcm_start(self->PcmHandle);
if(amt >= 0)
- amt = snd_pcm_avail_update(self->pcmHandle);
+ amt = snd_pcm_avail_update(self->PcmHandle);
}
if(amt < 0)
{
@@ -1266,11 +1266,11 @@ ALCuint ALCcaptureAlsa_availableSamples(ALCcaptureAlsa *self)
continue;
}
- ll_ringbuffer_write_advance(self->ring, amt);
+ ll_ringbuffer_write_advance(self->Ring, amt);
avail -= amt;
}
- return ll_ringbuffer_read_space(self->ring);
+ return ll_ringbuffer_read_space(self->Ring);
}
ClockLatency ALCcaptureAlsa_getClockLatency(ALCcaptureAlsa *self)
@@ -1281,7 +1281,7 @@ ClockLatency ALCcaptureAlsa_getClockLatency(ALCcaptureAlsa *self)
ALCcaptureAlsa_lock(self);
ret.ClockTime = GetDeviceClockTime(device);
snd_pcm_sframes_t delay{};
- int err{snd_pcm_delay(self->pcmHandle, &delay)};
+ int err{snd_pcm_delay(self->PcmHandle, &delay)};
if(err < 0)
{
ERR("Failed to get pcm delay: %s\n", snd_strerror(err));
diff --git a/Alc/backends/coreaudio.cpp b/Alc/backends/coreaudio.cpp
index ff02a706..f5574965 100644
--- a/Alc/backends/coreaudio.cpp
+++ b/Alc/backends/coreaudio.cpp
@@ -39,10 +39,10 @@ static const ALCchar ca_device[] = "CoreAudio Default";
struct ALCcoreAudioPlayback final : public ALCbackend {
- AudioUnit audioUnit;
+ AudioUnit AudioUnit;
- ALuint frameSize;
- AudioStreamBasicDescription format; // This is the OpenAL format as a CoreAudio ASBD
+ ALuint FrameSize;
+ AudioStreamBasicDescription Format; // This is the OpenAL format as a CoreAudio ASBD
};
static void ALCcoreAudioPlayback_Construct(ALCcoreAudioPlayback *self, ALCdevice *device);
@@ -67,14 +67,14 @@ static void ALCcoreAudioPlayback_Construct(ALCcoreAudioPlayback *self, ALCdevice
ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device);
SET_VTABLE2(ALCcoreAudioPlayback, ALCbackend, self);
- self->frameSize = 0;
- memset(&self->format, 0, sizeof(self->format));
+ self->FrameSize = 0;
+ memset(&self->Format, 0, sizeof(self->Format));
}
static void ALCcoreAudioPlayback_Destruct(ALCcoreAudioPlayback *self)
{
- AudioUnitUninitialize(self->audioUnit);
- AudioComponentInstanceDispose(self->audioUnit);
+ AudioUnitUninitialize(self->AudioUnit);
+ AudioComponentInstanceDispose(self->AudioUnit);
ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
self->~ALCcoreAudioPlayback();
@@ -90,7 +90,7 @@ static OSStatus ALCcoreAudioPlayback_MixerProc(void *inRefCon,
ALCcoreAudioPlayback_lock(self);
aluMixData(device, ioData->mBuffers[0].mData,
- ioData->mBuffers[0].mDataByteSize / self->frameSize);
+ ioData->mBuffers[0].mDataByteSize / self->FrameSize);
ALCcoreAudioPlayback_unlock(self);
return noErr;
@@ -127,7 +127,7 @@ static ALCenum ALCcoreAudioPlayback_open(ALCcoreAudioPlayback *self, const ALCch
return ALC_INVALID_VALUE;
}
- err = AudioComponentInstanceNew(comp, &self->audioUnit);
+ err = AudioComponentInstanceNew(comp, &self->AudioUnit);
if(err != noErr)
{
ERR("AudioComponentInstanceNew failed\n");
@@ -135,11 +135,11 @@ static ALCenum ALCcoreAudioPlayback_open(ALCcoreAudioPlayback *self, const ALCch
}
/* init and start the default audio unit... */
- err = AudioUnitInitialize(self->audioUnit);
+ err = AudioUnitInitialize(self->AudioUnit);
if(err != noErr)
{
ERR("AudioUnitInitialize failed\n");
- AudioComponentInstanceDispose(self->audioUnit);
+ AudioComponentInstanceDispose(self->AudioUnit);
return ALC_INVALID_VALUE;
}
@@ -155,13 +155,13 @@ static ALCboolean ALCcoreAudioPlayback_reset(ALCcoreAudioPlayback *self)
OSStatus err;
UInt32 size;
- err = AudioUnitUninitialize(self->audioUnit);
+ err = AudioUnitUninitialize(self->AudioUnit);
if(err != noErr)
ERR("-- AudioUnitUninitialize failed.\n");
/* retrieve default output unit's properties (output side) */
size = sizeof(AudioStreamBasicDescription);
- err = AudioUnitGetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &streamFormat, &size);
+ err = AudioUnitGetProperty(self->AudioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &streamFormat, &size);
if(err != noErr || size != sizeof(AudioStreamBasicDescription))
{
ERR("AudioUnitGetProperty failed\n");
@@ -179,7 +179,7 @@ static ALCboolean ALCcoreAudioPlayback_reset(ALCcoreAudioPlayback *self)
#endif
/* set default output unit's input side to match output side */
- err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, size);
+ err = AudioUnitSetProperty(self->AudioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, size);
if(err != noErr)
{
ERR("AudioUnitSetProperty failed\n");
@@ -263,7 +263,7 @@ static ALCboolean ALCcoreAudioPlayback_reset(ALCcoreAudioPlayback *self)
streamFormat.mFormatFlags |= kAudioFormatFlagsNativeEndian |
kLinearPCMFormatFlagIsPacked;
- err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, sizeof(AudioStreamBasicDescription));
+ err = AudioUnitSetProperty(self->AudioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, sizeof(AudioStreamBasicDescription));
if(err != noErr)
{
ERR("AudioUnitSetProperty failed\n");
@@ -271,11 +271,11 @@ static ALCboolean ALCcoreAudioPlayback_reset(ALCcoreAudioPlayback *self)
}
/* setup callback */
- self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder);
+ self->FrameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder);
input.inputProc = ALCcoreAudioPlayback_MixerProc;
input.inputProcRefCon = self;
- err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &input, sizeof(AURenderCallbackStruct));
+ err = AudioUnitSetProperty(self->AudioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &input, sizeof(AURenderCallbackStruct));
if(err != noErr)
{
ERR("AudioUnitSetProperty failed\n");
@@ -283,7 +283,7 @@ static ALCboolean ALCcoreAudioPlayback_reset(ALCcoreAudioPlayback *self)
}
/* init the default audio unit... */
- err = AudioUnitInitialize(self->audioUnit);
+ err = AudioUnitInitialize(self->AudioUnit);
if(err != noErr)
{
ERR("AudioUnitInitialize failed\n");
@@ -295,7 +295,7 @@ static ALCboolean ALCcoreAudioPlayback_reset(ALCcoreAudioPlayback *self)
static ALCboolean ALCcoreAudioPlayback_start(ALCcoreAudioPlayback *self)
{
- OSStatus err = AudioOutputUnitStart(self->audioUnit);
+ OSStatus err = AudioOutputUnitStart(self->AudioUnit);
if(err != noErr)
{
ERR("AudioOutputUnitStart failed\n");
@@ -307,24 +307,24 @@ static ALCboolean ALCcoreAudioPlayback_start(ALCcoreAudioPlayback *self)
static void ALCcoreAudioPlayback_stop(ALCcoreAudioPlayback *self)
{
- OSStatus err = AudioOutputUnitStop(self->audioUnit);
+ OSStatus err = AudioOutputUnitStop(self->AudioUnit);
if(err != noErr)
ERR("AudioOutputUnitStop failed\n");
}
struct ALCcoreAudioCapture final : public ALCbackend {
- AudioUnit audioUnit;
+ AudioUnit AudioUnit;
- ALuint frameSize;
- ALdouble sampleRateRatio; // Ratio of hardware sample rate / requested sample rate
- AudioStreamBasicDescription format; // This is the OpenAL format as a CoreAudio ASBD
+ ALuint FrameSize;
+ ALdouble SampleRateRatio; // Ratio of hardware sample rate / requested sample rate
+ AudioStreamBasicDescription Format; // This is the OpenAL format as a CoreAudio ASBD
- AudioConverterRef audioConverter; // Sample rate converter if needed
- AudioBufferList *bufferList; // Buffer for data coming from the input device
- ALCvoid *resampleBuffer; // Buffer for returned RingBuffer data when resampling
+ AudioConverterRef AudioConverter; // Sample rate converter if needed
+ AudioBufferList *BufferList; // Buffer for data coming from the input device
+ ALCvoid *ResampleBuffer; // Buffer for returned RingBuffer data when resampling
- ll_ringbuffer_t *ring;
+ ll_ringbuffer_t *Ring;
};
static void ALCcoreAudioCapture_Construct(ALCcoreAudioCapture *self, ALCdevice *device);
@@ -372,31 +372,31 @@ static void ALCcoreAudioCapture_Construct(ALCcoreAudioCapture *self, ALCdevice *
ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device);
SET_VTABLE2(ALCcoreAudioCapture, ALCbackend, self);
- self->audioUnit = 0;
- self->audioConverter = NULL;
- self->bufferList = NULL;
- self->resampleBuffer = NULL;
- self->ring = NULL;
+ self->AudioUnit = 0;
+ self->AudioConverter = NULL;
+ self->BufferList = NULL;
+ self->ResampleBuffer = NULL;
+ self->Ring = NULL;
}
static void ALCcoreAudioCapture_Destruct(ALCcoreAudioCapture *self)
{
- ll_ringbuffer_free(self->ring);
- self->ring = NULL;
+ ll_ringbuffer_free(self->Ring);
+ self->Ring = NULL;
- free(self->resampleBuffer);
- self->resampleBuffer = NULL;
+ free(self->ResampleBuffer);
+ self->ResampleBuffer = NULL;
- destroy_buffer_list(self->bufferList);
- self->bufferList = NULL;
+ destroy_buffer_list(self->BufferList);
+ self->BufferList = NULL;
- if(self->audioConverter)
- AudioConverterDispose(self->audioConverter);
- self->audioConverter = NULL;
+ if(self->AudioConverter)
+ AudioConverterDispose(self->AudioConverter);
+ self->AudioConverter = NULL;
- if(self->audioUnit)
- AudioComponentInstanceDispose(self->audioUnit);
- self->audioUnit = 0;
+ if(self->AudioUnit)
+ AudioComponentInstanceDispose(self->AudioUnit);
+ self->AudioUnit = 0;
ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
self->~ALCcoreAudioCapture();
@@ -412,15 +412,15 @@ static OSStatus ALCcoreAudioCapture_RecordProc(void *inRefCon,
AudioUnitRenderActionFlags flags = 0;
OSStatus err;
- // fill the bufferList with data from the input device
- err = AudioUnitRender(self->audioUnit, &flags, inTimeStamp, 1, inNumberFrames, self->bufferList);
+ // fill the BufferList with data from the input device
+ err = AudioUnitRender(self->AudioUnit, &flags, inTimeStamp, 1, inNumberFrames, self->BufferList);
if(err != noErr)
{
ERR("AudioUnitRender error: %d\n", err);
return err;
}
- ll_ringbuffer_write(self->ring, self->bufferList->mBuffers[0].mData, inNumberFrames);
+ ll_ringbuffer_write(self->Ring, self->BufferList->mBuffers[0].mData, inNumberFrames);
return noErr;
}
@@ -432,13 +432,13 @@ static OSStatus ALCcoreAudioCapture_ConvertCallback(AudioConverterRef UNUSED(inA
ALCcoreAudioCapture *self = reinterpret_cast<ALCcoreAudioCapture*>(inUserData);
// Read from the ring buffer and store temporarily in a large buffer
- ll_ringbuffer_read(self->ring, self->resampleBuffer, *ioNumberDataPackets);
+ ll_ringbuffer_read(self->Ring, self->ResampleBuffer, *ioNumberDataPackets);
// Set the input data
ioData->mNumberBuffers = 1;
- ioData->mBuffers[0].mNumberChannels = self->format.mChannelsPerFrame;
- ioData->mBuffers[0].mData = self->resampleBuffer;
- ioData->mBuffers[0].mDataByteSize = (*ioNumberDataPackets) * self->format.mBytesPerFrame;
+ ioData->mBuffers[0].mNumberChannels = self->Format.mChannelsPerFrame;
+ ioData->mBuffers[0].mData = self->ResampleBuffer;
+ ioData->mBuffers[0].mDataByteSize = (*ioNumberDataPackets) * self->Format.mBytesPerFrame;
return noErr;
}
@@ -483,7 +483,7 @@ static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar
}
// Open the component
- err = AudioComponentInstanceNew(comp, &self->audioUnit);
+ err = AudioComponentInstanceNew(comp, &self->AudioUnit);
if(err != noErr)
{
ERR("AudioComponentInstanceNew failed\n");
@@ -492,7 +492,7 @@ static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar
// Turn off AudioUnit output
enableIO = 0;
- err = AudioUnitSetProperty(self->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, 0, &enableIO, sizeof(ALuint));
+ err = AudioUnitSetProperty(self->AudioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, 0, &enableIO, sizeof(ALuint));
if(err != noErr)
{
ERR("AudioUnitSetProperty failed\n");
@@ -501,7 +501,7 @@ static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar
// Turn on AudioUnit input
enableIO = 1;
- err = AudioUnitSetProperty(self->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &enableIO, sizeof(ALuint));
+ err = AudioUnitSetProperty(self->AudioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &enableIO, sizeof(ALuint));
if(err != noErr)
{
ERR("AudioUnitSetProperty failed\n");
@@ -531,7 +531,7 @@ static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar
}
// Track the input device
- err = AudioUnitSetProperty(self->audioUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &inputDevice, sizeof(AudioDeviceID));
+ err = AudioUnitSetProperty(self->AudioUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &inputDevice, sizeof(AudioDeviceID));
if(err != noErr)
{
ERR("AudioUnitSetProperty failed\n");
@@ -544,7 +544,7 @@ static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar
input.inputProc = ALCcoreAudioCapture_RecordProc;
input.inputProcRefCon = self;
- err = AudioUnitSetProperty(self->audioUnit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &input, sizeof(AURenderCallbackStruct));
+ err = AudioUnitSetProperty(self->AudioUnit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &input, sizeof(AURenderCallbackStruct));
if(err != noErr)
{
ERR("AudioUnitSetProperty failed\n");
@@ -552,7 +552,7 @@ static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar
}
// Initialize the device
- err = AudioUnitInitialize(self->audioUnit);
+ err = AudioUnitInitialize(self->AudioUnit);
if(err != noErr)
{
ERR("AudioUnitInitialize failed\n");
@@ -561,7 +561,7 @@ static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar
// Get the hardware format
propertySize = sizeof(AudioStreamBasicDescription);
- err = AudioUnitGetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 1, &hardwareFormat, &propertySize);
+ err = AudioUnitGetProperty(self->AudioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 1, &hardwareFormat, &propertySize);
if(err != noErr || propertySize != sizeof(AudioStreamBasicDescription))
{
ERR("AudioUnitGetProperty failed\n");
@@ -621,8 +621,8 @@ static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar
requestedFormat.mFramesPerPacket = 1;
// save requested format description for later use
- self->format = requestedFormat;
- self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder);
+ self->Format = requestedFormat;
+ self->FrameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder);
// Use intermediate format for sample rate conversion (outputFormat)
// Set sample rate to the same as hardware for resampling later
@@ -630,11 +630,11 @@ static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar
outputFormat.mSampleRate = hardwareFormat.mSampleRate;
// Determine sample rate ratio for resampling
- self->sampleRateRatio = outputFormat.mSampleRate / device->Frequency;
+ self->SampleRateRatio = outputFormat.mSampleRate / device->Frequency;
// The output format should be the requested format, but using the hardware sample rate
// This is because the AudioUnit will automatically scale other properties, except for sample rate
- err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, (void *)&outputFormat, sizeof(outputFormat));
+ err = AudioUnitSetProperty(self->AudioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, (void *)&outputFormat, sizeof(outputFormat));
if(err != noErr)
{
ERR("AudioUnitSetProperty failed\n");
@@ -642,8 +642,8 @@ static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar
}
// Set the AudioUnit output format frame count
- outputFrameCount = device->UpdateSize * self->sampleRateRatio;
- err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Output, 0, &outputFrameCount, sizeof(outputFrameCount));
+ outputFrameCount = device->UpdateSize * self->SampleRateRatio;
+ err = AudioUnitSetProperty(self->AudioUnit, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Output, 0, &outputFrameCount, sizeof(outputFrameCount));
if(err != noErr)
{
ERR("AudioUnitSetProperty failed: %d\n", err);
@@ -651,7 +651,7 @@ static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar
}
// Set up sample converter
- err = AudioConverterNew(&outputFormat, &requestedFormat, &self->audioConverter);
+ err = AudioConverterNew(&outputFormat, &requestedFormat, &self->AudioConverter);
if(err != noErr)
{
ERR("AudioConverterNew failed: %d\n", err);
@@ -659,36 +659,36 @@ static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar
}
// Create a buffer for use in the resample callback
- self->resampleBuffer = malloc(device->UpdateSize * self->frameSize * self->sampleRateRatio);
+ self->ResampleBuffer = malloc(device->UpdateSize * self->FrameSize * self->SampleRateRatio);
// Allocate buffer for the AudioUnit output
- self->bufferList = allocate_buffer_list(outputFormat.mChannelsPerFrame, device->UpdateSize * self->frameSize * self->sampleRateRatio);
- if(self->bufferList == NULL)
+ self->BufferList = allocate_buffer_list(outputFormat.mChannelsPerFrame, device->UpdateSize * self->FrameSize * self->SampleRateRatio);
+ if(self->BufferList == NULL)
goto error;
- self->ring = ll_ringbuffer_create(
- (size_t)ceil(device->UpdateSize*self->sampleRateRatio*device->NumUpdates),
- self->frameSize, false
+ self->Ring = ll_ringbuffer_create(
+ (size_t)ceil(device->UpdateSize*self->SampleRateRatio*device->NumUpdates),
+ self->FrameSize, false
);
- if(!self->ring) goto error;
+ if(!self->Ring) goto error;
device->DeviceName = name;
return ALC_NO_ERROR;
error:
- ll_ringbuffer_free(self->ring);
- self->ring = NULL;
- free(self->resampleBuffer);
- self->resampleBuffer = NULL;
- destroy_buffer_list(self->bufferList);
- self->bufferList = NULL;
-
- if(self->audioConverter)
- AudioConverterDispose(self->audioConverter);
- self->audioConverter = NULL;
- if(self->audioUnit)
- AudioComponentInstanceDispose(self->audioUnit);
- self->audioUnit = 0;
+ ll_ringbuffer_free(self->Ring);
+ self->Ring = NULL;
+ free(self->ResampleBuffer);
+ self->ResampleBuffer = NULL;
+ destroy_buffer_list(self->BufferList);
+ self->BufferList = NULL;
+
+ if(self->AudioConverter)
+ AudioConverterDispose(self->AudioConverter);
+ self->AudioConverter = NULL;
+ if(self->AudioUnit)
+ AudioComponentInstanceDispose(self->AudioUnit);
+ self->AudioUnit = 0;
return ALC_INVALID_VALUE;
}
@@ -696,7 +696,7 @@ error:
static ALCboolean ALCcoreAudioCapture_start(ALCcoreAudioCapture *self)
{
- OSStatus err = AudioOutputUnitStart(self->audioUnit);
+ OSStatus err = AudioOutputUnitStart(self->AudioUnit);
if(err != noErr)
{
ERR("AudioOutputUnitStart failed\n");
@@ -707,7 +707,7 @@ static ALCboolean ALCcoreAudioCapture_start(ALCcoreAudioCapture *self)
static void ALCcoreAudioCapture_stop(ALCcoreAudioCapture *self)
{
- OSStatus err = AudioOutputUnitStop(self->audioUnit);
+ OSStatus err = AudioOutputUnitStop(self->AudioUnit);
if(err != noErr)
ERR("AudioOutputUnitStop failed\n");
}
@@ -726,13 +726,13 @@ static ALCenum ALCcoreAudioCapture_captureSamples(ALCcoreAudioCapture *self, ALC
// Point the resampling buffer to the capture buffer
audiobuf.list.mNumberBuffers = 1;
- audiobuf.list.mBuffers[0].mNumberChannels = self->format.mChannelsPerFrame;
- audiobuf.list.mBuffers[0].mDataByteSize = samples * self->frameSize;
+ audiobuf.list.mBuffers[0].mNumberChannels = self->Format.mChannelsPerFrame;
+ audiobuf.list.mBuffers[0].mDataByteSize = samples * self->FrameSize;
audiobuf.list.mBuffers[0].mData = buffer;
// Resample into another AudioBufferList
frameCount = samples;
- err = AudioConverterFillComplexBuffer(self->audioConverter,
+ err = AudioConverterFillComplexBuffer(self->AudioConverter,
ALCcoreAudioCapture_ConvertCallback, self, &frameCount, &audiobuf.list, NULL
);
if(err != noErr)
@@ -745,7 +745,7 @@ static ALCenum ALCcoreAudioCapture_captureSamples(ALCcoreAudioCapture *self, ALC
static ALCuint ALCcoreAudioCapture_availableSamples(ALCcoreAudioCapture *self)
{
- return ll_ringbuffer_read_space(self->ring) / self->sampleRateRatio;
+ return ll_ringbuffer_read_space(self->Ring) / self->SampleRateRatio;
}
diff --git a/Alc/backends/dsound.cpp b/Alc/backends/dsound.cpp
index 4f1186ee..3bce5cad 100644
--- a/Alc/backends/dsound.cpp
+++ b/Alc/backends/dsound.cpp
@@ -191,8 +191,8 @@ struct ALCdsoundPlayback final : public ALCbackend {
IDirectSoundNotify *Notifies{nullptr};
HANDLE NotifyEvent{nullptr};
- std::atomic<ALenum> killNow{AL_TRUE};
- std::thread thread;
+ std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::thread mThread;
};
int ALCdsoundPlayback_mixerProc(ALCdsoundPlayback *self);
@@ -271,7 +271,7 @@ FORCE_ALIGN int ALCdsoundPlayback_mixerProc(ALCdsoundPlayback *self)
bool Playing{false};
DWORD LastCursor{0u};
Buffer->GetCurrentPosition(&LastCursor, nullptr);
- while(!self->killNow.load(std::memory_order_acquire) &&
+ while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
{
// Get current play cursor
@@ -626,8 +626,8 @@ retry_open:
ALCboolean ALCdsoundPlayback_start(ALCdsoundPlayback *self)
{
try {
- self->killNow.store(AL_FALSE, std::memory_order_release);
- self->thread = std::thread(ALCdsoundPlayback_mixerProc, self);
+ self->mKillNow.store(AL_FALSE, std::memory_order_release);
+ self->mThread = std::thread(ALCdsoundPlayback_mixerProc, self);
return ALC_TRUE;
}
catch(std::exception& e) {
@@ -640,10 +640,10 @@ ALCboolean ALCdsoundPlayback_start(ALCdsoundPlayback *self)
void ALCdsoundPlayback_stop(ALCdsoundPlayback *self)
{
- if(self->killNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !self->thread.joinable())
+ if(self->mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !self->mThread.joinable())
return;
- self->thread.join();
+ self->mThread.join();
self->Buffer->Stop();
}
diff --git a/Alc/backends/jack.cpp b/Alc/backends/jack.cpp
index 72a27c44..daa15219 100644
--- a/Alc/backends/jack.cpp
+++ b/Alc/backends/jack.cpp
@@ -151,7 +151,7 @@ struct ALCjackPlayback final : public ALCbackend {
ll_ringbuffer_t *Ring{nullptr};
alsem_t Sem;
- std::atomic<ALenum> killNow{AL_TRUE};
+ std::atomic<ALenum> mKillNow{AL_TRUE};
althrd_t thread;
};
@@ -300,7 +300,7 @@ static int ALCjackPlayback_mixerProc(void *arg)
althrd_setname(MIXER_THREAD_NAME);
ALCjackPlayback_lock(self);
- while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) &&
+ while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
{
ALuint todo, len1, len2;
@@ -465,7 +465,7 @@ static ALCboolean ALCjackPlayback_start(ALCjackPlayback *self)
}
jack_free(ports);
- ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release);
+ self->mKillNow.store(AL_FALSE, std::memory_order_release);
if(althrd_create(&self->thread, ALCjackPlayback_mixerProc, self) != althrd_success)
{
jack_deactivate(self->Client);
@@ -479,7 +479,7 @@ static void ALCjackPlayback_stop(ALCjackPlayback *self)
{
int res;
- if(self->killNow.exchange(AL_TRUE, std::memory_order_acq_rel))
+ if(self->mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel))
return;
alsem_post(&self->Sem);
diff --git a/Alc/backends/null.cpp b/Alc/backends/null.cpp
index 440da5e8..631c23d3 100644
--- a/Alc/backends/null.cpp
+++ b/Alc/backends/null.cpp
@@ -45,8 +45,8 @@ constexpr ALCchar nullDevice[] = "No Output";
struct ALCnullBackend final : public ALCbackend {
- std::atomic<ALenum> killNow{AL_TRUE};
- std::thread thread;
+ std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::thread mThread;
};
int ALCnullBackend_mixerProc(ALCnullBackend *self);
@@ -91,7 +91,7 @@ int ALCnullBackend_mixerProc(ALCnullBackend *self)
ALint64 done{0};
auto start = std::chrono::steady_clock::now();
- while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) &&
+ while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
{
auto now = std::chrono::steady_clock::now();
@@ -152,8 +152,8 @@ ALCboolean ALCnullBackend_reset(ALCnullBackend *self)
ALCboolean ALCnullBackend_start(ALCnullBackend *self)
{
try {
- ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release);
- self->thread = std::thread(ALCnullBackend_mixerProc, self);
+ self->mKillNow.store(AL_FALSE, std::memory_order_release);
+ self->mThread = std::thread(ALCnullBackend_mixerProc, self);
return ALC_TRUE;
}
catch(std::exception& e) {
@@ -166,9 +166,9 @@ ALCboolean ALCnullBackend_start(ALCnullBackend *self)
void ALCnullBackend_stop(ALCnullBackend *self)
{
- if(self->killNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !self->thread.joinable())
+ if(self->mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !self->mThread.joinable())
return;
- self->thread.join();
+ self->mThread.join();
}
} // namespace
diff --git a/Alc/backends/oss.cpp b/Alc/backends/oss.cpp
index 7b8d234a..58a4dbad 100644
--- a/Alc/backends/oss.cpp
+++ b/Alc/backends/oss.cpp
@@ -243,10 +243,10 @@ int log2i(ALCuint x)
struct ALCplaybackOSS final : public ALCbackend {
int fd{-1};
- al::vector<ALubyte> mix_data;
+ al::vector<ALubyte> mMixData;
- std::atomic<ALenum> killNow{AL_TRUE};
- std::thread thread;
+ std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::thread mThread;
};
int ALCplaybackOSS_mixerProc(ALCplaybackOSS *self);
@@ -301,7 +301,7 @@ int ALCplaybackOSS_mixerProc(ALCplaybackOSS *self)
frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder);
ALCplaybackOSS_lock(self);
- while(!self->killNow.load(std::memory_order_acquire) &&
+ while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
{
FD_ZERO(&wfds);
@@ -326,10 +326,10 @@ int ALCplaybackOSS_mixerProc(ALCplaybackOSS *self)
continue;
}
- write_ptr = self->mix_data.data();
- to_write = self->mix_data.size();
+ write_ptr = self->mMixData.data();
+ to_write = self->mMixData.size();
aluMixData(device, write_ptr, to_write/frame_size);
- while(to_write > 0 && !self->killNow.load())
+ while(to_write > 0 && !self->mKillNow.load())
{
wrote = write(self->fd, write_ptr, to_write);
if(wrote < 0)
@@ -471,12 +471,12 @@ ALCboolean ALCplaybackOSS_start(ALCplaybackOSS *self)
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
try {
- self->mix_data.resize(device->UpdateSize * FrameSizeFromDevFmt(
+ self->mMixData.resize(device->UpdateSize * FrameSizeFromDevFmt(
device->FmtChans, device->FmtType, device->mAmbiOrder
));
- self->killNow.store(AL_FALSE);
- self->thread = std::thread(ALCplaybackOSS_mixerProc, self);
+ self->mKillNow.store(AL_FALSE);
+ self->mThread = std::thread(ALCplaybackOSS_mixerProc, self);
return ALC_TRUE;
}
catch(std::exception& e) {
@@ -489,24 +489,24 @@ ALCboolean ALCplaybackOSS_start(ALCplaybackOSS *self)
void ALCplaybackOSS_stop(ALCplaybackOSS *self)
{
- if(self->killNow.exchange(AL_TRUE) || !self->thread.joinable())
+ if(self->mKillNow.exchange(AL_TRUE) || !self->mThread.joinable())
return;
- self->thread.join();
+ self->mThread.join();
if(ioctl(self->fd, SNDCTL_DSP_RESET) != 0)
ERR("Error resetting device: %s\n", strerror(errno));
- self->mix_data.clear();
+ self->mMixData.clear();
}
struct ALCcaptureOSS final : public ALCbackend {
int fd{-1};
- ll_ringbuffer_t *ring{nullptr};
+ ll_ringbuffer_t *mRing{nullptr};
- std::atomic<ALenum> killNow{AL_TRUE};
- std::thread thread;
+ std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::thread mThread;
};
int ALCcaptureOSS_recordProc(ALCcaptureOSS *self);
@@ -539,8 +539,8 @@ void ALCcaptureOSS_Destruct(ALCcaptureOSS *self)
close(self->fd);
self->fd = -1;
- ll_ringbuffer_free(self->ring);
- self->ring = nullptr;
+ ll_ringbuffer_free(self->mRing);
+ self->mRing = nullptr;
ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
self->~ALCcaptureOSS();
}
@@ -560,7 +560,7 @@ int ALCcaptureOSS_recordProc(ALCcaptureOSS *self)
frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder);
- while(!self->killNow.load())
+ while(!self->mKillNow.load())
{
FD_ZERO(&rfds);
FD_SET(self->fd, &rfds);
@@ -582,7 +582,7 @@ int ALCcaptureOSS_recordProc(ALCcaptureOSS *self)
continue;
}
- auto vec = ll_ringbuffer_get_write_vector(self->ring);
+ auto vec = ll_ringbuffer_get_write_vector(self->mRing);
if(vec.first.len > 0)
{
amt = read(self->fd, vec.first.buf, vec.first.len*frame_size);
@@ -594,7 +594,7 @@ int ALCcaptureOSS_recordProc(ALCcaptureOSS *self)
ALCcaptureOSS_unlock(self);
break;
}
- ll_ringbuffer_write_advance(self->ring, amt/frame_size);
+ ll_ringbuffer_write_advance(self->mRing, amt/frame_size);
}
}
@@ -700,8 +700,8 @@ ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name)
return ALC_INVALID_VALUE;
}
- self->ring = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates, frameSize, false);
- if(!self->ring)
+ self->mRing = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates, frameSize, false);
+ if(!self->mRing)
{
ERR("Ring buffer create failed\n");
close(self->fd);
@@ -716,8 +716,8 @@ ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name)
ALCboolean ALCcaptureOSS_start(ALCcaptureOSS *self)
{
try {
- self->killNow.store(AL_FALSE);
- self->thread = std::thread(ALCcaptureOSS_recordProc, self);
+ self->mKillNow.store(AL_FALSE);
+ self->mThread = std::thread(ALCcaptureOSS_recordProc, self);
return ALC_TRUE;
}
catch(std::exception& e) {
@@ -730,10 +730,10 @@ ALCboolean ALCcaptureOSS_start(ALCcaptureOSS *self)
void ALCcaptureOSS_stop(ALCcaptureOSS *self)
{
- if(self->killNow.exchange(AL_TRUE) || !self->thread.joinable())
+ if(self->mKillNow.exchange(AL_TRUE) || !self->mThread.joinable())
return;
- self->thread.join();
+ self->mThread.join();
if(ioctl(self->fd, SNDCTL_DSP_RESET) != 0)
ERR("Error resetting device: %s\n", strerror(errno));
@@ -741,13 +741,13 @@ void ALCcaptureOSS_stop(ALCcaptureOSS *self)
ALCenum ALCcaptureOSS_captureSamples(ALCcaptureOSS *self, ALCvoid *buffer, ALCuint samples)
{
- ll_ringbuffer_read(self->ring, static_cast<char*>(buffer), samples);
+ ll_ringbuffer_read(self->mRing, static_cast<char*>(buffer), samples);
return ALC_NO_ERROR;
}
ALCuint ALCcaptureOSS_availableSamples(ALCcaptureOSS *self)
{
- return ll_ringbuffer_read_space(self->ring);
+ return ll_ringbuffer_read_space(self->mRing);
}
} // namespace
diff --git a/Alc/backends/portaudio.cpp b/Alc/backends/portaudio.cpp
index 1c87f2c8..8b8c7fef 100644
--- a/Alc/backends/portaudio.cpp
+++ b/Alc/backends/portaudio.cpp
@@ -131,9 +131,9 @@ bool pa_load(void)
struct ALCportPlayback final : public ALCbackend {
- PaStream *stream;
- PaStreamParameters params;
- ALuint update_size;
+ PaStream *Stream{nullptr};
+ PaStreamParameters Params;
+ ALuint UpdateSize{0u};
};
int ALCportPlayback_WriteCallback(const void *inputBuffer, void *outputBuffer,
@@ -161,16 +161,14 @@ void ALCportPlayback_Construct(ALCportPlayback *self, ALCdevice *device)
new (self) ALCportPlayback{};
ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device);
SET_VTABLE2(ALCportPlayback, ALCbackend, self);
-
- self->stream = nullptr;
}
void ALCportPlayback_Destruct(ALCportPlayback *self)
{
- PaError err = self->stream ? Pa_CloseStream(self->stream) : paNoError;
+ PaError err = self->Stream ? Pa_CloseStream(self->Stream) : paNoError;
if(err != paNoError)
ERR("Error closing stream: %s\n", Pa_GetErrorText(err));
- self->stream = nullptr;
+ self->Stream = nullptr;
ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
self->~ALCportPlayback();
@@ -200,51 +198,51 @@ ALCenum ALCportPlayback_open(ALCportPlayback *self, const ALCchar *name)
else if(strcmp(name, pa_device) != 0)
return ALC_INVALID_VALUE;
- self->update_size = device->UpdateSize;
+ self->UpdateSize = device->UpdateSize;
- self->params.device = -1;
- if(!ConfigValueInt(nullptr, "port", "device", &self->params.device) ||
- self->params.device < 0)
- self->params.device = Pa_GetDefaultOutputDevice();
- self->params.suggestedLatency = (device->UpdateSize*device->NumUpdates) /
+ self->Params.device = -1;
+ if(!ConfigValueInt(nullptr, "port", "device", &self->Params.device) ||
+ self->Params.device < 0)
+ self->Params.device = Pa_GetDefaultOutputDevice();
+ self->Params.suggestedLatency = (device->UpdateSize*device->NumUpdates) /
(float)device->Frequency;
- self->params.hostApiSpecificStreamInfo = nullptr;
+ self->Params.hostApiSpecificStreamInfo = nullptr;
- self->params.channelCount = ((device->FmtChans == DevFmtMono) ? 1 : 2);
+ self->Params.channelCount = ((device->FmtChans == DevFmtMono) ? 1 : 2);
switch(device->FmtType)
{
case DevFmtByte:
- self->params.sampleFormat = paInt8;
+ self->Params.sampleFormat = paInt8;
break;
case DevFmtUByte:
- self->params.sampleFormat = paUInt8;
+ self->Params.sampleFormat = paUInt8;
break;
case DevFmtUShort:
/* fall-through */
case DevFmtShort:
- self->params.sampleFormat = paInt16;
+ self->Params.sampleFormat = paInt16;
break;
case DevFmtUInt:
/* fall-through */
case DevFmtInt:
- self->params.sampleFormat = paInt32;
+ self->Params.sampleFormat = paInt32;
break;
case DevFmtFloat:
- self->params.sampleFormat = paFloat32;
+ self->Params.sampleFormat = paFloat32;
break;
}
retry_open:
- err = Pa_OpenStream(&self->stream, nullptr, &self->params,
+ err = Pa_OpenStream(&self->Stream, nullptr, &self->Params,
device->Frequency, device->UpdateSize, paNoFlag,
ALCportPlayback_WriteCallback, self
);
if(err != paNoError)
{
- if(self->params.sampleFormat == paFloat32)
+ if(self->Params.sampleFormat == paFloat32)
{
- self->params.sampleFormat = paInt16;
+ self->Params.sampleFormat = paInt16;
goto retry_open;
}
ERR("Pa_OpenStream() returned an error: %s\n", Pa_GetErrorText(err));
@@ -261,33 +259,33 @@ ALCboolean ALCportPlayback_reset(ALCportPlayback *self)
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
const PaStreamInfo *streamInfo;
- streamInfo = Pa_GetStreamInfo(self->stream);
+ streamInfo = Pa_GetStreamInfo(self->Stream);
device->Frequency = streamInfo->sampleRate;
- device->UpdateSize = self->update_size;
+ device->UpdateSize = self->UpdateSize;
- if(self->params.sampleFormat == paInt8)
+ if(self->Params.sampleFormat == paInt8)
device->FmtType = DevFmtByte;
- else if(self->params.sampleFormat == paUInt8)
+ else if(self->Params.sampleFormat == paUInt8)
device->FmtType = DevFmtUByte;
- else if(self->params.sampleFormat == paInt16)
+ else if(self->Params.sampleFormat == paInt16)
device->FmtType = DevFmtShort;
- else if(self->params.sampleFormat == paInt32)
+ else if(self->Params.sampleFormat == paInt32)
device->FmtType = DevFmtInt;
- else if(self->params.sampleFormat == paFloat32)
+ else if(self->Params.sampleFormat == paFloat32)
device->FmtType = DevFmtFloat;
else
{
- ERR("Unexpected sample format: 0x%lx\n", self->params.sampleFormat);
+ ERR("Unexpected sample format: 0x%lx\n", self->Params.sampleFormat);
return ALC_FALSE;
}
- if(self->params.channelCount == 2)
+ if(self->Params.channelCount == 2)
device->FmtChans = DevFmtStereo;
- else if(self->params.channelCount == 1)
+ else if(self->Params.channelCount == 1)
device->FmtChans = DevFmtMono;
else
{
- ERR("Unexpected channel count: %u\n", self->params.channelCount);
+ ERR("Unexpected channel count: %u\n", self->Params.channelCount);
return ALC_FALSE;
}
SetDefaultChannelOrder(device);
@@ -299,7 +297,7 @@ ALCboolean ALCportPlayback_start(ALCportPlayback *self)
{
PaError err;
- err = Pa_StartStream(self->stream);
+ err = Pa_StartStream(self->Stream);
if(err != paNoError)
{
ERR("Pa_StartStream() returned an error: %s\n", Pa_GetErrorText(err));
@@ -311,17 +309,17 @@ ALCboolean ALCportPlayback_start(ALCportPlayback *self)
void ALCportPlayback_stop(ALCportPlayback *self)
{
- PaError err = Pa_StopStream(self->stream);
+ PaError err = Pa_StopStream(self->Stream);
if(err != paNoError)
ERR("Error stopping stream: %s\n", Pa_GetErrorText(err));
}
struct ALCportCapture final : public ALCbackend {
- PaStream *stream;
- PaStreamParameters params;
+ PaStream *Stream{nullptr};
+ PaStreamParameters Params;
- ll_ringbuffer_t *ring;
+ ll_ringbuffer_t *Ring{nullptr};
};
int ALCportCapture_ReadCallback(const void *inputBuffer, void *outputBuffer,
@@ -349,20 +347,17 @@ void ALCportCapture_Construct(ALCportCapture *self, ALCdevice *device)
new (self) ALCportCapture{};
ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device);
SET_VTABLE2(ALCportCapture, ALCbackend, self);
-
- self->stream = nullptr;
- self->ring = nullptr;
}
void ALCportCapture_Destruct(ALCportCapture *self)
{
- PaError err = self->stream ? Pa_CloseStream(self->stream) : paNoError;
+ PaError err = self->Stream ? Pa_CloseStream(self->Stream) : paNoError;
if(err != paNoError)
ERR("Error closing stream: %s\n", Pa_GetErrorText(err));
- self->stream = nullptr;
+ self->Stream = nullptr;
- ll_ringbuffer_free(self->ring);
- self->ring = nullptr;
+ ll_ringbuffer_free(self->Ring);
+ self->Ring = nullptr;
ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
self->~ALCportCapture();
@@ -374,10 +369,10 @@ int ALCportCapture_ReadCallback(const void *inputBuffer, void *UNUSED(outputBuff
const PaStreamCallbackFlags UNUSED(statusFlags), void *userData)
{
ALCportCapture *self = static_cast<ALCportCapture*>(userData);
- size_t writable = ll_ringbuffer_write_space(self->ring);
+ size_t writable = ll_ringbuffer_write_space(self->Ring);
if(framesPerBuffer > writable) framesPerBuffer = writable;
- ll_ringbuffer_write(self->ring, inputBuffer, framesPerBuffer);
+ ll_ringbuffer_write(self->Ring, inputBuffer, framesPerBuffer);
return 0;
}
@@ -397,41 +392,41 @@ ALCenum ALCportCapture_open(ALCportCapture *self, const ALCchar *name)
samples = maxu(samples, 100 * device->Frequency / 1000);
frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder);
- self->ring = ll_ringbuffer_create(samples, frame_size, false);
- if(self->ring == nullptr) return ALC_INVALID_VALUE;
+ self->Ring = ll_ringbuffer_create(samples, frame_size, false);
+ if(self->Ring == nullptr) return ALC_INVALID_VALUE;
- self->params.device = -1;
- if(!ConfigValueInt(nullptr, "port", "capture", &self->params.device) ||
- self->params.device < 0)
- self->params.device = Pa_GetDefaultInputDevice();
- self->params.suggestedLatency = 0.0f;
- self->params.hostApiSpecificStreamInfo = nullptr;
+ self->Params.device = -1;
+ if(!ConfigValueInt(nullptr, "port", "capture", &self->Params.device) ||
+ self->Params.device < 0)
+ self->Params.device = Pa_GetDefaultInputDevice();
+ self->Params.suggestedLatency = 0.0f;
+ self->Params.hostApiSpecificStreamInfo = nullptr;
switch(device->FmtType)
{
case DevFmtByte:
- self->params.sampleFormat = paInt8;
+ self->Params.sampleFormat = paInt8;
break;
case DevFmtUByte:
- self->params.sampleFormat = paUInt8;
+ self->Params.sampleFormat = paUInt8;
break;
case DevFmtShort:
- self->params.sampleFormat = paInt16;
+ self->Params.sampleFormat = paInt16;
break;
case DevFmtInt:
- self->params.sampleFormat = paInt32;
+ self->Params.sampleFormat = paInt32;
break;
case DevFmtFloat:
- self->params.sampleFormat = paFloat32;
+ self->Params.sampleFormat = paFloat32;
break;
case DevFmtUInt:
case DevFmtUShort:
ERR("%s samples not supported\n", DevFmtTypeString(device->FmtType));
return ALC_INVALID_VALUE;
}
- self->params.channelCount = ChannelsFromDevFmt(device->FmtChans, device->mAmbiOrder);
+ self->Params.channelCount = ChannelsFromDevFmt(device->FmtChans, device->mAmbiOrder);
- err = Pa_OpenStream(&self->stream, &self->params, nullptr,
+ err = Pa_OpenStream(&self->Stream, &self->Params, nullptr,
device->Frequency, paFramesPerBufferUnspecified, paNoFlag,
ALCportCapture_ReadCallback, self
);
@@ -448,7 +443,7 @@ ALCenum ALCportCapture_open(ALCportCapture *self, const ALCchar *name)
ALCboolean ALCportCapture_start(ALCportCapture *self)
{
- PaError err = Pa_StartStream(self->stream);
+ PaError err = Pa_StartStream(self->Stream);
if(err != paNoError)
{
ERR("Error starting stream: %s\n", Pa_GetErrorText(err));
@@ -459,7 +454,7 @@ ALCboolean ALCportCapture_start(ALCportCapture *self)
void ALCportCapture_stop(ALCportCapture *self)
{
- PaError err = Pa_StopStream(self->stream);
+ PaError err = Pa_StopStream(self->Stream);
if(err != paNoError)
ERR("Error stopping stream: %s\n", Pa_GetErrorText(err));
}
@@ -467,12 +462,12 @@ void ALCportCapture_stop(ALCportCapture *self)
ALCuint ALCportCapture_availableSamples(ALCportCapture *self)
{
- return ll_ringbuffer_read_space(self->ring);
+ return ll_ringbuffer_read_space(self->Ring);
}
ALCenum ALCportCapture_captureSamples(ALCportCapture *self, ALCvoid *buffer, ALCuint samples)
{
- ll_ringbuffer_read(self->ring, buffer, samples);
+ ll_ringbuffer_read(self->Ring, buffer, samples);
return ALC_NO_ERROR;
}
diff --git a/Alc/backends/pulseaudio.cpp b/Alc/backends/pulseaudio.cpp
index c64c3ed7..560656c5 100644
--- a/Alc/backends/pulseaudio.cpp
+++ b/Alc/backends/pulseaudio.cpp
@@ -534,8 +534,8 @@ struct PulsePlayback final : public ALCbackend {
pa_stream *stream{nullptr};
pa_context *context{nullptr};
- std::atomic<ALenum> killNow{ALC_TRUE};
- std::thread thread;
+ std::atomic<ALenum> mKillNow{ALC_TRUE};
+ std::thread mThread;
};
void PulsePlayback_deviceCallback(pa_context *context, const pa_sink_info *info, int eol, void *pdata);
@@ -870,7 +870,7 @@ int PulsePlayback_mixerProc(PulsePlayback *self)
unique_palock palock{self->loop};
size_t frame_size{pa_frame_size(&self->spec)};
- while(!self->killNow.load(std::memory_order_acquire) &&
+ while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
{
ssize_t len{static_cast<ssize_t>(pa_stream_writable_size(self->stream))};
@@ -1152,8 +1152,8 @@ ALCboolean PulsePlayback_reset(PulsePlayback *self)
ALCboolean PulsePlayback_start(PulsePlayback *self)
{
try {
- self->killNow.store(AL_FALSE, std::memory_order_release);
- self->thread = std::thread(PulsePlayback_mixerProc, self);
+ self->mKillNow.store(AL_FALSE, std::memory_order_release);
+ self->mThread = std::thread(PulsePlayback_mixerProc, self);
return ALC_TRUE;
}
catch(std::exception& e) {
@@ -1167,20 +1167,20 @@ ALCboolean PulsePlayback_start(PulsePlayback *self)
void PulsePlayback_stop(PulsePlayback *self)
{
- self->killNow.store(AL_TRUE, std::memory_order_release);
- if(!self->stream || !self->thread.joinable())
+ self->mKillNow.store(AL_TRUE, std::memory_order_release);
+ if(!self->stream || !self->mThread.joinable())
return;
/* Signal the main loop in case PulseAudio isn't sending us audio requests
* (e.g. if the device is suspended). We need to lock the mainloop in case
- * the mixer is between checking the killNow flag but before waiting for
+ * the mixer is between checking the mKillNow flag but before waiting for
* the signal.
*/
unique_palock palock{self->loop};
palock.unlock();
pa_threaded_mainloop_signal(self->loop, 0);
- self->thread.join();
+ self->mThread.join();
palock.lock();
diff --git a/Alc/backends/qsa.cpp b/Alc/backends/qsa.cpp
index 66f3e601..3fa72472 100644
--- a/Alc/backends/qsa.cpp
+++ b/Alc/backends/qsa.cpp
@@ -51,7 +51,7 @@ struct qsa_data {
ALvoid* buffer;
ALsizei size;
- std::atomic<ALenum> killNow;
+ std::atomic<ALenum> mKillNow;
althrd_t thread;
};
@@ -213,7 +213,7 @@ FORCE_ALIGN static int qsa_proc_playback(void *ptr)
);
PlaybackWrapper_lock(self);
- while(!ATOMIC_LOAD(&data->killNow, almemory_order_acquire))
+ while(!data->mKillNow.load(std::memory_order_acquire))
{
FD_ZERO(&wfds);
FD_SET(data->audio_fd, &wfds);
@@ -239,7 +239,7 @@ FORCE_ALIGN static int qsa_proc_playback(void *ptr)
len = data->size;
write_ptr = static_cast<char*>(data->buffer);
aluMixData(device, write_ptr, len/frame_size);
- while(len>0 && !ATOMIC_LOAD(&data->killNow, almemory_order_acquire))
+ while(len>0 && !data->mKillNow.load(std::memory_order_acquire))
{
int wrote = snd_pcm_plugin_write(data->pcmHandle, write_ptr, len);
if(wrote <= 0)
@@ -289,7 +289,7 @@ static ALCenum qsa_open_playback(PlaybackWrapper *self, const ALCchar* deviceNam
data = (qsa_data*)calloc(1, sizeof(qsa_data));
if(data == NULL)
return ALC_OUT_OF_MEMORY;
- data->killNow.store(AL_TRUE, std::memory_order_relaxed);
+ data->mKillNow.store(AL_TRUE, std::memory_order_relaxed);
if(!deviceName)
deviceName = qsaDevice;
@@ -602,7 +602,7 @@ static ALCboolean qsa_start_playback(PlaybackWrapper *self)
{
qsa_data *data = self->ExtraData;
- ATOMIC_STORE(&data->killNow, AL_FALSE, almemory_order_release);
+ data->mKillNow.store(AL_FALSE, std::memory_order_release);
if(althrd_create(&data->thread, qsa_proc_playback, self) != althrd_success)
return ALC_FALSE;
@@ -614,7 +614,7 @@ static void qsa_stop_playback(PlaybackWrapper *self)
qsa_data *data = self->ExtraData;
int res;
- if(data->killNow.exchange(AL_TRUE, std::memory_order_acq_rel))
+ if(data->mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel))
return;
althrd_join(data->thread, &res);
}
diff --git a/Alc/backends/sndio.cpp b/Alc/backends/sndio.cpp
index 5e7b48af..d7340f4a 100644
--- a/Alc/backends/sndio.cpp
+++ b/Alc/backends/sndio.cpp
@@ -43,7 +43,7 @@ struct SndioPlayback final : public ALCbackend {
ALvoid *mix_data{nullptr};
ALsizei data_size{0};
- std::atomic<ALenum> killNow{AL_TRUE};
+ std::atomic<ALenum> mKillNow{AL_TRUE};
althrd_t thread;
};
@@ -98,7 +98,7 @@ static int SndioPlayback_mixerProc(void *ptr)
frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder);
- while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) &&
+ while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
{
ALsizei len = self->data_size;
@@ -107,7 +107,7 @@ static int SndioPlayback_mixerProc(void *ptr)
SndioPlayback_lock(self);
aluMixData(device, WritePtr, len/frameSize);
SndioPlayback_unlock(self);
- while(len > 0 && !ATOMIC_LOAD(&self->killNow, almemory_order_acquire))
+ while(len > 0 && !self->mKillNow.load(std::memory_order_acquire))
{
wrote = sio_write(self->sndHandle, WritePtr, len);
if(wrote == 0)
@@ -249,7 +249,7 @@ static ALCboolean SndioPlayback_start(SndioPlayback *self)
return ALC_FALSE;
}
- ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release);
+ self->mKillNow.store(AL_FALSE, std::memory_order_release);
if(althrd_create(&self->thread, SndioPlayback_mixerProc, self) != althrd_success)
{
sio_stop(self->sndHandle);
@@ -263,7 +263,7 @@ static void SndioPlayback_stop(SndioPlayback *self)
{
int res;
- if(self->killNow.exchange(AL_TRUE, std::memory_order_acq_rel))
+ if(self->mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel))
return;
althrd_join(self->thread, &res);
@@ -280,7 +280,7 @@ struct SndioCapture final : public ALCbackend {
ll_ringbuffer_t *ring{nullptr};
- std::atomic<ALenum> killNow{AL_TRUE};
+ std::atomic<ALenum> mKillNow{AL_TRUE};
althrd_t thread;
};
@@ -334,7 +334,7 @@ static int SndioCapture_recordProc(void* ptr)
frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder);
- while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) &&
+ while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
{
size_t total, todo;
@@ -490,7 +490,7 @@ static ALCboolean SndioCapture_start(SndioCapture *self)
return ALC_FALSE;
}
- ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release);
+ self->mKillNow.store(AL_FALSE, std::memory_order_release);
if(althrd_create(&self->thread, SndioCapture_recordProc, self) != althrd_success)
{
sio_stop(self->sndHandle);
@@ -504,7 +504,7 @@ static void SndioCapture_stop(SndioCapture *self)
{
int res;
- if(self->killNow.exchange(AL_TRUE, std::memory_order_acq_rel))
+ if(self->mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel))
return;
althrd_join(self->thread, &res);
diff --git a/Alc/backends/solaris.cpp b/Alc/backends/solaris.cpp
index 2d26fb6a..cd3f615f 100644
--- a/Alc/backends/solaris.cpp
+++ b/Alc/backends/solaris.cpp
@@ -49,7 +49,7 @@ struct ALCsolarisBackend final : public ALCbackend {
ALubyte *mix_data{nullptr};
int data_size{0};
- std::atomic<ALenum> killNow{AL_TRUE};
+ std::atomic<ALenum> mKillNow{AL_TRUE};
althrd_t thread;
};
@@ -116,7 +116,7 @@ static int ALCsolarisBackend_mixerProc(void *ptr)
frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder);
ALCsolarisBackend_lock(self);
- while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) &&
+ while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
{
FD_ZERO(&wfds);
@@ -144,7 +144,7 @@ static int ALCsolarisBackend_mixerProc(void *ptr)
write_ptr = self->mix_data;
to_write = self->data_size;
aluMixData(device, write_ptr, to_write/frame_size);
- while(to_write > 0 && !ATOMIC_LOAD_SEQ(&self->killNow))
+ while(to_write > 0 && !self->mKillNow.load())
{
wrote = write(self->fd, write_ptr, to_write);
if(wrote < 0)
@@ -268,7 +268,7 @@ static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self)
static ALCboolean ALCsolarisBackend_start(ALCsolarisBackend *self)
{
- ATOMIC_STORE_SEQ(&self->killNow, AL_FALSE);
+ self->mKillNow.store(AL_FALSE);
if(althrd_create(&self->thread, ALCsolarisBackend_mixerProc, self) != althrd_success)
return ALC_FALSE;
return ALC_TRUE;
@@ -278,7 +278,7 @@ static void ALCsolarisBackend_stop(ALCsolarisBackend *self)
{
int res;
- if(self->killNow.exchange(AL_TRUE))
+ if(self->mKillNow.exchange(AL_TRUE))
return;
althrd_join(self->thread, &res);
diff --git a/Alc/backends/wave.cpp b/Alc/backends/wave.cpp
index ec5e787b..2475aa9f 100644
--- a/Alc/backends/wave.cpp
+++ b/Alc/backends/wave.cpp
@@ -84,8 +84,8 @@ struct ALCwaveBackend final : public ALCbackend {
al::vector<ALbyte> mBuffer;
- std::atomic<ALenum> killNow{AL_TRUE};
- std::thread thread;
+ std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::thread mThread;
};
int ALCwaveBackend_mixerProc(ALCwaveBackend *self);
@@ -134,7 +134,7 @@ int ALCwaveBackend_mixerProc(ALCwaveBackend *self)
ALint64 done{0};
auto start = std::chrono::steady_clock::now();
- while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) &&
+ while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
{
auto now = std::chrono::steady_clock::now();
@@ -348,8 +348,8 @@ ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self)
ALCboolean ALCwaveBackend_start(ALCwaveBackend *self)
{
try {
- ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release);
- self->thread = std::thread(ALCwaveBackend_mixerProc, self);
+ self->mKillNow.store(AL_FALSE, std::memory_order_release);
+ self->mThread = std::thread(ALCwaveBackend_mixerProc, self);
return ALC_TRUE;
}
catch(std::exception& e) {
@@ -362,9 +362,9 @@ ALCboolean ALCwaveBackend_start(ALCwaveBackend *self)
void ALCwaveBackend_stop(ALCwaveBackend *self)
{
- if(self->killNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !self->thread.joinable())
+ if(self->mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !self->mThread.joinable())
return;
- self->thread.join();
+ self->mThread.join();
long size{ftell(self->mFile)};
if(size > 0)
diff --git a/Alc/backends/winmm.cpp b/Alc/backends/winmm.cpp
index f1aee5b3..b4651b4c 100644
--- a/Alc/backends/winmm.cpp
+++ b/Alc/backends/winmm.cpp
@@ -130,8 +130,8 @@ struct ALCwinmmPlayback final : public ALCbackend {
WAVEFORMATEX Format{};
- std::atomic<ALenum> killNow{AL_TRUE};
- std::thread thread;
+ std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::thread mThread;
};
void ALCwinmmPlayback_Construct(ALCwinmmPlayback *self, ALCdevice *device);
@@ -205,7 +205,7 @@ FORCE_ALIGN int ALCwinmmPlayback_mixerProc(ALCwinmmPlayback *self)
althrd_setname(MIXER_THREAD_NAME);
ALCwinmmPlayback_lock(self);
- while(!self->killNow.load(std::memory_order_acquire) &&
+ while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
{
ALsizei todo = self->Writable.load(std::memory_order_acquire);
@@ -368,8 +368,8 @@ ALCboolean ALCwinmmPlayback_start(ALCwinmmPlayback *self)
);
self->Writable.store(self->WaveBuffer.size(), std::memory_order_release);
- self->killNow.store(AL_FALSE, std::memory_order_release);
- self->thread = std::thread(ALCwinmmPlayback_mixerProc, self);
+ self->mKillNow.store(AL_FALSE, std::memory_order_release);
+ self->mThread = std::thread(ALCwinmmPlayback_mixerProc, self);
return ALC_TRUE;
}
catch(std::exception& e) {
@@ -382,9 +382,9 @@ ALCboolean ALCwinmmPlayback_start(ALCwinmmPlayback *self)
void ALCwinmmPlayback_stop(ALCwinmmPlayback *self)
{
- if(self->killNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !self->thread.joinable())
+ if(self->mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !self->mThread.joinable())
return;
- self->thread.join();
+ self->mThread.join();
while(self->Writable.load(std::memory_order_acquire) < self->WaveBuffer.size())
alsem_wait(&self->Sem);
@@ -408,8 +408,8 @@ struct ALCwinmmCapture final : public ALCbackend {
WAVEFORMATEX Format{};
- std::atomic<ALenum> killNow{AL_TRUE};
- std::thread thread;
+ std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::thread mThread;
};
void ALCwinmmCapture_Construct(ALCwinmmCapture *self, ALCdevice *device);
@@ -486,7 +486,7 @@ int ALCwinmmCapture_captureProc(ALCwinmmCapture *self)
althrd_setname(RECORD_THREAD_NAME);
ALCwinmmCapture_lock(self);
- while(!self->killNow.load(std::memory_order_acquire) &&
+ while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
{
ALsizei todo = self->Readable.load(std::memory_order_acquire);
@@ -618,8 +618,8 @@ ALCboolean ALCwinmmCapture_start(ALCwinmmCapture *self)
waveInAddBuffer(self->InHdl, &self->WaveBuffer[i], sizeof(WAVEHDR));
}
- self->killNow.store(AL_FALSE, std::memory_order_release);
- self->thread = std::thread(ALCwinmmCapture_captureProc, self);
+ self->mKillNow.store(AL_FALSE, std::memory_order_release);
+ self->mThread = std::thread(ALCwinmmCapture_captureProc, self);
waveInStart(self->InHdl);
return ALC_TRUE;
@@ -636,11 +636,11 @@ void ALCwinmmCapture_stop(ALCwinmmCapture *self)
{
waveInStop(self->InHdl);
- self->killNow.store(AL_TRUE, std::memory_order_release);
- if(self->thread.joinable())
+ self->mKillNow.store(AL_TRUE, std::memory_order_release);
+ if(self->mThread.joinable())
{
alsem_post(&self->Sem);
- self->thread.join();
+ self->mThread.join();
}
waveInReset(self->InHdl);