aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/alsa.cpp4
-rw-r--r--Alc/backends/coreaudio.cpp8
-rw-r--r--Alc/backends/dsound.cpp4
-rw-r--r--Alc/backends/jack.cpp4
-rw-r--r--Alc/backends/opensl.cpp8
-rw-r--r--Alc/backends/oss.cpp3
-rw-r--r--Alc/backends/portaudio.cpp2
-rw-r--r--Alc/backends/sndio.cpp3
-rw-r--r--Alc/backends/wasapi.cpp33
-rw-r--r--Alc/backends/winmm.cpp2
10 files changed, 31 insertions, 40 deletions
diff --git a/Alc/backends/alsa.cpp b/Alc/backends/alsa.cpp
index c0ceb4f7..97b2e965 100644
--- a/Alc/backends/alsa.cpp
+++ b/Alc/backends/alsa.cpp
@@ -1065,8 +1065,8 @@ ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name)
if(needring)
{
- self->mRing.reset(ll_ringbuffer_create(device->UpdateSize*device->NumUpdates,
- device->frameSizeFromFmt(), false));
+ self->mRing = CreateRingBuffer(device->UpdateSize*device->NumUpdates,
+ device->frameSizeFromFmt(), false);
if(!self->mRing)
{
ERR("ring buffer create failed\n");
diff --git a/Alc/backends/coreaudio.cpp b/Alc/backends/coreaudio.cpp
index c0b6601b..8f4a8d2a 100644
--- a/Alc/backends/coreaudio.cpp
+++ b/Alc/backends/coreaudio.cpp
@@ -321,7 +321,7 @@ struct ALCcoreAudioCapture final : public ALCbackend {
ALuint mFrameSize{0u};
AudioStreamBasicDescription mFormat{}; // This is the OpenAL format as a CoreAudio ASBD
- std::unique_ptr<SampleConverter> mConverter;
+ SampleConverterPtr mConverter;
RingBufferPtr mRing{nullptr};
};
@@ -633,11 +633,11 @@ static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar
// Set up sample converter if needed
if(outputFormat.mSampleRate != device->Frequency)
- self->mConverter.reset(CreateSampleConverter(device->FmtType, device->FmtType,
+ self->mConverter = CreateSampleConverter(device->FmtType, device->FmtType,
self->mFormat.mChannelsPerFrame, hardwareFormat.mSampleRate, device->Frequency,
- BSinc24Resampler));
+ BSinc24Resampler);
- self->mRing.reset(ll_ringbuffer_create(outputFrameCount, self->mFrameSize, false));
+ self->mRing = CreateRingBuffer(outputFrameCount, self->mFrameSize, false);
if(!self->mRing) return ALC_INVALID_VALUE;
device->DeviceName = name;
diff --git a/Alc/backends/dsound.cpp b/Alc/backends/dsound.cpp
index 516a7770..a1493fa8 100644
--- a/Alc/backends/dsound.cpp
+++ b/Alc/backends/dsound.cpp
@@ -835,8 +835,8 @@ ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *deviceName)
self->DSC->CreateCaptureBuffer(&DSCBDescription, &self->DSCbuffer, nullptr);
if(SUCCEEDED(hr))
{
- self->Ring.reset(ll_ringbuffer_create(device->UpdateSize*device->NumUpdates,
- InputType.Format.nBlockAlign, false));
+ self->Ring = CreateRingBuffer(device->UpdateSize*device->NumUpdates,
+ InputType.Format.nBlockAlign, false);
if(!self->Ring) hr = DSERR_OUTOFMEMORY;
}
diff --git a/Alc/backends/jack.cpp b/Alc/backends/jack.cpp
index 02e29973..ca537323 100644
--- a/Alc/backends/jack.cpp
+++ b/Alc/backends/jack.cpp
@@ -222,7 +222,7 @@ int ALCjackPlayback_bufferSizeNotify(jack_nframes_t numframes, void *arg)
TRACE("%u update size x%u\n", device->UpdateSize, device->NumUpdates);
self->mRing = nullptr;
- self->mRing.reset(ll_ringbuffer_create(bufsize, device->frameSizeFromFmt(), true));
+ self->mRing = CreateRingBuffer(bufsize, device->frameSizeFromFmt(), true);
if(!self->mRing)
{
ERR("Failed to reallocate ringbuffer\n");
@@ -431,7 +431,7 @@ ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self)
}
self->mRing = nullptr;
- self->mRing.reset(ll_ringbuffer_create(bufsize, device->frameSizeFromFmt(), true));
+ self->mRing = CreateRingBuffer(bufsize, device->frameSizeFromFmt(), true);
if(!self->mRing)
{
ERR("Failed to allocate ringbuffer\n");
diff --git a/Alc/backends/opensl.cpp b/Alc/backends/opensl.cpp
index 872fbc91..e1a0faa6 100644
--- a/Alc/backends/opensl.cpp
+++ b/Alc/backends/opensl.cpp
@@ -534,8 +534,8 @@ static ALCboolean ALCopenslPlayback_reset(ALCopenslPlayback *self)
}
if(SL_RESULT_SUCCESS == result)
{
- self->mRing.reset(ll_ringbuffer_create(device->NumUpdates,
- self->mFrameSize*device->UpdateSize, true));
+ self->mRing = CreateRingBuffer(device->NumUpdates,
+ self->mFrameSize*device->UpdateSize, true);
if(!self->mRing)
{
ERR("Out of memory allocating ring buffer %ux%u %u\n", device->UpdateSize,
@@ -826,8 +826,8 @@ static ALCenum ALCopenslCapture_open(ALCopenslCapture *self, const ALCchar *name
if(SL_RESULT_SUCCESS == result)
{
- self->mRing.reset(ll_ringbuffer_create(device->NumUpdates,
- device->UpdateSize*self->mFrameSize, false));
+ self->mRing = CreateRingBuffer(device->NumUpdates,
+ device->UpdateSize*self->mFrameSize, false);
result = VCALL(self->mRecordObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE,
&bufferQueue);
diff --git a/Alc/backends/oss.cpp b/Alc/backends/oss.cpp
index f6a75d12..ec9028eb 100644
--- a/Alc/backends/oss.cpp
+++ b/Alc/backends/oss.cpp
@@ -683,8 +683,7 @@ ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name)
return ALC_INVALID_VALUE;
}
- self->mRing.reset(ll_ringbuffer_create(device->UpdateSize*device->NumUpdates, frameSize,
- false));
+ self->mRing = CreateRingBuffer(device->UpdateSize*device->NumUpdates, frameSize, false);
if(!self->mRing)
{
ERR("Ring buffer create failed\n");
diff --git a/Alc/backends/portaudio.cpp b/Alc/backends/portaudio.cpp
index f39661a7..354389c3 100644
--- a/Alc/backends/portaudio.cpp
+++ b/Alc/backends/portaudio.cpp
@@ -387,7 +387,7 @@ ALCenum ALCportCapture_open(ALCportCapture *self, const ALCchar *name)
samples = maxu(samples, 100 * device->Frequency / 1000);
frame_size = device->frameSizeFromFmt();
- self->Ring.reset(ll_ringbuffer_create(samples, frame_size, false));
+ self->Ring = CreateRingBuffer(samples, frame_size, false);
if(!self->Ring) return ALC_INVALID_VALUE;
self->Params.device = -1;
diff --git a/Alc/backends/sndio.cpp b/Alc/backends/sndio.cpp
index 887b5703..027ff9f2 100644
--- a/Alc/backends/sndio.cpp
+++ b/Alc/backends/sndio.cpp
@@ -465,8 +465,7 @@ static ALCenum SndioCapture_open(SndioCapture *self, const ALCchar *name)
return ALC_INVALID_VALUE;
}
- self->ring.reset(ll_ringbuffer_create(device->UpdateSize*device->NumUpdates,
- par.bps*par.rchan, false));
+ self->ring = CreateRingBuffer(device->UpdateSize*device->NumUpdates, par.bps*par.rchan, false);
if(!self->ring)
{
ERR("Failed to allocate %u-byte ringbuffer\n",
diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp
index e1783ef9..a7524ce1 100644
--- a/Alc/backends/wasapi.cpp
+++ b/Alc/backends/wasapi.cpp
@@ -1170,9 +1170,9 @@ struct ALCwasapiCapture final : public ALCbackend, WasapiProxy {
HANDLE mMsgEvent{nullptr};
- ChannelConverter *mChannelConv{nullptr};
- SampleConverter *mSampleConv{nullptr};
- RingBufferPtr mRing{nullptr};
+ ChannelConverterPtr mChannelConv;
+ SampleConverterPtr mSampleConv;
+ RingBufferPtr mRing;
std::atomic<int> mKillNow{AL_TRUE};
std::thread mThread;
@@ -1220,9 +1220,6 @@ void ALCwasapiCapture_Destruct(ALCwasapiCapture *self)
CloseHandle(self->mNotifyEvent);
self->mNotifyEvent = nullptr;
- DestroySampleConverter(&self->mSampleConv);
- DestroyChannelConverter(&self->mChannelConv);
-
ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
self->~ALCwasapiCapture();
}
@@ -1266,35 +1263,31 @@ FORCE_ALIGN int ALCwasapiCapture_recordProc(ALCwasapiCapture *self)
ERR("Failed to get capture buffer: 0x%08lx\n", hr);
else
{
- if(self->mChannelConv)
+ if(ChannelConverter *conv{self->mChannelConv.get()})
{
samples.resize(numsamples*2);
- ChannelConverterInput(self->mChannelConv, rdata, samples.data(), numsamples);
+ ChannelConverterInput(conv, rdata, samples.data(), numsamples);
rdata = reinterpret_cast<BYTE*>(samples.data());
}
auto data = ring->getWriteVector();
size_t dstframes;
- if(self->mSampleConv)
+ if(SampleConverter *conv{self->mSampleConv.get()})
{
const ALvoid *srcdata = rdata;
ALsizei srcframes = numsamples;
- dstframes = SampleConverterInput(self->mSampleConv,
- &srcdata, &srcframes, data.first.buf,
- (ALsizei)minz(data.first.len, INT_MAX)
- );
+ dstframes = SampleConverterInput(conv, &srcdata, &srcframes, data.first.buf,
+ (ALsizei)minz(data.first.len, INT_MAX));
if(srcframes > 0 && dstframes == data.first.len && data.second.len > 0)
{
/* If some source samples remain, all of the first dest
* block was filled, and there's space in the second
* dest block, do another run for the second block.
*/
- dstframes += SampleConverterInput(self->mSampleConv,
- &srcdata, &srcframes, data.second.buf,
- (ALsizei)minz(data.second.len, INT_MAX)
- );
+ dstframes += SampleConverterInput(conv, &srcdata, &srcframes,
+ data.second.buf, (ALsizei)minz(data.second.len, INT_MAX));
}
}
else
@@ -1576,8 +1569,8 @@ HRESULT ALCwasapiCapture::resetProxy()
return hr;
}
- DestroySampleConverter(&mSampleConv);
- DestroyChannelConverter(&mChannelConv);
+ mSampleConv = nullptr;
+ mChannelConv = nullptr;
if(wfx != nullptr)
{
@@ -1694,7 +1687,7 @@ HRESULT ALCwasapiCapture::resetProxy()
}
buffer_len = maxu(device->UpdateSize*device->NumUpdates, buffer_len);
- mRing.reset(ll_ringbuffer_create(buffer_len, device->frameSizeFromFmt(), false));
+ mRing = CreateRingBuffer(buffer_len, device->frameSizeFromFmt(), false);
if(!mRing)
{
ERR("Failed to allocate capture ring buffer\n");
diff --git a/Alc/backends/winmm.cpp b/Alc/backends/winmm.cpp
index 7bfb7f6c..485586f6 100644
--- a/Alc/backends/winmm.cpp
+++ b/Alc/backends/winmm.cpp
@@ -581,7 +581,7 @@ ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *deviceName)
std::max<size_t>(device->UpdateSize*device->NumUpdates, BufferSize*self->WaveBuffer.size())
);
- self->Ring.reset(ll_ringbuffer_create(CapturedDataSize, self->Format.nBlockAlign, false));
+ self->Ring = CreateRingBuffer(CapturedDataSize, self->Format.nBlockAlign, false);
if(!self->Ring) return ALC_INVALID_VALUE;
al_free(self->WaveBuffer[0].lpData);