v0.10.5.1
This commit is contained in:
@@ -77,14 +77,13 @@ namespace Steamworks
|
||||
|
||||
System.Environment.SetEnvironmentVariable( "SteamAppId", appid.ToString() );
|
||||
System.Environment.SetEnvironmentVariable( "SteamGameId", appid.ToString() );
|
||||
var secure = (int)(init.Secure ? 3 : 2);
|
||||
|
||||
//
|
||||
// Get other interfaces
|
||||
//
|
||||
if ( !SteamInternal.GameServer_Init( ipaddress, init.SteamPort, init.GamePort, init.QueryPort, secure, init.VersionString ) )
|
||||
if ( !SteamInternal.GameServer_Init( ipaddress, init.SteamPort, init.GamePort, init.QueryPort, (int)init.Mode, init.VersionString ) )
|
||||
{
|
||||
throw new System.Exception( $"InitGameServer returned false ({ipaddress},{init.SteamPort},{init.GamePort},{init.QueryPort},{secure},\"{init.VersionString}\")" );
|
||||
throw new System.Exception( $"InitGameServer returned false ({ipaddress},{init.SteamPort},{init.GamePort},{init.QueryPort},{init.Mode},\"{init.VersionString}\")" );
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -7,6 +7,14 @@ using System.Text;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
public enum InitServerMode
|
||||
{
|
||||
Invalid = 0,
|
||||
NoAuthentication = 1,
|
||||
Authentication = 2,
|
||||
AuthenticationSecure = 3
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Used to set up the server.
|
||||
/// The variables in here are all required to be set, and can't be changed once the server is created.
|
||||
@@ -17,7 +25,7 @@ namespace Steamworks
|
||||
public ushort SteamPort;
|
||||
public ushort GamePort;
|
||||
public ushort QueryPort;
|
||||
public bool Secure;
|
||||
public InitServerMode Mode;
|
||||
|
||||
/// <summary>
|
||||
/// The version string is usually in the form x.x.x.x, and is used by the master server to detect when the server is out of date.
|
||||
@@ -49,7 +57,7 @@ namespace Steamworks
|
||||
GameDescription = gameDesc;
|
||||
GamePort = 27015;
|
||||
QueryPort = 27016;
|
||||
Secure = true;
|
||||
Mode = InitServerMode.Authentication;
|
||||
VersionString = "1.0.0.0";
|
||||
IpAddress = null;
|
||||
SteamPort = 0;
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
|
||||
+189
-131
@@ -1,9 +1,9 @@
|
||||
diff --git a/Alc/alc.cpp b/Alc/alc.cpp
|
||||
index fde655be..779727d1 100644
|
||||
--- a/Alc/alc.cpp
|
||||
+++ b/Alc/alc.cpp
|
||||
@@ -161,9 +161,11 @@ BackendInfo BackendList[] = {
|
||||
{ "qsa", QSABackendFactory::getFactory },
|
||||
diff --git a/alc/alc.cpp b/alc/alc.cpp
|
||||
index 30d363af..f759a484 100644
|
||||
--- a/alc/alc.cpp
|
||||
+++ b/alc/alc.cpp
|
||||
@@ -197,9 +197,11 @@ BackendInfo BackendList[] = {
|
||||
{ "oss", OSSBackendFactory::getFactory },
|
||||
#endif
|
||||
#ifdef HAVE_DSOUND
|
||||
+#error no dsound >:(
|
||||
@@ -14,16 +14,16 @@ index fde655be..779727d1 100644
|
||||
{ "winmm", WinMMBackendFactory::getFactory },
|
||||
#endif
|
||||
#ifdef HAVE_PORTAUDIO
|
||||
@@ -956,7 +958,7 @@ static void alc_initconfig(void)
|
||||
@@ -1015,7 +1017,7 @@ void alc_initconfig(void)
|
||||
}
|
||||
TRACE("Supported backends: %s\n", names.c_str());
|
||||
}
|
||||
- ReadALConfig();
|
||||
+ //ReadALConfig();
|
||||
|
||||
str = getenv("__ALSOFT_SUSPEND_CONTEXT");
|
||||
if(str && *str)
|
||||
@@ -2692,6 +2694,20 @@ START_API_FUNC
|
||||
if(auto suspendmode = al::getenv("__ALSOFT_SUSPEND_CONTEXT"))
|
||||
{
|
||||
@@ -2580,6 +2582,20 @@ START_API_FUNC
|
||||
}
|
||||
END_API_FUNC
|
||||
|
||||
@@ -42,9 +42,9 @@ index fde655be..779727d1 100644
|
||||
+}
|
||||
+END_API_FUNC
|
||||
|
||||
/* alcSuspendContext
|
||||
*
|
||||
@@ -2705,7 +2721,9 @@ START_API_FUNC
|
||||
ALC_API void ALC_APIENTRY alcSuspendContext(ALCcontext *context)
|
||||
START_API_FUNC
|
||||
@@ -2589,7 +2605,9 @@ START_API_FUNC
|
||||
|
||||
ContextRef ctx{VerifyContext(context)};
|
||||
if(!ctx)
|
||||
@@ -52,9 +52,9 @@ index fde655be..779727d1 100644
|
||||
alcSetError(nullptr, ALC_INVALID_CONTEXT);
|
||||
+ }
|
||||
else
|
||||
ALCcontext_DeferUpdates(ctx.get());
|
||||
ctx->deferUpdates();
|
||||
}
|
||||
@@ -2723,7 +2741,9 @@ START_API_FUNC
|
||||
@@ -2603,7 +2621,9 @@ START_API_FUNC
|
||||
|
||||
ContextRef ctx{VerifyContext(context)};
|
||||
if(!ctx)
|
||||
@@ -62,19 +62,9 @@ index fde655be..779727d1 100644
|
||||
alcSetError(nullptr, ALC_INVALID_CONTEXT);
|
||||
+ }
|
||||
else
|
||||
ALCcontext_ProcessUpdates(ctx.get());
|
||||
ctx->processUpdates();
|
||||
}
|
||||
@@ -2824,7 +2844,9 @@ START_API_FUNC
|
||||
case ALC_HRTF_SPECIFIER_SOFT:
|
||||
dev = VerifyDevice(Device);
|
||||
if(!dev)
|
||||
+ {
|
||||
alcSetError(nullptr, ALC_INVALID_DEVICE);
|
||||
+ }
|
||||
else
|
||||
{
|
||||
std::lock_guard<std::mutex> _{dev->StateLock};
|
||||
@@ -2858,6 +2880,7 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, const al::span<ALC
|
||||
@@ -2730,6 +2750,7 @@ static size_t GetIntegerv(ALCdevice *device, ALCenum param, const al::span<int>
|
||||
|
||||
if(values.empty())
|
||||
{
|
||||
@@ -82,9 +72,9 @@ index fde655be..779727d1 100644
|
||||
alcSetError(device, ALC_INVALID_VALUE);
|
||||
return 0;
|
||||
}
|
||||
@@ -3903,12 +3926,14 @@ START_API_FUNC
|
||||
@@ -3717,12 +3738,14 @@ START_API_FUNC
|
||||
|
||||
if(!CaptureBackend.name)
|
||||
if(!CaptureFactory)
|
||||
{
|
||||
+ alcCallErrorReasonCallback("alcCaptureOpenDevice failed: CaptureBackend name is null");
|
||||
alcSetError(nullptr, ALC_INVALID_VALUE);
|
||||
@@ -97,15 +87,15 @@ index fde655be..779727d1 100644
|
||||
alcSetError(nullptr, ALC_INVALID_VALUE);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -3921,6 +3946,7 @@ START_API_FUNC
|
||||
device->Frequency = frequency;
|
||||
if(DecomposeDevFormat(format, &device->FmtChans, &device->FmtType) == AL_FALSE)
|
||||
@@ -3739,6 +3762,7 @@ START_API_FUNC
|
||||
auto decompfmt = DecomposeDevFormat(format);
|
||||
if(!decompfmt)
|
||||
{
|
||||
+ alcCallErrorReasonCallback("alcCaptureOpenDevice failed: DecomposeDevFormat failed");
|
||||
alcSetError(nullptr, ALC_INVALID_ENUM);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -3945,6 +3971,7 @@ START_API_FUNC
|
||||
@@ -3763,6 +3787,7 @@ START_API_FUNC
|
||||
}
|
||||
catch(al::backend_exception &e) {
|
||||
WARN("Failed to open capture device: %s\n", e.what());
|
||||
@@ -113,9 +103,9 @@ index fde655be..779727d1 100644
|
||||
alcSetError(nullptr, e.errorCode());
|
||||
return nullptr;
|
||||
}
|
||||
@@ -3968,11 +3995,13 @@ START_API_FUNC
|
||||
auto iter = std::lower_bound(DeviceList.cbegin(), DeviceList.cend(), device);
|
||||
if(iter == DeviceList.cend() || *iter != device)
|
||||
@@ -3786,11 +3811,13 @@ START_API_FUNC
|
||||
auto iter = std::lower_bound(DeviceList.begin(), DeviceList.end(), device);
|
||||
if(iter == DeviceList.end() || *iter != device)
|
||||
{
|
||||
+ alcCallErrorReasonCallback("alcCaptureCloseDevice failed: iterator couldn't find correct device");
|
||||
alcSetError(nullptr, ALC_INVALID_DEVICE);
|
||||
@@ -127,7 +117,7 @@ index fde655be..779727d1 100644
|
||||
alcSetError(*iter, ALC_INVALID_DEVICE);
|
||||
return ALC_FALSE;
|
||||
}
|
||||
@@ -3998,19 +4027,24 @@ START_API_FUNC
|
||||
@@ -3814,13 +3841,17 @@ START_API_FUNC
|
||||
DeviceRef dev{VerifyDevice(device)};
|
||||
if(!dev || dev->Type != Capture)
|
||||
{
|
||||
@@ -144,15 +134,16 @@ index fde655be..779727d1 100644
|
||||
+ }
|
||||
else if(!dev->Flags.get<DeviceRunning>())
|
||||
{
|
||||
if(dev->Backend->start())
|
||||
try {
|
||||
@@ -3829,6 +3860,7 @@ START_API_FUNC
|
||||
dev->Flags.set<DeviceRunning>();
|
||||
else
|
||||
{
|
||||
+ alcCallErrorReasonCallback("alcCaptureStart failed: backend start failed");
|
||||
aluHandleDisconnect(dev.get(), "Device start failure");
|
||||
}
|
||||
catch(al::backend_exception& e) {
|
||||
+ alcCallErrorReasonCallback(std::string("alcCaptureStart failed: backend start failed (")+e.what()+")");
|
||||
aluHandleDisconnect(dev.get(), "%s", e.what());
|
||||
alcSetError(dev.get(), ALC_INVALID_DEVICE);
|
||||
}
|
||||
@@ -4023,7 +4057,10 @@ START_API_FUNC
|
||||
@@ -3841,7 +3873,10 @@ START_API_FUNC
|
||||
{
|
||||
DeviceRef dev{VerifyDevice(device)};
|
||||
if(!dev || dev->Type != Capture)
|
||||
@@ -163,7 +154,7 @@ index fde655be..779727d1 100644
|
||||
else
|
||||
{
|
||||
std::lock_guard<std::mutex> _{dev->StateLock};
|
||||
@@ -4040,6 +4077,7 @@ START_API_FUNC
|
||||
@@ -3858,6 +3893,7 @@ START_API_FUNC
|
||||
DeviceRef dev{VerifyDevice(device)};
|
||||
if(!dev || dev->Type != Capture)
|
||||
{
|
||||
@@ -171,21 +162,26 @@ index fde655be..779727d1 100644
|
||||
alcSetError(dev.get(), ALC_INVALID_DEVICE);
|
||||
return;
|
||||
}
|
||||
diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp
|
||||
index 84e85fe6..33d6a74f 100644
|
||||
--- a/Alc/backends/wasapi.cpp
|
||||
+++ b/Alc/backends/wasapi.cpp
|
||||
@@ -46,6 +46,7 @@
|
||||
diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp
|
||||
index 8e43aa7c..0f313dea 100644
|
||||
--- a/alc/backends/wasapi.cpp
|
||||
+++ b/alc/backends/wasapi.cpp
|
||||
@@ -54,6 +54,12 @@
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
+#include <string>
|
||||
+#include <sstream>
|
||||
#include <future>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
@@ -57,6 +58,13 @@
|
||||
#include "compat.h"
|
||||
#include "converter.h"
|
||||
+#include <future>
|
||||
+#include <algorithm>
|
||||
+#include <functional>
|
||||
+#include <condition_variable>
|
||||
|
||||
#include "alcmain.h"
|
||||
#include "alexcpt.h"
|
||||
@@ -65,6 +71,13 @@
|
||||
#include "strutils.h"
|
||||
#include "threads.h"
|
||||
|
||||
+extern void alcCallErrorReasonCallback(std::string reason);
|
||||
+
|
||||
@@ -197,15 +193,128 @@ index 84e85fe6..33d6a74f 100644
|
||||
|
||||
/* Some headers seem to define these as macros for __uuidof, which is annoying
|
||||
* since some headers don't declare them at all. Hopefully the ifdef is enough
|
||||
@@ -695,6 +703,7 @@ ALCenum WasapiPlayback::open(const ALCchar *name)
|
||||
@@ -792,6 +805,7 @@ void WasapiPlayback::open(const ALCchar *name)
|
||||
|
||||
mDevId.clear();
|
||||
|
||||
+ alcCallErrorReasonCallback("WASAPI playback device init failed: HRESULT "+toStringHex(hr));
|
||||
ERR("Device init failed: 0x%08lx\n", hr);
|
||||
return ALC_INVALID_VALUE;
|
||||
throw al::backend_exception{ALC_INVALID_VALUE, "Device init failed: 0x%08lx", hr};
|
||||
}
|
||||
@@ -1222,7 +1231,9 @@ ALCenum WasapiCapture::open(const ALCchar *name)
|
||||
}
|
||||
@@ -897,7 +911,7 @@ HRESULT WasapiPlayback::resetProxy()
|
||||
mDevice->FmtChans = DevFmtX51;
|
||||
else if(chancount >= 6 && (chanmask&X51RearMask) == X5DOT1REAR)
|
||||
mDevice->FmtChans = DevFmtX51Rear;
|
||||
- else if(chancount >= 4 && (chanmask&QuadMask) == QUAD)
|
||||
+ else if(chancount >= 4/* && (chanmask&QuadMask) == QUAD*/)
|
||||
mDevice->FmtChans = DevFmtQuad;
|
||||
else if(chancount >= 2 && (chanmask&StereoMask) == STEREO)
|
||||
mDevice->FmtChans = DevFmtStereo;
|
||||
@@ -1005,9 +1019,11 @@ HRESULT WasapiPlayback::resetProxy()
|
||||
CoTaskMemFree(wfx);
|
||||
wfx = nullptr;
|
||||
|
||||
- mDevice->Frequency = OutputType.Format.nSamplesPerSec;
|
||||
- const uint32_t chancount{OutputType.Format.nChannels};
|
||||
- const DWORD chanmask{OutputType.dwChannelMask};
|
||||
+ const WAVEFORMATEXTENSIBLE& constOutputType = OutputType;
|
||||
+
|
||||
+ mDevice->Frequency = constOutputType.Format.nSamplesPerSec;
|
||||
+ const uint32_t chancount{constOutputType.Format.nChannels};
|
||||
+ const DWORD chanmask{constOutputType.dwChannelMask};
|
||||
if(chancount >= 8 && (chanmask&X71Mask) == X7DOT1)
|
||||
mDevice->FmtChans = DevFmtX71;
|
||||
else if(chancount >= 7 && (chanmask&X61Mask) == X6DOT1)
|
||||
@@ -1016,7 +1032,7 @@ HRESULT WasapiPlayback::resetProxy()
|
||||
mDevice->FmtChans = DevFmtX51;
|
||||
else if(chancount >= 6 && (chanmask&X51RearMask) == X5DOT1REAR)
|
||||
mDevice->FmtChans = DevFmtX51Rear;
|
||||
- else if(chancount >= 4 && (chanmask&QuadMask) == QUAD)
|
||||
+ else if(chancount >= 4/* && (chanmask&QuadMask) == QUAD*/)
|
||||
mDevice->FmtChans = DevFmtQuad;
|
||||
else if(chancount >= 2 && (chanmask&StereoMask) == STEREO)
|
||||
mDevice->FmtChans = DevFmtStereo;
|
||||
@@ -1024,54 +1040,59 @@ HRESULT WasapiPlayback::resetProxy()
|
||||
mDevice->FmtChans = DevFmtMono;
|
||||
else
|
||||
{
|
||||
- ERR("Unhandled extensible channels: %d -- 0x%08lx\n", OutputType.Format.nChannels,
|
||||
- OutputType.dwChannelMask);
|
||||
- mDevice->FmtChans = DevFmtStereo;
|
||||
- OutputType.Format.nChannels = 2;
|
||||
- OutputType.dwChannelMask = STEREO;
|
||||
+ ERR("Unhandled extensible channels: %d -- 0x%08lx\n", constOutputType.Format.nChannels,
|
||||
+ constOutputType.dwChannelMask);
|
||||
+ /*mDevice->FmtChans = DevFmtStereo;
|
||||
+ constOutputType.Format.nChannels = 2;
|
||||
+ constOutputType.dwChannelMask = STEREO;*/
|
||||
}
|
||||
|
||||
- if(IsEqualGUID(OutputType.SubFormat, KSDATAFORMAT_SUBTYPE_PCM))
|
||||
+ if(IsEqualGUID(constOutputType.SubFormat, KSDATAFORMAT_SUBTYPE_PCM))
|
||||
{
|
||||
- if(OutputType.Format.wBitsPerSample == 8)
|
||||
+ if(constOutputType.Format.wBitsPerSample == 8)
|
||||
mDevice->FmtType = DevFmtUByte;
|
||||
- else if(OutputType.Format.wBitsPerSample == 16)
|
||||
+ else if(constOutputType.Format.wBitsPerSample == 16)
|
||||
mDevice->FmtType = DevFmtShort;
|
||||
- else if(OutputType.Format.wBitsPerSample == 32)
|
||||
+ else if(constOutputType.Format.wBitsPerSample == 32)
|
||||
mDevice->FmtType = DevFmtInt;
|
||||
else
|
||||
{
|
||||
+ ERR("Unhandled bits per sample: %d\n", constOutputType.Format.wBitsPerSample);
|
||||
mDevice->FmtType = DevFmtShort;
|
||||
- OutputType.Format.wBitsPerSample = 16;
|
||||
+ //OutputType.Format.wBitsPerSample = 16;
|
||||
}
|
||||
}
|
||||
- else if(IsEqualGUID(OutputType.SubFormat, KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))
|
||||
+ else if(IsEqualGUID(constOutputType.SubFormat, KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))
|
||||
{
|
||||
mDevice->FmtType = DevFmtFloat;
|
||||
- OutputType.Format.wBitsPerSample = 32;
|
||||
+ if (constOutputType.Format.wBitsPerSample != 32) {
|
||||
+ ERR("Incorrect bits per sample for SUBTYPE_IEEE_FLOAT: %d\n", constOutputType.Format.wBitsPerSample);
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
- ERR("Unhandled format sub-type: %s\n", GuidPrinter{OutputType.SubFormat}.c_str());
|
||||
+ ERR("Unhandled format sub-type: %s\n", GuidPrinter{constOutputType.SubFormat}.c_str());
|
||||
mDevice->FmtType = DevFmtShort;
|
||||
- if(OutputType.Format.wFormatTag != WAVE_FORMAT_EXTENSIBLE)
|
||||
- OutputType.Format.wFormatTag = WAVE_FORMAT_PCM;
|
||||
- OutputType.Format.wBitsPerSample = 16;
|
||||
- OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
|
||||
+ /*if(constOutputType.Format.wFormatTag != WAVE_FORMAT_EXTENSIBLE)
|
||||
+ constOutputType.Format.wFormatTag = WAVE_FORMAT_PCM;
|
||||
+ constOutputType.Format.wBitsPerSample = 16;
|
||||
+ constOutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;*/
|
||||
}
|
||||
OutputType.Samples.wValidBitsPerSample = OutputType.Format.wBitsPerSample;
|
||||
}
|
||||
- mFrameStep = OutputType.Format.nChannels;
|
||||
+ const WAVEFORMATEXTENSIBLE& constOutputType2 = OutputType;
|
||||
+
|
||||
+ mFrameStep = constOutputType2.Format.nChannels;
|
||||
|
||||
EndpointFormFactor formfactor{UnknownFormFactor};
|
||||
get_device_formfactor(mMMDev, &formfactor);
|
||||
mDevice->IsHeadphones = (mDevice->FmtChans == DevFmtStereo
|
||||
&& (formfactor == Headphones || formfactor == Headset));
|
||||
|
||||
- setChannelOrderFromWFXMask(OutputType.dwChannelMask);
|
||||
+ setChannelOrderFromWFXMask(constOutputType2.dwChannelMask);
|
||||
|
||||
hr = mClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK,
|
||||
- buf_time.count(), 0, &OutputType.Format, nullptr);
|
||||
+ buf_time.count(), 0, &constOutputType2.Format, nullptr);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
ERR("Failed to initialize audio client: 0x%08lx\n", hr);
|
||||
@@ -1326,7 +1347,9 @@ void WasapiCapture::open(const ALCchar *name)
|
||||
mNotifyEvent = CreateEventW(nullptr, FALSE, FALSE, nullptr);
|
||||
if(mNotifyEvent == nullptr)
|
||||
{
|
||||
@@ -216,23 +325,22 @@ index 84e85fe6..33d6a74f 100644
|
||||
hr = E_FAIL;
|
||||
}
|
||||
|
||||
@@ -1268,6 +1279,7 @@ ALCenum WasapiCapture::open(const ALCchar *name)
|
||||
@@ -1373,12 +1396,14 @@ void WasapiCapture::open(const ALCchar *name)
|
||||
|
||||
mDevId.clear();
|
||||
|
||||
+ alcCallErrorReasonCallback(std::string("WASAPI capture open failed: HRESULT ")+toStringHex(hr)+" (1)");
|
||||
ERR("Device init failed: 0x%08lx\n", hr);
|
||||
return ALC_INVALID_VALUE;
|
||||
throw al::backend_exception{ALC_INVALID_VALUE, "Device init failed: 0x%08lx", hr};
|
||||
}
|
||||
@@ -1275,6 +1287,7 @@ ALCenum WasapiCapture::open(const ALCchar *name)
|
||||
|
||||
hr = pushMessage(MsgType::ResetDevice).get();
|
||||
if(FAILED(hr))
|
||||
{
|
||||
+ alcCallErrorReasonCallback(std::string("WASAPI capture open failed: HRESULT ")+toStringHex(hr)+" (2)");
|
||||
if(hr == E_OUTOFMEMORY)
|
||||
return ALC_OUT_OF_MEMORY;
|
||||
return ALC_INVALID_VALUE;
|
||||
@@ -1308,6 +1321,7 @@ HRESULT WasapiCapture::openProxy()
|
||||
throw al::backend_exception{ALC_OUT_OF_MEMORY, "Out of memory"};
|
||||
throw al::backend_exception{ALC_INVALID_VALUE, "Device reset failed"};
|
||||
@@ -1410,6 +1435,7 @@ HRESULT WasapiCapture::openProxy()
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
@@ -240,7 +348,7 @@ index 84e85fe6..33d6a74f 100644
|
||||
if(mMMDev)
|
||||
mMMDev->Release();
|
||||
mMMDev = nullptr;
|
||||
@@ -1337,6 +1351,7 @@ HRESULT WasapiCapture::resetProxy()
|
||||
@@ -1439,6 +1465,7 @@ HRESULT WasapiCapture::resetProxy()
|
||||
HRESULT hr{mMMDev->Activate(IID_IAudioClient, CLSCTX_INPROC_SERVER, nullptr, &ptr)};
|
||||
if(FAILED(hr))
|
||||
{
|
||||
@@ -248,7 +356,7 @@ index 84e85fe6..33d6a74f 100644
|
||||
ERR("Failed to reactivate audio client: 0x%08lx\n", hr);
|
||||
return hr;
|
||||
}
|
||||
@@ -1418,6 +1433,7 @@ HRESULT WasapiCapture::resetProxy()
|
||||
@@ -1521,6 +1548,7 @@ HRESULT WasapiCapture::resetProxy()
|
||||
hr = mClient->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, &OutputType.Format, &wfx);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
@@ -256,15 +364,15 @@ index 84e85fe6..33d6a74f 100644
|
||||
ERR("Failed to check format support: 0x%08lx\n", hr);
|
||||
return hr;
|
||||
}
|
||||
@@ -1525,6 +1541,7 @@ HRESULT WasapiCapture::resetProxy()
|
||||
0, &OutputType.Format, nullptr);
|
||||
@@ -1619,6 +1647,7 @@ HRESULT WasapiCapture::resetProxy()
|
||||
buf_time.count(), 0, &OutputType.Format, nullptr);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
+ alcCallErrorReasonCallback(std::string("WASAPI capture proxy reset failed: failed to initialize audio client (HRESULT ")+toStringHex(hr)+")");
|
||||
ERR("Failed to initialize audio client: 0x%08lx\n", hr);
|
||||
return hr;
|
||||
}
|
||||
@@ -1536,6 +1553,7 @@ HRESULT WasapiCapture::resetProxy()
|
||||
@@ -1630,6 +1659,7 @@ HRESULT WasapiCapture::resetProxy()
|
||||
hr = mClient->GetBufferSize(&buffer_len);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
@@ -272,15 +380,7 @@ index 84e85fe6..33d6a74f 100644
|
||||
ERR("Failed to get buffer size: 0x%08lx\n", hr);
|
||||
return hr;
|
||||
}
|
||||
@@ -1547,6 +1565,7 @@ HRESULT WasapiCapture::resetProxy()
|
||||
mRing = CreateRingBuffer(buffer_len, mDevice->frameSizeFromFmt(), false);
|
||||
if(!mRing)
|
||||
{
|
||||
+ alcCallErrorReasonCallback(std::string("WASAPI capture proxy reset failed: failed to allocate capture ring buffer"));
|
||||
ERR("Failed to allocate capture ring buffer\n");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
@@ -1554,6 +1573,7 @@ HRESULT WasapiCapture::resetProxy()
|
||||
@@ -1641,6 +1671,7 @@ HRESULT WasapiCapture::resetProxy()
|
||||
hr = mClient->SetEventHandle(mNotifyEvent);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
@@ -288,18 +388,18 @@ index 84e85fe6..33d6a74f 100644
|
||||
ERR("Failed to set event handle: 0x%08lx\n", hr);
|
||||
return hr;
|
||||
}
|
||||
@@ -1565,6 +1585,10 @@ HRESULT WasapiCapture::resetProxy()
|
||||
ALCboolean WasapiCapture::start()
|
||||
@@ -1653,7 +1684,10 @@ void WasapiCapture::start()
|
||||
{
|
||||
HRESULT hr{pushMessage(MsgType::StartDevice).get()};
|
||||
+ if (FAILED(hr))
|
||||
const HRESULT hr{pushMessage(MsgType::StartDevice).get()};
|
||||
if(FAILED(hr))
|
||||
+ {
|
||||
+ alcCallErrorReasonCallback(std::string("WASAPI capture start failed: HRESULT ")+toStringHex(hr));
|
||||
throw al::backend_exception{ALC_INVALID_DEVICE, "Failed to start recording: 0x%lx", hr};
|
||||
+ }
|
||||
return SUCCEEDED(hr) ? ALC_TRUE : ALC_FALSE;
|
||||
}
|
||||
|
||||
@@ -1575,6 +1599,7 @@ HRESULT WasapiCapture::startProxy()
|
||||
HRESULT WasapiCapture::startProxy()
|
||||
@@ -1663,6 +1697,7 @@ HRESULT WasapiCapture::startProxy()
|
||||
HRESULT hr{mClient->Start()};
|
||||
if(FAILED(hr))
|
||||
{
|
||||
@@ -307,7 +407,7 @@ index 84e85fe6..33d6a74f 100644
|
||||
ERR("Failed to start audio client: 0x%08lx\n", hr);
|
||||
return hr;
|
||||
}
|
||||
@@ -1588,9 +1613,17 @@ HRESULT WasapiCapture::startProxy()
|
||||
@@ -1676,9 +1711,17 @@ HRESULT WasapiCapture::startProxy()
|
||||
mKillNow.store(false, std::memory_order_release);
|
||||
mThread = std::thread{std::mem_fn(&WasapiCapture::recordProc), this};
|
||||
}
|
||||
@@ -325,7 +425,7 @@ index 84e85fe6..33d6a74f 100644
|
||||
ERR("Failed to start thread\n");
|
||||
hr = E_FAIL;
|
||||
}
|
||||
@@ -1649,6 +1682,12 @@ bool WasapiBackendFactory::init()
|
||||
@@ -1737,6 +1780,12 @@ bool WasapiBackendFactory::init()
|
||||
InitResult = future.get();
|
||||
}
|
||||
catch(...) {
|
||||
@@ -338,45 +438,3 @@ index 84e85fe6..33d6a74f 100644
|
||||
}
|
||||
|
||||
return SUCCEEDED(InitResult) ? ALC_TRUE : ALC_FALSE;
|
||||
diff --git a/Alc/helpers.cpp b/Alc/helpers.cpp
|
||||
index ee0bb2dc..2b17acce 100644
|
||||
--- a/Alc/helpers.cpp
|
||||
+++ b/Alc/helpers.cpp
|
||||
@@ -125,7 +125,6 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x
|
||||
#include "compat.h"
|
||||
#include "threads.h"
|
||||
|
||||
-
|
||||
#if defined(HAVE_GCC_GET_CPUID) && (defined(__i386__) || defined(__x86_64__) || \
|
||||
defined(_M_IX86) || defined(_M_X64))
|
||||
using reg_type = unsigned int;
|
||||
@@ -482,6 +481,7 @@ void *GetSymbol(void *handle, const char *name)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+extern void alcCallErrorReasonCallback(std::string reason);
|
||||
|
||||
void al_print(FILE *logfile, const char *fmt, ...)
|
||||
{
|
||||
@@ -502,6 +502,8 @@ void al_print(FILE *logfile, const char *fmt, ...)
|
||||
va_end(args2);
|
||||
va_end(args);
|
||||
|
||||
+ alcCallErrorReasonCallback(str);
|
||||
+
|
||||
std::wstring wstr{utf8_to_wstr(str)};
|
||||
fprintf(logfile, "%ls", wstr.c_str());
|
||||
fflush(logfile);
|
||||
diff --git a/include/AL/alc.h b/include/AL/alc.h
|
||||
index 5786bad2..d308fbeb 100644
|
||||
--- a/include/AL/alc.h
|
||||
+++ b/include/AL/alc.h
|
||||
@@ -187,6 +187,8 @@ ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device);
|
||||
*/
|
||||
ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device);
|
||||
|
||||
+ALC_API void ALC_APIENTRY alcSetErrorReasonCallback(void (*c)(const char*));
|
||||
+
|
||||
/**
|
||||
* Extension support.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user