aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-12-27 17:48:02 -0800
committerChris Robinson <[email protected]>2018-12-27 17:48:02 -0800
commit465ab11748cab17536ae6487027e2743134ab26f (patch)
tree377e598943510c926a5061561df31661c50985e3 /Alc/backends
parente48b8c4cdada7bd1df0c221d633d0ddc3f81fddd (diff)
Finish renaming backend struct fields
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/qsa.cpp36
-rw-r--r--Alc/backends/sdl2.cpp62
-rw-r--r--Alc/backends/sndio.cpp80
-rw-r--r--Alc/backends/solaris.cpp40
-rw-r--r--Alc/backends/winmm.cpp283
5 files changed, 246 insertions, 255 deletions
diff --git a/Alc/backends/qsa.cpp b/Alc/backends/qsa.cpp
index 7469d874..6ceaf0a6 100644
--- a/Alc/backends/qsa.cpp
+++ b/Alc/backends/qsa.cpp
@@ -171,7 +171,7 @@ void deviceList(int type, al::vector<DevMap> *devmap)
/* Wrappers to use an old-style backend with the new interface. */
struct PlaybackWrapper final : public ALCbackend {
- std::unique_ptr<qsa_data> ExtraData;
+ std::unique_ptr<qsa_data> mExtraData;
PlaybackWrapper(ALCdevice *device) noexcept : ALCbackend{device} { }
};
@@ -195,7 +195,7 @@ FORCE_ALIGN static int qsa_proc_playback(void *ptr)
{
PlaybackWrapper *self = static_cast<PlaybackWrapper*>(ptr);
ALCdevice *device = self->mDevice;
- qsa_data *data = self->ExtraData.get();
+ qsa_data *data = self->mExtraData.get();
snd_pcm_channel_status_t status;
sched_param param;
char* write_ptr;
@@ -320,14 +320,14 @@ static ALCenum qsa_open_playback(PlaybackWrapper *self, const ALCchar* deviceNam
}
device->DeviceName = deviceName;
- self->ExtraData = std::move(data);
+ self->mExtraData = std::move(data);
return ALC_NO_ERROR;
}
static void qsa_close_playback(PlaybackWrapper *self)
{
- qsa_data *data = self->ExtraData.get();
+ qsa_data *data = self->mExtraData.get();
if (data->buffer!=NULL)
{
@@ -337,13 +337,13 @@ static void qsa_close_playback(PlaybackWrapper *self)
snd_pcm_close(data->pcmHandle);
- self->ExtraData = nullptr;
+ self->mExtraData = nullptr;
}
static ALCboolean qsa_reset_playback(PlaybackWrapper *self)
{
ALCdevice *device = self->mDevice;
- qsa_data *data = self->ExtraData.get();
+ qsa_data *data = self->mExtraData.get();
int32_t format=-1;
switch(device->FmtType)
@@ -588,7 +588,7 @@ static ALCboolean qsa_reset_playback(PlaybackWrapper *self)
static ALCboolean qsa_start_playback(PlaybackWrapper *self)
{
- qsa_data *data = self->ExtraData.get();
+ qsa_data *data = self->mExtraData.get();
try {
data->mKillNow.store(AL_FALSE, std::memory_order_release);
@@ -605,7 +605,7 @@ static ALCboolean qsa_start_playback(PlaybackWrapper *self)
static void qsa_stop_playback(PlaybackWrapper *self)
{
- qsa_data *data = self->ExtraData.get();
+ qsa_data *data = self->mExtraData.get();
if(data->mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !data->mThread.joinable())
return;
@@ -621,7 +621,7 @@ static void PlaybackWrapper_Construct(PlaybackWrapper *self, ALCdevice *device)
static void PlaybackWrapper_Destruct(PlaybackWrapper *self)
{
- if(self->ExtraData)
+ if(self->mExtraData)
qsa_close_playback(self);
self->~PlaybackWrapper();
@@ -654,7 +654,7 @@ static void PlaybackWrapper_stop(PlaybackWrapper *self)
/***********/
struct CaptureWrapper final : public ALCbackend {
- std::unique_ptr<qsa_data> ExtraData;
+ std::unique_ptr<qsa_data> mExtraData;
CaptureWrapper(ALCdevice *device) noexcept : ALCbackend{device} { }
};
@@ -767,25 +767,25 @@ static ALCenum qsa_open_capture(CaptureWrapper *self, const ALCchar *deviceName)
return ALC_INVALID_VALUE;
}
- self->ExtraData = std::move(data);
+ self->mExtraData = std::move(data);
return ALC_NO_ERROR;
}
static void qsa_close_capture(CaptureWrapper *self)
{
- qsa_data *data = self->ExtraData.get();
+ qsa_data *data = self->mExtraData.get();
if (data->pcmHandle!=nullptr)
snd_pcm_close(data->pcmHandle);
data->pcmHandle = nullptr
- self->ExtraData = nullptr;
+ self->mExtraData = nullptr;
}
static void qsa_start_capture(CaptureWrapper *self)
{
- qsa_data *data = self->ExtraData.get();
+ qsa_data *data = self->mExtraData.get();
int rstatus;
if ((rstatus=snd_pcm_plugin_prepare(data->pcmHandle, SND_PCM_CHANNEL_CAPTURE))<0)
@@ -807,14 +807,14 @@ static void qsa_start_capture(CaptureWrapper *self)
static void qsa_stop_capture(CaptureWrapper *self)
{
- qsa_data *data = self->ExtraData.get();
+ qsa_data *data = self->mExtraData.get();
snd_pcm_capture_flush(data->pcmHandle);
}
static ALCuint qsa_available_samples(CaptureWrapper *self)
{
ALCdevice *device = self->mDevice;
- qsa_data *data = self->ExtraData.get();
+ qsa_data *data = self->mExtraData.get();
snd_pcm_channel_status_t status;
ALint frame_size = device->frameSizeFromFmt();
ALint free_size;
@@ -846,7 +846,7 @@ static ALCuint qsa_available_samples(CaptureWrapper *self)
static ALCenum qsa_capture_samples(CaptureWrapper *self, ALCvoid *buffer, ALCuint samples)
{
ALCdevice *device = self->mDevice;
- qsa_data *data = self->ExtraData.get();
+ qsa_data *data = self->mExtraData.get();
char* read_ptr;
snd_pcm_channel_status_t status;
int selectret;
@@ -922,7 +922,7 @@ static void CaptureWrapper_Construct(CaptureWrapper *self, ALCdevice *device)
static void CaptureWrapper_Destruct(CaptureWrapper *self)
{
- if(self->ExtraData)
+ if(self->mExtraData)
qsa_close_capture(self);
self->~CaptureWrapper();
diff --git a/Alc/backends/sdl2.cpp b/Alc/backends/sdl2.cpp
index cb5f875a..12cf7a35 100644
--- a/Alc/backends/sdl2.cpp
+++ b/Alc/backends/sdl2.cpp
@@ -40,13 +40,13 @@
#endif
struct ALCsdl2Backend final : public ALCbackend {
- SDL_AudioDeviceID deviceID{0u};
- ALsizei frameSize{0};
+ SDL_AudioDeviceID mDeviceID{0u};
+ ALsizei mFrameSize{0};
- ALuint Frequency{0u};
- DevFmtChannels FmtChans{};
- DevFmtType FmtType{};
- ALuint UpdateSize{0u};
+ ALuint mFrequency{0u};
+ DevFmtChannels mFmtChans{};
+ DevFmtType mFmtType{};
+ ALuint mUpdateSize{0u};
ALCsdl2Backend(ALCdevice *device) noexcept : ALCbackend{device} { }
};
@@ -72,19 +72,13 @@ static void ALCsdl2Backend_Construct(ALCsdl2Backend *self, ALCdevice *device)
{
new (self) ALCsdl2Backend{device};
SET_VTABLE2(ALCsdl2Backend, ALCbackend, self);
-
- self->frameSize = device->frameSizeFromFmt();
- self->Frequency = device->Frequency;
- self->FmtChans = device->FmtChans;
- self->FmtType = device->FmtType;
- self->UpdateSize = device->UpdateSize;
}
static void ALCsdl2Backend_Destruct(ALCsdl2Backend *self)
{
- if(self->deviceID)
- SDL_CloseAudioDevice(self->deviceID);
- self->deviceID = 0;
+ if(self->mDeviceID)
+ SDL_CloseAudioDevice(self->mDeviceID);
+ self->mDeviceID = 0;
self->~ALCsdl2Backend();
}
@@ -94,8 +88,8 @@ static void ALCsdl2Backend_audioCallback(void *ptr, Uint8 *stream, int len)
{
auto self = static_cast<ALCsdl2Backend*>(ptr);
- assert((len % self->frameSize) == 0);
- aluMixData(self->mDevice, stream, len / self->frameSize);
+ assert((len % self->mFrameSize) == 0);
+ aluMixData(self->mDevice, stream, len / self->mFrameSize);
}
static ALCenum ALCsdl2Backend_open(ALCsdl2Backend *self, const ALCchar *name)
@@ -126,19 +120,19 @@ static ALCenum ALCsdl2Backend_open(ALCsdl2Backend *self, const ALCchar *name)
* necessarily the first in the list.
*/
if(!name || strcmp(name, defaultDeviceName) == 0)
- self->deviceID = SDL_OpenAudioDevice(nullptr, SDL_FALSE, &want, &have,
+ self->mDeviceID = SDL_OpenAudioDevice(nullptr, SDL_FALSE, &want, &have,
SDL_AUDIO_ALLOW_ANY_CHANGE);
else
{
const size_t prefix_len = strlen(DEVNAME_PREFIX);
if(strncmp(name, DEVNAME_PREFIX, prefix_len) == 0)
- self->deviceID = SDL_OpenAudioDevice(name+prefix_len, SDL_FALSE, &want, &have,
+ self->mDeviceID = SDL_OpenAudioDevice(name+prefix_len, SDL_FALSE, &want, &have,
SDL_AUDIO_ALLOW_ANY_CHANGE);
else
- self->deviceID = SDL_OpenAudioDevice(name, SDL_FALSE, &want, &have,
+ self->mDeviceID = SDL_OpenAudioDevice(name, SDL_FALSE, &want, &have,
SDL_AUDIO_ALLOW_ANY_CHANGE);
}
- if(self->deviceID == 0)
+ if(self->mDeviceID == 0)
return ALC_INVALID_VALUE;
device->Frequency = have.freq;
@@ -166,11 +160,11 @@ static ALCenum ALCsdl2Backend_open(ALCsdl2Backend *self, const ALCchar *name)
device->UpdateSize = have.samples;
device->NumUpdates = 2; /* SDL always (tries to) use two periods. */
- self->frameSize = device->frameSizeFromFmt();
- self->Frequency = device->Frequency;
- self->FmtChans = device->FmtChans;
- self->FmtType = device->FmtType;
- self->UpdateSize = device->UpdateSize;
+ self->mFrameSize = device->frameSizeFromFmt();
+ self->mFrequency = device->Frequency;
+ self->mFmtChans = device->FmtChans;
+ self->mFmtType = device->FmtType;
+ self->mUpdateSize = device->UpdateSize;
device->DeviceName = name ? name : defaultDeviceName;
return ALC_NO_ERROR;
@@ -179,10 +173,10 @@ static ALCenum ALCsdl2Backend_open(ALCsdl2Backend *self, const ALCchar *name)
static ALCboolean ALCsdl2Backend_reset(ALCsdl2Backend *self)
{
ALCdevice *device{self->mDevice};
- device->Frequency = self->Frequency;
- device->FmtChans = self->FmtChans;
- device->FmtType = self->FmtType;
- device->UpdateSize = self->UpdateSize;
+ device->Frequency = self->mFrequency;
+ device->FmtChans = self->mFmtChans;
+ device->FmtType = self->mFmtType;
+ device->UpdateSize = self->mUpdateSize;
device->NumUpdates = 2;
SetDefaultWFXChannelOrder(device);
return ALC_TRUE;
@@ -190,23 +184,23 @@ static ALCboolean ALCsdl2Backend_reset(ALCsdl2Backend *self)
static ALCboolean ALCsdl2Backend_start(ALCsdl2Backend *self)
{
- SDL_PauseAudioDevice(self->deviceID, 0);
+ SDL_PauseAudioDevice(self->mDeviceID, 0);
return ALC_TRUE;
}
static void ALCsdl2Backend_stop(ALCsdl2Backend *self)
{
- SDL_PauseAudioDevice(self->deviceID, 1);
+ SDL_PauseAudioDevice(self->mDeviceID, 1);
}
static void ALCsdl2Backend_lock(ALCsdl2Backend *self)
{
- SDL_LockAudioDevice(self->deviceID);
+ SDL_LockAudioDevice(self->mDeviceID);
}
static void ALCsdl2Backend_unlock(ALCsdl2Backend *self)
{
- SDL_UnlockAudioDevice(self->deviceID);
+ SDL_UnlockAudioDevice(self->mDeviceID);
}
diff --git a/Alc/backends/sndio.cpp b/Alc/backends/sndio.cpp
index ef9ce549..a37c1cd3 100644
--- a/Alc/backends/sndio.cpp
+++ b/Alc/backends/sndio.cpp
@@ -40,10 +40,10 @@ static const ALCchar sndio_device[] = "SndIO Default";
struct SndioPlayback final : public ALCbackend {
- sio_hdl *sndHandle{nullptr};
+ sio_hdl *mSndHandle{nullptr};
- ALvoid *mix_data{nullptr};
- ALsizei data_size{0};
+ ALvoid *mMixData{nullptr};
+ ALsizei mDataSize{0};
std::atomic<ALenum> mKillNow{AL_TRUE};
std::thread mThread;
@@ -77,12 +77,12 @@ static void SndioPlayback_Construct(SndioPlayback *self, ALCdevice *device)
static void SndioPlayback_Destruct(SndioPlayback *self)
{
- if(self->sndHandle)
- sio_close(self->sndHandle);
- self->sndHandle = nullptr;
+ if(self->mSndHandle)
+ sio_close(self->mSndHandle);
+ self->mSndHandle = nullptr;
- al_free(self->mix_data);
- self->mix_data = nullptr;
+ al_free(self->mMixData);
+ self->mMixData = nullptr;
self->~SndioPlayback();
}
@@ -102,15 +102,15 @@ static int SndioPlayback_mixerProc(SndioPlayback *self)
while(!self->mKillNow.load(std::memory_order_acquire) &&
device->Connected.load(std::memory_order_acquire))
{
- ALsizei len = self->data_size;
- ALubyte *WritePtr = static_cast<ALubyte*>(self->mix_data);
+ ALsizei len = self->mDataSize;
+ ALubyte *WritePtr = static_cast<ALubyte*>(self->mMixData);
SndioPlayback_lock(self);
aluMixData(device, WritePtr, len/frameSize);
SndioPlayback_unlock(self);
while(len > 0 && !self->mKillNow.load(std::memory_order_acquire))
{
- wrote = sio_write(self->sndHandle, WritePtr, len);
+ wrote = sio_write(self->mSndHandle, WritePtr, len);
if(wrote == 0)
{
ERR("sio_write failed\n");
@@ -138,8 +138,8 @@ static ALCenum SndioPlayback_open(SndioPlayback *self, const ALCchar *name)
else if(strcmp(name, sndio_device) != 0)
return ALC_INVALID_VALUE;
- self->sndHandle = sio_open(nullptr, SIO_PLAY, 0);
- if(self->sndHandle == nullptr)
+ self->mSndHandle = sio_open(nullptr, SIO_PLAY, 0);
+ if(self->mSndHandle == nullptr)
{
ERR("Could not open device\n");
return ALC_INVALID_VALUE;
@@ -193,7 +193,7 @@ static ALCboolean SndioPlayback_reset(SndioPlayback *self)
par.appbufsz = device->UpdateSize * (device->NumUpdates-1);
if(!par.appbufsz) par.appbufsz = device->UpdateSize;
- if(!sio_setpar(self->sndHandle, &par) || !sio_getpar(self->sndHandle, &par))
+ if(!sio_setpar(self->mSndHandle, &par) || !sio_getpar(self->mSndHandle, &par))
{
ERR("Failed to set device parameters\n");
return ALC_FALSE;
@@ -238,11 +238,11 @@ static ALCboolean SndioPlayback_start(SndioPlayback *self)
{
ALCdevice *device{self->mDevice};
- self->data_size = device->UpdateSize * device->frameSizeFromFmt();
- al_free(self->mix_data);
- self->mix_data = al_calloc(16, self->data_size);
+ self->mDataSize = device->UpdateSize * device->frameSizeFromFmt();
+ al_free(self->mMixData);
+ self->mMixData = al_calloc(16, self->mDataSize);
- if(!sio_start(self->sndHandle))
+ if(!sio_start(self->mSndHandle))
{
ERR("Error starting playback\n");
return ALC_FALSE;
@@ -258,7 +258,7 @@ static ALCboolean SndioPlayback_start(SndioPlayback *self)
}
catch(...) {
}
- sio_stop(self->sndHandle);
+ sio_stop(self->mSndHandle);
return ALC_FALSE;
}
@@ -268,18 +268,18 @@ static void SndioPlayback_stop(SndioPlayback *self)
return;
self->mThread.join();
- if(!sio_stop(self->sndHandle))
+ if(!sio_stop(self->mSndHandle))
ERR("Error stopping device\n");
- al_free(self->mix_data);
- self->mix_data = nullptr;
+ al_free(self->mMixData);
+ self->mMixData = nullptr;
}
struct SndioCapture final : public ALCbackend {
- sio_hdl *sndHandle{nullptr};
+ sio_hdl *mSndHandle{nullptr};
- RingBufferPtr ring{nullptr};
+ RingBufferPtr mRing;
std::atomic<ALenum> mKillNow{AL_TRUE};
std::thread mThread;
@@ -313,9 +313,9 @@ static void SndioCapture_Construct(SndioCapture *self, ALCdevice *device)
static void SndioCapture_Destruct(SndioCapture *self)
{
- if(self->sndHandle)
- sio_close(self->sndHandle);
- self->sndHandle = nullptr;
+ if(self->mSndHandle)
+ sio_close(self->mSndHandle);
+ self->mSndHandle = nullptr;
self->~SndioCapture();
}
@@ -324,7 +324,7 @@ static void SndioCapture_Destruct(SndioCapture *self)
static int SndioCapture_recordProc(SndioCapture *self)
{
ALCdevice *device{self->mDevice};
- RingBuffer *ring{self->ring.get()};
+ RingBuffer *ring{self->mRing.get()};
SetRTPriority();
althrd_setname(RECORD_THREAD_NAME);
@@ -341,7 +341,7 @@ static int SndioCapture_recordProc(SndioCapture *self)
if(todo == 0)
{
static char junk[4096];
- sio_read(self->sndHandle, junk, minz(sizeof(junk)/frameSize, device->UpdateSize)*frameSize);
+ sio_read(self->mSndHandle, junk, minz(sizeof(junk)/frameSize, device->UpdateSize)*frameSize);
continue;
}
@@ -356,7 +356,7 @@ static int SndioCapture_recordProc(SndioCapture *self)
if(!data.first.len)
data.first = data.second;
- got = sio_read(self->sndHandle, data.first.buf, minz(todo-total, data.first.len));
+ got = sio_read(self->mSndHandle, data.first.buf, minz(todo-total, data.first.len));
if(!got)
{
SndioCapture_lock(self);
@@ -386,8 +386,8 @@ static ALCenum SndioCapture_open(SndioCapture *self, const ALCchar *name)
else if(strcmp(name, sndio_device) != 0)
return ALC_INVALID_VALUE;
- self->sndHandle = sio_open(nullptr, SIO_REC, 0);
- if(self->sndHandle == nullptr)
+ self->mSndHandle = sio_open(nullptr, SIO_REC, 0);
+ if(self->mSndHandle == nullptr)
{
ERR("Could not open device\n");
return ALC_INVALID_VALUE;
@@ -438,7 +438,7 @@ static ALCenum SndioCapture_open(SndioCapture *self, const ALCchar *name)
device->UpdateSize = par.round;
device->NumUpdates = maxu(par.appbufsz/par.round, 1);
- if(!sio_setpar(self->sndHandle, &par) || !sio_getpar(self->sndHandle, &par))
+ if(!sio_setpar(self->mSndHandle, &par) || !sio_getpar(self->mSndHandle, &par))
{
ERR("Failed to set device parameters\n");
return ALC_INVALID_VALUE;
@@ -465,8 +465,8 @@ static ALCenum SndioCapture_open(SndioCapture *self, const ALCchar *name)
return ALC_INVALID_VALUE;
}
- self->ring = CreateRingBuffer(device->UpdateSize*device->NumUpdates, par.bps*par.rchan, false);
- if(!self->ring)
+ self->mRing = CreateRingBuffer(device->UpdateSize*device->NumUpdates, par.bps*par.rchan, false);
+ if(!self->mRing)
{
ERR("Failed to allocate %u-byte ringbuffer\n",
device->UpdateSize*device->NumUpdates*par.bps*par.rchan);
@@ -481,7 +481,7 @@ static ALCenum SndioCapture_open(SndioCapture *self, const ALCchar *name)
static ALCboolean SndioCapture_start(SndioCapture *self)
{
- if(!sio_start(self->sndHandle))
+ if(!sio_start(self->mSndHandle))
{
ERR("Error starting playback\n");
return ALC_FALSE;
@@ -497,7 +497,7 @@ static ALCboolean SndioCapture_start(SndioCapture *self)
}
catch(...) {
}
- sio_stop(self->sndHandle);
+ sio_stop(self->mSndHandle);
return ALC_FALSE;
}
@@ -507,20 +507,20 @@ static void SndioCapture_stop(SndioCapture *self)
return;
self->mThread.join();
- if(!sio_stop(self->sndHandle))
+ if(!sio_stop(self->mSndHandle))
ERR("Error stopping device\n");
}
static ALCenum SndioCapture_captureSamples(SndioCapture *self, void *buffer, ALCuint samples)
{
- RingBuffer *ring{self->ring.get()};
+ RingBuffer *ring{self->mRing.get()};
ring->read(buffer, samples);
return ALC_NO_ERROR;
}
static ALCuint SndioCapture_availableSamples(SndioCapture *self)
{
- RingBuffer *ring{self->ring.get()};
+ RingBuffer *ring{self->mRing.get()};
return ring->readSpace();
}
diff --git a/Alc/backends/solaris.cpp b/Alc/backends/solaris.cpp
index bbbe1612..ab622927 100644
--- a/Alc/backends/solaris.cpp
+++ b/Alc/backends/solaris.cpp
@@ -47,10 +47,10 @@
struct ALCsolarisBackend final : public ALCbackend {
- int fd{-1};
+ int mFd{-1};
- ALubyte *mix_data{nullptr};
- int data_size{0};
+ ALubyte *mMixData{nullptr};
+ int mDataSize{0};
std::atomic<ALenum> mKillNow{AL_TRUE};
std::thread mThread;
@@ -89,13 +89,13 @@ static void ALCsolarisBackend_Construct(ALCsolarisBackend *self, ALCdevice *devi
static void ALCsolarisBackend_Destruct(ALCsolarisBackend *self)
{
- if(self->fd != -1)
- close(self->fd);
- self->fd = -1;
+ if(self->mFd != -1)
+ close(self->mFd);
+ self->mFd = -1;
- free(self->mix_data);
- self->mix_data = nullptr;
- self->data_size = 0;
+ free(self->mMixData);
+ self->mMixData = nullptr;
+ self->mDataSize = 0;
self->~ALCsolarisBackend();
}
@@ -115,7 +115,7 @@ static int ALCsolarisBackend_mixerProc(ALCsolarisBackend *self)
device->Connected.load(std::memory_order_acquire))
{
pollfd pollitem{};
- pollitem.fd = self->fd;
+ pollitem.fd = self->mFd;
pollitem.events = POLLOUT;
ALCsolarisBackend_unlock(self);
@@ -135,12 +135,12 @@ static int ALCsolarisBackend_mixerProc(ALCsolarisBackend *self)
continue;
}
- ALubyte *write_ptr{self->mix_data};
- int to_write{self->data_size};
+ ALubyte *write_ptr{self->mMixData};
+ int to_write{self->mDataSize};
aluMixData(device, write_ptr, to_write/frame_size);
while(to_write > 0 && !self->mKillNow.load())
{
- ssize_t wrote{write(self->fd, write_ptr, to_write)};
+ ssize_t wrote{write(self->mFd, write_ptr, to_write)};
if(wrote < 0)
{
if(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)
@@ -170,8 +170,8 @@ static ALCenum ALCsolarisBackend_open(ALCsolarisBackend *self, const ALCchar *na
else if(strcmp(name, solaris_device) != 0)
return ALC_INVALID_VALUE;
- self->fd = open(solaris_driver, O_WRONLY);
- if(self->fd == -1)
+ self->mFd = open(solaris_driver, O_WRONLY);
+ if(self->mFd == -1)
{
ERR("Could not open %s: %s\n", solaris_driver, strerror(errno));
return ALC_INVALID_VALUE;
@@ -224,7 +224,7 @@ static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self)
frameSize = numChannels * device->bytesFromFmt();
info.play.buffer_size = device->UpdateSize*device->NumUpdates * frameSize;
- if(ioctl(self->fd, AUDIO_SETINFO, &info) < 0)
+ if(ioctl(self->mFd, AUDIO_SETINFO, &info) < 0)
{
ERR("ioctl failed: %s\n", strerror(errno));
return ALC_FALSE;
@@ -252,9 +252,9 @@ static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self)
SetDefaultChannelOrder(device);
- free(self->mix_data);
- self->data_size = device->UpdateSize * device->frameSizeFromFmt();
- self->mix_data = static_cast<ALubyte*>(calloc(1, self->data_size));
+ free(self->mMixData);
+ self->mDataSize = device->UpdateSize * device->frameSizeFromFmt();
+ self->mMixData = static_cast<ALubyte*>(calloc(1, self->mDataSize));
return ALC_TRUE;
}
@@ -281,7 +281,7 @@ static void ALCsolarisBackend_stop(ALCsolarisBackend *self)
self->mThread.join();
- if(ioctl(self->fd, AUDIO_DRAIN) < 0)
+ if(ioctl(self->mFd, AUDIO_DRAIN) < 0)
ERR("Error draining device: %s\n", strerror(errno));
}
diff --git a/Alc/backends/winmm.cpp b/Alc/backends/winmm.cpp
index 31c39c52..1258b6a2 100644
--- a/Alc/backends/winmm.cpp
+++ b/Alc/backends/winmm.cpp
@@ -121,14 +121,14 @@ void ProbeCaptureDevices(void)
struct ALCwinmmPlayback final : public ALCbackend {
- std::atomic<ALuint> Writable{0u};
- al::semaphore Sem;
- int Idx{0};
- std::array<WAVEHDR,4> WaveBuffer;
+ std::atomic<ALuint> mWritable{0u};
+ al::semaphore mSem;
+ int mIdx{0};
+ std::array<WAVEHDR,4> mWaveBuffer;
- HWAVEOUT OutHdl{nullptr};
+ HWAVEOUT mOutHdl{nullptr};
- WAVEFORMATEX Format{};
+ WAVEFORMATEX mFormat{};
std::atomic<ALenum> mKillNow{AL_TRUE};
std::thread mThread;
@@ -161,17 +161,17 @@ void ALCwinmmPlayback_Construct(ALCwinmmPlayback *self, ALCdevice *device)
new (self) ALCwinmmPlayback{device};
SET_VTABLE2(ALCwinmmPlayback, ALCbackend, self);
- std::fill(self->WaveBuffer.begin(), self->WaveBuffer.end(), WAVEHDR{});
+ std::fill(self->mWaveBuffer.begin(), self->mWaveBuffer.end(), WAVEHDR{});
}
void ALCwinmmPlayback_Destruct(ALCwinmmPlayback *self)
{
- if(self->OutHdl)
- waveOutClose(self->OutHdl);
- self->OutHdl = nullptr;
+ if(self->mOutHdl)
+ waveOutClose(self->mOutHdl);
+ self->mOutHdl = nullptr;
- al_free(self->WaveBuffer[0].lpData);
- std::fill(self->WaveBuffer.begin(), self->WaveBuffer.end(), WAVEHDR{});
+ al_free(self->mWaveBuffer[0].lpData);
+ std::fill(self->mWaveBuffer.begin(), self->mWaveBuffer.end(), WAVEHDR{});
self->~ALCwinmmPlayback();
}
@@ -190,8 +190,8 @@ void CALLBACK ALCwinmmPlayback_waveOutProc(HWAVEOUT UNUSED(device), UINT msg,
return;
auto self = reinterpret_cast<ALCwinmmPlayback*>(instance);
- self->Writable.fetch_add(1, std::memory_order_acq_rel);
- self->Sem.post();
+ self->mWritable.fetch_add(1, std::memory_order_acq_rel);
+ self->mSem.post();
}
FORCE_ALIGN int ALCwinmmPlayback_mixerProc(ALCwinmmPlayback *self)
@@ -205,25 +205,25 @@ FORCE_ALIGN int ALCwinmmPlayback_mixerProc(ALCwinmmPlayback *self)
while(!self->mKillNow.load(std::memory_order_acquire) &&
device->Connected.load(std::memory_order_acquire))
{
- ALsizei todo = self->Writable.load(std::memory_order_acquire);
+ ALsizei todo = self->mWritable.load(std::memory_order_acquire);
if(todo < 1)
{
ALCwinmmPlayback_unlock(self);
- self->Sem.wait();
+ self->mSem.wait();
ALCwinmmPlayback_lock(self);
continue;
}
- int widx{self->Idx};
+ int widx{self->mIdx};
do {
- WAVEHDR &waveHdr = self->WaveBuffer[widx];
- widx = (widx+1) % self->WaveBuffer.size();
+ WAVEHDR &waveHdr = self->mWaveBuffer[widx];
+ widx = (widx+1) % self->mWaveBuffer.size();
aluMixData(device, waveHdr.lpData, device->UpdateSize);
- self->Writable.fetch_sub(1, std::memory_order_acq_rel);
- waveOutWrite(self->OutHdl, &waveHdr, sizeof(WAVEHDR));
+ self->mWritable.fetch_sub(1, std::memory_order_acq_rel);
+ waveOutWrite(self->mOutHdl, &waveHdr, sizeof(WAVEHDR));
} while(--todo);
- self->Idx = widx;
+ self->mIdx = widx;
}
ALCwinmmPlayback_unlock(self);
@@ -243,32 +243,32 @@ ALCenum ALCwinmmPlayback_open(ALCwinmmPlayback *self, const ALCchar *deviceName)
std::find(PlaybackDevices.cbegin(), PlaybackDevices.cend(), deviceName) :
PlaybackDevices.cbegin();
if(iter == PlaybackDevices.cend()) return ALC_INVALID_VALUE;
- UINT DeviceID{static_cast<UINT>(std::distance(PlaybackDevices.cbegin(), iter))};
+ auto DeviceID = static_cast<UINT>(std::distance(PlaybackDevices.cbegin(), iter));
retry_open:
- self->Format = WAVEFORMATEX{};
+ self->mFormat = WAVEFORMATEX{};
if(device->FmtType == DevFmtFloat)
{
- self->Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
- self->Format.wBitsPerSample = 32;
+ self->mFormat.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
+ self->mFormat.wBitsPerSample = 32;
}
else
{
- self->Format.wFormatTag = WAVE_FORMAT_PCM;
+ self->mFormat.wFormatTag = WAVE_FORMAT_PCM;
if(device->FmtType == DevFmtUByte || device->FmtType == DevFmtByte)
- self->Format.wBitsPerSample = 8;
+ self->mFormat.wBitsPerSample = 8;
else
- self->Format.wBitsPerSample = 16;
+ self->mFormat.wBitsPerSample = 16;
}
- self->Format.nChannels = ((device->FmtChans == DevFmtMono) ? 1 : 2);
- self->Format.nBlockAlign = self->Format.wBitsPerSample *
- self->Format.nChannels / 8;
- self->Format.nSamplesPerSec = device->Frequency;
- self->Format.nAvgBytesPerSec = self->Format.nSamplesPerSec *
- self->Format.nBlockAlign;
- self->Format.cbSize = 0;
-
- MMRESULT res{waveOutOpen(&self->OutHdl, DeviceID, &self->Format,
+ self->mFormat.nChannels = ((device->FmtChans == DevFmtMono) ? 1 : 2);
+ self->mFormat.nBlockAlign = self->mFormat.wBitsPerSample *
+ self->mFormat.nChannels / 8;
+ self->mFormat.nSamplesPerSec = device->Frequency;
+ self->mFormat.nAvgBytesPerSec = self->mFormat.nSamplesPerSec *
+ self->mFormat.nBlockAlign;
+ self->mFormat.cbSize = 0;
+
+ MMRESULT res{waveOutOpen(&self->mOutHdl, DeviceID, &self->mFormat,
(DWORD_PTR)&ALCwinmmPlayback_waveOutProc, (DWORD_PTR)self, CALLBACK_FUNCTION
)};
if(res != MMSYSERR_NOERROR)
@@ -290,67 +290,66 @@ ALCboolean ALCwinmmPlayback_reset(ALCwinmmPlayback *self)
{
ALCdevice *device{self->mDevice};
- device->UpdateSize = (ALuint)((ALuint64)device->UpdateSize *
- self->Format.nSamplesPerSec /
- device->Frequency);
+ device->UpdateSize = static_cast<ALuint>(
+ (ALuint64)device->UpdateSize * self->mFormat.nSamplesPerSec / device->Frequency);
device->UpdateSize = (device->UpdateSize*device->NumUpdates + 3) / 4;
device->NumUpdates = 4;
- device->Frequency = self->Format.nSamplesPerSec;
+ device->Frequency = self->mFormat.nSamplesPerSec;
- if(self->Format.wFormatTag == WAVE_FORMAT_IEEE_FLOAT)
+ if(self->mFormat.wFormatTag == WAVE_FORMAT_IEEE_FLOAT)
{
- if(self->Format.wBitsPerSample == 32)
+ if(self->mFormat.wBitsPerSample == 32)
device->FmtType = DevFmtFloat;
else
{
- ERR("Unhandled IEEE float sample depth: %d\n", self->Format.wBitsPerSample);
+ ERR("Unhandled IEEE float sample depth: %d\n", self->mFormat.wBitsPerSample);
return ALC_FALSE;
}
}
- else if(self->Format.wFormatTag == WAVE_FORMAT_PCM)
+ else if(self->mFormat.wFormatTag == WAVE_FORMAT_PCM)
{
- if(self->Format.wBitsPerSample == 16)
+ if(self->mFormat.wBitsPerSample == 16)
device->FmtType = DevFmtShort;
- else if(self->Format.wBitsPerSample == 8)
+ else if(self->mFormat.wBitsPerSample == 8)
device->FmtType = DevFmtUByte;
else
{
- ERR("Unhandled PCM sample depth: %d\n", self->Format.wBitsPerSample);
+ ERR("Unhandled PCM sample depth: %d\n", self->mFormat.wBitsPerSample);
return ALC_FALSE;
}
}
else
{
- ERR("Unhandled format tag: 0x%04x\n", self->Format.wFormatTag);
+ ERR("Unhandled format tag: 0x%04x\n", self->mFormat.wFormatTag);
return ALC_FALSE;
}
- if(self->Format.nChannels == 2)
+ if(self->mFormat.nChannels == 2)
device->FmtChans = DevFmtStereo;
- else if(self->Format.nChannels == 1)
+ else if(self->mFormat.nChannels == 1)
device->FmtChans = DevFmtMono;
else
{
- ERR("Unhandled channel count: %d\n", self->Format.nChannels);
+ ERR("Unhandled channel count: %d\n", self->mFormat.nChannels);
return ALC_FALSE;
}
SetDefaultWFXChannelOrder(device);
ALuint BufferSize{device->UpdateSize * device->frameSizeFromFmt()};
- al_free(self->WaveBuffer[0].lpData);
- self->WaveBuffer[0] = WAVEHDR{};
- self->WaveBuffer[0].lpData = static_cast<char*>(al_calloc(16,
- BufferSize * self->WaveBuffer.size()));
- self->WaveBuffer[0].dwBufferLength = BufferSize;
- for(size_t i{1};i < self->WaveBuffer.size();i++)
+ al_free(self->mWaveBuffer[0].lpData);
+ self->mWaveBuffer[0] = WAVEHDR{};
+ self->mWaveBuffer[0].lpData = static_cast<char*>(al_calloc(16,
+ BufferSize * self->mWaveBuffer.size()));
+ self->mWaveBuffer[0].dwBufferLength = BufferSize;
+ for(size_t i{1};i < self->mWaveBuffer.size();i++)
{
- self->WaveBuffer[i] = WAVEHDR{};
- self->WaveBuffer[i].lpData = self->WaveBuffer[i-1].lpData +
- self->WaveBuffer[i-1].dwBufferLength;
- self->WaveBuffer[i].dwBufferLength = BufferSize;
+ self->mWaveBuffer[i] = WAVEHDR{};
+ self->mWaveBuffer[i].lpData = self->mWaveBuffer[i-1].lpData +
+ self->mWaveBuffer[i-1].dwBufferLength;
+ self->mWaveBuffer[i].dwBufferLength = BufferSize;
}
- self->Idx = 0;
+ self->mIdx = 0;
return ALC_TRUE;
}
@@ -358,11 +357,11 @@ ALCboolean ALCwinmmPlayback_reset(ALCwinmmPlayback *self)
ALCboolean ALCwinmmPlayback_start(ALCwinmmPlayback *self)
{
try {
- std::for_each(self->WaveBuffer.begin(), self->WaveBuffer.end(),
+ std::for_each(self->mWaveBuffer.begin(), self->mWaveBuffer.end(),
[self](WAVEHDR &waveHdr) -> void
- { waveOutPrepareHeader(self->OutHdl, &waveHdr, static_cast<UINT>(sizeof(WAVEHDR))); }
+ { waveOutPrepareHeader(self->mOutHdl, &waveHdr, static_cast<UINT>(sizeof(WAVEHDR))); }
);
- self->Writable.store(static_cast<ALuint>(self->WaveBuffer.size()),
+ self->mWritable.store(static_cast<ALuint>(self->mWaveBuffer.size()),
std::memory_order_release);
self->mKillNow.store(AL_FALSE, std::memory_order_release);
@@ -383,27 +382,27 @@ void ALCwinmmPlayback_stop(ALCwinmmPlayback *self)
return;
self->mThread.join();
- while(self->Writable.load(std::memory_order_acquire) < self->WaveBuffer.size())
- self->Sem.wait();
- std::for_each(self->WaveBuffer.begin(), self->WaveBuffer.end(),
+ while(self->mWritable.load(std::memory_order_acquire) < self->mWaveBuffer.size())
+ self->mSem.wait();
+ std::for_each(self->mWaveBuffer.begin(), self->mWaveBuffer.end(),
[self](WAVEHDR &waveHdr) -> void
- { waveOutUnprepareHeader(self->OutHdl, &waveHdr, sizeof(WAVEHDR)); }
+ { waveOutUnprepareHeader(self->mOutHdl, &waveHdr, sizeof(WAVEHDR)); }
);
- self->Writable.store(0, std::memory_order_release);
+ self->mWritable.store(0, std::memory_order_release);
}
struct ALCwinmmCapture final : public ALCbackend {
- std::atomic<ALuint> Readable{0u};
- al::semaphore Sem;
- int Idx{0};
- std::array<WAVEHDR,4> WaveBuffer;
+ std::atomic<ALuint> mReadable{0u};
+ al::semaphore mSem;
+ int mIdx{0};
+ std::array<WAVEHDR,4> mWaveBuffer{};
- HWAVEIN InHdl{nullptr};
+ HWAVEIN mInHdl{nullptr};
- RingBufferPtr Ring{nullptr};
+ RingBufferPtr mRing{nullptr};
- WAVEFORMATEX Format{};
+ WAVEFORMATEX mFormat{};
std::atomic<ALenum> mKillNow{AL_TRUE};
std::thread mThread;
@@ -435,19 +434,17 @@ void ALCwinmmCapture_Construct(ALCwinmmCapture *self, ALCdevice *device)
{
new (self) ALCwinmmCapture{device};
SET_VTABLE2(ALCwinmmCapture, ALCbackend, self);
-
- std::fill(self->WaveBuffer.begin(), self->WaveBuffer.end(), WAVEHDR{});
}
void ALCwinmmCapture_Destruct(ALCwinmmCapture *self)
{
// Close the Wave device
- if(self->InHdl)
- waveInClose(self->InHdl);
- self->InHdl = nullptr;
+ if(self->mInHdl)
+ waveInClose(self->mInHdl);
+ self->mInHdl = nullptr;
- al_free(self->WaveBuffer[0].lpData);
- std::fill(self->WaveBuffer.begin(), self->WaveBuffer.end(), WAVEHDR{});
+ al_free(self->mWaveBuffer[0].lpData);
+ std::fill(self->mWaveBuffer.begin(), self->mWaveBuffer.end(), WAVEHDR{});
self->~ALCwinmmCapture();
}
@@ -466,14 +463,14 @@ void CALLBACK ALCwinmmCapture_waveInProc(HWAVEIN UNUSED(device), UINT msg,
return;
auto self = reinterpret_cast<ALCwinmmCapture*>(instance);
- self->Readable.fetch_add(1, std::memory_order_acq_rel);
- self->Sem.post();
+ self->mReadable.fetch_add(1, std::memory_order_acq_rel);
+ self->mSem.post();
}
int ALCwinmmCapture_captureProc(ALCwinmmCapture *self)
{
ALCdevice *device{self->mDevice};
- RingBuffer *ring{self->Ring.get()};
+ RingBuffer *ring{self->mRing.get()};
althrd_setname(RECORD_THREAD_NAME);
@@ -481,25 +478,25 @@ int ALCwinmmCapture_captureProc(ALCwinmmCapture *self)
while(!self->mKillNow.load(std::memory_order_acquire) &&
device->Connected.load(std::memory_order_acquire))
{
- ALsizei todo = self->Readable.load(std::memory_order_acquire);
+ ALuint todo{self->mReadable.load(std::memory_order_acquire)};
if(todo < 1)
{
ALCwinmmCapture_unlock(self);
- self->Sem.wait();
+ self->mSem.wait();
ALCwinmmCapture_lock(self);
continue;
}
- int widx{self->Idx};
+ int widx{self->mIdx};
do {
- WAVEHDR &waveHdr = self->WaveBuffer[widx];
- widx = (widx+1) % self->WaveBuffer.size();
+ WAVEHDR &waveHdr = self->mWaveBuffer[widx];
+ widx = (widx+1) % self->mWaveBuffer.size();
- ring->write(waveHdr.lpData, waveHdr.dwBytesRecorded / self->Format.nBlockAlign);
- self->Readable.fetch_sub(1, std::memory_order_acq_rel);
- waveInAddBuffer(self->InHdl, &waveHdr, sizeof(WAVEHDR));
+ ring->write(waveHdr.lpData, waveHdr.dwBytesRecorded / self->mFormat.nBlockAlign);
+ self->mReadable.fetch_sub(1, std::memory_order_acq_rel);
+ waveInAddBuffer(self->mInHdl, &waveHdr, sizeof(WAVEHDR));
} while(--todo);
- self->Idx = widx;
+ self->mIdx = widx;
}
ALCwinmmCapture_unlock(self);
@@ -519,7 +516,7 @@ ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *deviceName)
std::find(CaptureDevices.cbegin(), CaptureDevices.cend(), deviceName) :
CaptureDevices.cbegin();
if(iter == CaptureDevices.cend()) return ALC_INVALID_VALUE;
- UINT DeviceID{static_cast<UINT>(std::distance(CaptureDevices.cbegin(), iter))};
+ auto DeviceID = static_cast<UINT>(std::distance(CaptureDevices.cbegin(), iter));
switch(device->FmtChans)
{
@@ -550,19 +547,19 @@ ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *deviceName)
return ALC_INVALID_ENUM;
}
- self->Format = WAVEFORMATEX{};
- self->Format.wFormatTag = (device->FmtType == DevFmtFloat) ?
- WAVE_FORMAT_IEEE_FLOAT : WAVE_FORMAT_PCM;
- self->Format.nChannels = device->channelsFromFmt();
- self->Format.wBitsPerSample = device->bytesFromFmt() * 8;
- self->Format.nBlockAlign = self->Format.wBitsPerSample *
- self->Format.nChannels / 8;
- self->Format.nSamplesPerSec = device->Frequency;
- self->Format.nAvgBytesPerSec = self->Format.nSamplesPerSec *
- self->Format.nBlockAlign;
- self->Format.cbSize = 0;
-
- MMRESULT res{waveInOpen(&self->InHdl, DeviceID, &self->Format,
+ self->mFormat = WAVEFORMATEX{};
+ self->mFormat.wFormatTag = (device->FmtType == DevFmtFloat) ?
+ WAVE_FORMAT_IEEE_FLOAT : WAVE_FORMAT_PCM;
+ self->mFormat.nChannels = device->channelsFromFmt();
+ self->mFormat.wBitsPerSample = device->bytesFromFmt() * 8;
+ self->mFormat.nBlockAlign = self->mFormat.wBitsPerSample *
+ self->mFormat.nChannels / 8;
+ self->mFormat.nSamplesPerSec = device->Frequency;
+ self->mFormat.nAvgBytesPerSec = self->mFormat.nSamplesPerSec *
+ self->mFormat.nBlockAlign;
+ self->mFormat.cbSize = 0;
+
+ MMRESULT res{waveInOpen(&self->mInHdl, DeviceID, &self->mFormat,
(DWORD_PTR)&ALCwinmmCapture_waveInProc, (DWORD_PTR)self, CALLBACK_FUNCTION
)};
if(res != MMSYSERR_NOERROR)
@@ -572,28 +569,28 @@ ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *deviceName)
}
// Ensure each buffer is 50ms each
- DWORD BufferSize{self->Format.nAvgBytesPerSec / 20};
- BufferSize -= (BufferSize % self->Format.nBlockAlign);
+ DWORD BufferSize{self->mFormat.nAvgBytesPerSec / 20u};
+ BufferSize -= (BufferSize % self->mFormat.nBlockAlign);
// Allocate circular memory buffer for the captured audio
// Make sure circular buffer is at least 100ms in size
- auto CapturedDataSize = static_cast<DWORD>(
- std::max<size_t>(device->UpdateSize*device->NumUpdates, BufferSize*self->WaveBuffer.size())
- );
-
- self->Ring = CreateRingBuffer(CapturedDataSize, self->Format.nBlockAlign, false);
- if(!self->Ring) return ALC_INVALID_VALUE;
-
- al_free(self->WaveBuffer[0].lpData);
- self->WaveBuffer[0] = WAVEHDR{};
- self->WaveBuffer[0].lpData = static_cast<char*>(al_calloc(16, BufferSize*4));
- self->WaveBuffer[0].dwBufferLength = BufferSize;
- for(size_t i{1};i < self->WaveBuffer.size();++i)
+ ALuint CapturedDataSize{device->UpdateSize*device->NumUpdates};
+ CapturedDataSize = static_cast<ALuint>(
+ std::max<size_t>(CapturedDataSize, BufferSize*self->mWaveBuffer.size()));
+
+ self->mRing = CreateRingBuffer(CapturedDataSize, self->mFormat.nBlockAlign, false);
+ if(!self->mRing) return ALC_INVALID_VALUE;
+
+ al_free(self->mWaveBuffer[0].lpData);
+ self->mWaveBuffer[0] = WAVEHDR{};
+ self->mWaveBuffer[0].lpData = static_cast<char*>(al_calloc(16, BufferSize*4));
+ self->mWaveBuffer[0].dwBufferLength = BufferSize;
+ for(size_t i{1};i < self->mWaveBuffer.size();++i)
{
- self->WaveBuffer[i] = WAVEHDR{};
- self->WaveBuffer[i].lpData = self->WaveBuffer[i-1].lpData +
- self->WaveBuffer[i-1].dwBufferLength;
- self->WaveBuffer[i].dwBufferLength = self->WaveBuffer[i-1].dwBufferLength;
+ self->mWaveBuffer[i] = WAVEHDR{};
+ self->mWaveBuffer[i].lpData = self->mWaveBuffer[i-1].lpData +
+ self->mWaveBuffer[i-1].dwBufferLength;
+ self->mWaveBuffer[i].dwBufferLength = self->mWaveBuffer[i-1].dwBufferLength;
}
device->DeviceName = CaptureDevices[DeviceID];
@@ -603,16 +600,16 @@ ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *deviceName)
ALCboolean ALCwinmmCapture_start(ALCwinmmCapture *self)
{
try {
- for(size_t i{0};i < self->WaveBuffer.size();++i)
+ for(size_t i{0};i < self->mWaveBuffer.size();++i)
{
- waveInPrepareHeader(self->InHdl, &self->WaveBuffer[i], sizeof(WAVEHDR));
- waveInAddBuffer(self->InHdl, &self->WaveBuffer[i], sizeof(WAVEHDR));
+ waveInPrepareHeader(self->mInHdl, &self->mWaveBuffer[i], sizeof(WAVEHDR));
+ waveInAddBuffer(self->mInHdl, &self->mWaveBuffer[i], sizeof(WAVEHDR));
}
self->mKillNow.store(AL_FALSE, std::memory_order_release);
self->mThread = std::thread(ALCwinmmCapture_captureProc, self);
- waveInStart(self->InHdl);
+ waveInStart(self->mInHdl);
return ALC_TRUE;
}
catch(std::exception& e) {
@@ -625,33 +622,33 @@ ALCboolean ALCwinmmCapture_start(ALCwinmmCapture *self)
void ALCwinmmCapture_stop(ALCwinmmCapture *self)
{
- waveInStop(self->InHdl);
+ waveInStop(self->mInHdl);
self->mKillNow.store(AL_TRUE, std::memory_order_release);
if(self->mThread.joinable())
{
- self->Sem.post();
+ self->mSem.post();
self->mThread.join();
}
- waveInReset(self->InHdl);
- for(size_t i{0};i < self->WaveBuffer.size();++i)
- waveInUnprepareHeader(self->InHdl, &self->WaveBuffer[i], sizeof(WAVEHDR));
+ waveInReset(self->mInHdl);
+ for(size_t i{0};i < self->mWaveBuffer.size();++i)
+ waveInUnprepareHeader(self->mInHdl, &self->mWaveBuffer[i], sizeof(WAVEHDR));
- self->Readable.store(0, std::memory_order_release);
- self->Idx = 0;
+ self->mReadable.store(0, std::memory_order_release);
+ self->mIdx = 0;
}
ALCenum ALCwinmmCapture_captureSamples(ALCwinmmCapture *self, ALCvoid *buffer, ALCuint samples)
{
- RingBuffer *ring{self->Ring.get()};
+ RingBuffer *ring{self->mRing.get()};
ring->read(buffer, samples);
return ALC_NO_ERROR;
}
ALCuint ALCwinmmCapture_availableSamples(ALCwinmmCapture *self)
{
- RingBuffer *ring{self->Ring.get()};
+ RingBuffer *ring{self->mRing.get()};
return (ALCuint)ring->readSpace();
}