aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-12-30 21:38:42 -0800
committerChris Robinson <[email protected]>2018-12-30 21:38:42 -0800
commit9f5c9a2260849240bd680b8fdf533acdef7f9de1 (patch)
treed7e1c5873e323e7edcd96c1a2a037ea18063501c /Alc/backends
parent3df1d185f8bcf8d470249594a15d0e781a705ca2 (diff)
Rename BackendLock to StateLock
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/alsa.cpp4
-rw-r--r--Alc/backends/dsound.cpp6
-rw-r--r--Alc/backends/jack.cpp3
-rw-r--r--Alc/backends/opensl.cpp4
-rw-r--r--Alc/backends/oss.cpp4
-rw-r--r--Alc/backends/sndio.cpp4
-rw-r--r--Alc/backends/wasapi.cpp10
-rw-r--r--Alc/backends/wave.cpp2
8 files changed, 1 insertions, 36 deletions
diff --git a/Alc/backends/alsa.cpp b/Alc/backends/alsa.cpp
index 43336026..a3c30732 100644
--- a/Alc/backends/alsa.cpp
+++ b/Alc/backends/alsa.cpp
@@ -469,9 +469,7 @@ int AlsaPlayback::mixerProc()
if(state < 0)
{
ERR("Invalid state detected: %s\n", snd_strerror(state));
- lock();
aluHandleDisconnect(mDevice, "Bad state: %s", snd_strerror(state));
- unlock();
break;
}
@@ -554,9 +552,7 @@ int AlsaPlayback::mixerNoMMapProc()
if(state < 0)
{
ERR("Invalid state detected: %s\n", snd_strerror(state));
- lock();
aluHandleDisconnect(mDevice, "Bad state: %s", snd_strerror(state));
- unlock();
break;
}
diff --git a/Alc/backends/dsound.cpp b/Alc/backends/dsound.cpp
index b7424473..4138c180 100644
--- a/Alc/backends/dsound.cpp
+++ b/Alc/backends/dsound.cpp
@@ -241,9 +241,7 @@ FORCE_ALIGN int DSoundPlayback::mixerProc()
if(FAILED(err))
{
ERR("Failed to get buffer caps: 0x%lx\n", err);
- lock();
aluHandleDisconnect(mDevice, "Failure retrieving playback buffer info: 0x%lx", err);
- unlock();
return 1;
}
@@ -269,9 +267,7 @@ FORCE_ALIGN int DSoundPlayback::mixerProc()
if(FAILED(err))
{
ERR("Failed to play buffer: 0x%lx\n", err);
- lock();
aluHandleDisconnect(mDevice, "Failure starting playback: 0x%lx", err);
- unlock();
return 1;
}
Playing = true;
@@ -316,9 +312,7 @@ FORCE_ALIGN int DSoundPlayback::mixerProc()
else
{
ERR("Buffer lock error: %#lx\n", err);
- lock();
aluHandleDisconnect(mDevice, "Failed to lock output buffer: 0x%lx", err);
- unlock();
return 1;
}
diff --git a/Alc/backends/jack.cpp b/Alc/backends/jack.cpp
index 5ac0ff4d..78de2699 100644
--- a/Alc/backends/jack.cpp
+++ b/Alc/backends/jack.cpp
@@ -200,7 +200,7 @@ int JackPlayback::bufferSizeNotifyC(jack_nframes_t numframes, void *arg)
int JackPlayback::bufferSizeNotify(jack_nframes_t numframes)
{
- lock();
+ std::lock_guard<std::mutex> _{mDevice->StateLock};
mDevice->UpdateSize = numframes;
mDevice->NumUpdates = 2;
@@ -218,7 +218,6 @@ int JackPlayback::bufferSizeNotify(jack_nframes_t numframes)
ERR("Failed to reallocate ringbuffer\n");
aluHandleDisconnect(mDevice, "Failed to reallocate %u-sample buffer", bufsize);
}
- unlock();
return 0;
}
diff --git a/Alc/backends/opensl.cpp b/Alc/backends/opensl.cpp
index 66bc6e8d..766b7675 100644
--- a/Alc/backends/opensl.cpp
+++ b/Alc/backends/opensl.cpp
@@ -839,9 +839,7 @@ ALCboolean OpenSLCapture::start()
if(SL_RESULT_SUCCESS != result)
{
- lock();
aluHandleDisconnect(mDevice, "Failed to start capture: 0x%08x", result);
- unlock();
return ALC_FALSE;
}
@@ -904,9 +902,7 @@ ALCenum OpenSLCapture::captureSamples(void* buffer, ALCuint samples)
if(SL_RESULT_SUCCESS != result)
{
- lock();
aluHandleDisconnect(mDevice, "Failed to update capture buffer: 0x%08x", result);
- unlock();
return ALC_INVALID_DEVICE;
}
diff --git a/Alc/backends/oss.cpp b/Alc/backends/oss.cpp
index c18a1d86..b5640ae3 100644
--- a/Alc/backends/oss.cpp
+++ b/Alc/backends/oss.cpp
@@ -520,9 +520,7 @@ int OSScapture::recordProc()
if(errno == EINTR || errno == EAGAIN)
continue;
ERR("poll failed: %s\n", strerror(errno));
- lock();
aluHandleDisconnect(mDevice, "Failed to check capture samples: %s", strerror(errno));
- unlock();
break;
}
else if(sret == 0)
@@ -538,10 +536,8 @@ int OSScapture::recordProc()
if(amt < 0)
{
ERR("read failed: %s\n", strerror(errno));
- lock();
aluHandleDisconnect(mDevice, "Failed reading capture samples: %s",
strerror(errno));
- unlock();
break;
}
mRing->writeAdvance(amt/frame_size);
diff --git a/Alc/backends/sndio.cpp b/Alc/backends/sndio.cpp
index 5d74dd5a..c75eebee 100644
--- a/Alc/backends/sndio.cpp
+++ b/Alc/backends/sndio.cpp
@@ -94,9 +94,7 @@ int SndioPlayback::mixerProc()
if(wrote == 0)
{
ERR("sio_write failed\n");
- lock();
aluHandleDisconnect(mDevice, "Failed to write playback samples");
- unlock();
break;
}
@@ -308,9 +306,7 @@ int SndioCapture::recordProc()
size_t got{sio_read(mSndHandle, data.first.buf, minz(todo-total, data.first.len))};
if(!got)
{
- lock();
aluHandleDisconnect(mDevice, "Failed to read capture samples");
- unlock();
break;
}
diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp
index cb0b665b..d221565c 100644
--- a/Alc/backends/wasapi.cpp
+++ b/Alc/backends/wasapi.cpp
@@ -560,9 +560,7 @@ FORCE_ALIGN int WasapiPlayback::mixerProc()
if(FAILED(hr))
{
ERR("CoInitializeEx(nullptr, COINIT_MULTITHREADED) failed: 0x%08lx\n", hr);
- lock();
aluHandleDisconnect(mDevice, "COM init failed: 0x%08lx", hr);
- unlock();
return 1;
}
@@ -578,9 +576,7 @@ FORCE_ALIGN int WasapiPlayback::mixerProc()
if(FAILED(hr))
{
ERR("Failed to get padding: 0x%08lx\n", hr);
- lock();
aluHandleDisconnect(mDevice, "Failed to retrieve buffer padding: 0x%08lx", hr);
- unlock();
break;
}
mPadding.store(written, std::memory_order_relaxed);
@@ -608,9 +604,7 @@ FORCE_ALIGN int WasapiPlayback::mixerProc()
if(FAILED(hr))
{
ERR("Failed to buffer data: 0x%08lx\n", hr);
- lock();
aluHandleDisconnect(mDevice, "Failed to send playback samples: 0x%08lx", hr);
- unlock();
break;
}
}
@@ -1194,9 +1188,7 @@ FORCE_ALIGN int WasapiCapture::recordProc()
if(FAILED(hr))
{
ERR("CoInitializeEx(nullptr, COINIT_MULTITHREADED) failed: 0x%08lx\n", hr);
- lock();
aluHandleDisconnect(mDevice, "COM init failed: 0x%08lx", hr);
- unlock();
return 1;
}
@@ -1268,9 +1260,7 @@ FORCE_ALIGN int WasapiCapture::recordProc()
if(FAILED(hr))
{
- lock();
aluHandleDisconnect(mDevice, "Failed to capture samples: 0x%08lx", hr);
- unlock();
break;
}
diff --git a/Alc/backends/wave.cpp b/Alc/backends/wave.cpp
index 49d4a735..36adce95 100644
--- a/Alc/backends/wave.cpp
+++ b/Alc/backends/wave.cpp
@@ -172,9 +172,7 @@ int WaveBackend::mixerProc()
if(ferror(mFile))
{
ERR("Error writing to file\n");
- lock();
aluHandleDisconnect(mDevice, "Failed to write playback samples");
- unlock();
break;
}
}