Commit b61ea246 authored by David Reid's avatar David Reid

WebAudio: Add support for default device detection.

Public issue https://github.com/mackron/miniaudio/issues/126
parent a1052923
......@@ -30346,6 +30346,7 @@ static ma_result ma_context_enumerate_devices__webaudio(ma_context* pContext, ma
ma_device_info deviceInfo;
MA_ZERO_OBJECT(&deviceInfo);
ma_strncpy_s(deviceInfo.name, sizeof(deviceInfo.name), MA_DEFAULT_PLAYBACK_DEVICE_NAME, (size_t)-1);
deviceInfo._private.isDefault = MA_TRUE; /* Only supporting default devices. */
cbResult = callback(pContext, ma_device_type_playback, &deviceInfo, pUserData);
}
......@@ -30355,6 +30356,7 @@ static ma_result ma_context_enumerate_devices__webaudio(ma_context* pContext, ma
ma_device_info deviceInfo;
MA_ZERO_OBJECT(&deviceInfo);
ma_strncpy_s(deviceInfo.name, sizeof(deviceInfo.name), MA_DEFAULT_CAPTURE_DEVICE_NAME, (size_t)-1);
deviceInfo._private.isDefault = MA_TRUE; /* Only supporting default devices. */
cbResult = callback(pContext, ma_device_type_capture, &deviceInfo, pUserData);
}
}
......@@ -30386,6 +30388,9 @@ static ma_result ma_context_get_device_info__webaudio(ma_context* pContext, ma_d
ma_strncpy_s(pDeviceInfo->name, sizeof(pDeviceInfo->name), MA_DEFAULT_CAPTURE_DEVICE_NAME, (size_t)-1);
}
/* Only supporting default devices. */
pDeviceInfo->_private.isDefault = MA_TRUE;
/* Web Audio can support any number of channels and sample rates. It only supports f32 formats, however. */
pDeviceInfo->minChannels = 1;
pDeviceInfo->maxChannels = MA_MAX_CHANNELS;
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