Commit 6a09fb9c authored by David Reid's avatar David Reid

Fix non-Windows builds.

parent a6ec466e
......@@ -22367,12 +22367,10 @@ static ma_result ma_device_reroute__wasapi(ma_device* pDevice, ma_device_type de
return MA_SUCCESS;
}
static ma_result ma_device_start__wasapi(ma_device* pDevice)
static ma_result ma_device_start__wasapi_nolock(ma_device* pDevice)
{
HRESULT hr;
MA_ASSERT(pDevice != NULL);
if (pDevice->pContext->wasapi.hAvrt) {
LPCWSTR pTaskName = ma_to_usage_string__wasapi(pDevice->wasapi.usage);
if (pTaskName) {
......@@ -22404,7 +22402,23 @@ static ma_result ma_device_start__wasapi(ma_device* pDevice)
return MA_SUCCESS;
}
static ma_result ma_device_stop__wasapi(ma_device* pDevice)
static ma_result ma_device_start__wasapi(ma_device* pDevice)
{
ma_result result;
MA_ASSERT(pDevice != NULL);
/* Wait for any rerouting to finish before attempting to start the device. */
ma_mutex_lock(&pDevice->wasapi.rerouteLock);
{
result = ma_device_start__wasapi_nolock(pDevice);
}
ma_mutex_unlock(&pDevice->wasapi.rerouteLock);
return result;
}
static ma_result ma_device_stop__wasapi_nolock(ma_device* pDevice)
{
ma_result result;
HRESULT hr;
......@@ -22452,7 +22466,8 @@ static ma_result ma_device_stop__wasapi(ma_device* pDevice)
if (pDevice->playback.shareMode == ma_share_mode_exclusive) {
WaitForSingleObject(pDevice->wasapi.hEventPlayback, waitTime);
} else {
}
else {
ma_uint32 prevFramesAvaialablePlayback = (ma_uint32)-1;
ma_uint32 framesAvailablePlayback;
for (;;) {
......@@ -22506,6 +22521,22 @@ static ma_result ma_device_stop__wasapi(ma_device* pDevice)
return MA_SUCCESS;
}
static ma_result ma_device_stop__wasapi(ma_device* pDevice)
{
ma_result result;
MA_ASSERT(pDevice != NULL);
/* Wait for any rerouting to finish before attempting to stop the device. */
ma_mutex_lock(&pDevice->wasapi.rerouteLock);
{
result = ma_device_stop__wasapi_nolock(pDevice);
}
ma_mutex_unlock(&pDevice->wasapi.rerouteLock);
return result;
}
#ifndef MA_WASAPI_WAIT_TIMEOUT_MILLISECONDS
#define MA_WASAPI_WAIT_TIMEOUT_MILLISECONDS 5000
......@@ -41182,9 +41213,6 @@ MA_API ma_result ma_device_start(ma_device* pDevice)
return MA_SUCCESS; /* Already started. */
}
/* Wait for any rerouting to finish before attempting to start the device. */
ma_mutex_lock(&pDevice->wasapi.rerouteLock);
{
ma_mutex_lock(&pDevice->startStopLock);
{
/* Starting and stopping are wrapped in a mutex which means we can assert that the device is in a stopped or paused state. */
......@@ -41225,8 +41253,6 @@ MA_API ma_result ma_device_start(ma_device* pDevice)
}
}
ma_mutex_unlock(&pDevice->startStopLock);
}
ma_mutex_unlock(&pDevice->wasapi.rerouteLock);
return result;
}
......@@ -41247,9 +41273,6 @@ MA_API ma_result ma_device_stop(ma_device* pDevice)
return MA_SUCCESS; /* Already stopped. */
}
/* Wait for any rerouting to finish before attempting to stop the device. */
ma_mutex_lock(&pDevice->wasapi.rerouteLock);
{
ma_mutex_lock(&pDevice->startStopLock);
{
/* Starting and stopping are wrapped in a mutex which means we can assert that the device is in a started or paused state. */
......@@ -41298,8 +41321,6 @@ MA_API ma_result ma_device_stop(ma_device* pDevice)
pDevice->playback.inputCacheRemaining = 0;
}
ma_mutex_unlock(&pDevice->startStopLock);
}
ma_mutex_unlock(&pDevice->wasapi.rerouteLock);
return result;
}
......@@ -73009,7 +73030,7 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng
Temporarily disabled. There is a subtle bug here where front-left and front-right
will be used by the device's channel map, but this is not what we want to use for
spatialization. Instead we want to use side-left and side-right. I need to figure
out a better solution for this. For now, disabling the user of device channel maps.
out a better solution for this. For now, disabling the use of device channel maps.
*/
/*listenerConfig.pChannelMapOut = pEngine->pDevice->playback.channelMap;*/
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment