Fixed FileMonitor, Window, Thread, and Audio on Windows.
This commit is contained in:
parent
2a2296685e
commit
e2e5a1b8db
@ -16,7 +16,7 @@ namespace ehs
|
||||
}
|
||||
|
||||
FileMonitor::FileMonitor()
|
||||
: hdl(nullptr), time{}
|
||||
: hdl(INVALID_HANDLE_VALUE), time{}
|
||||
{
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ namespace ehs
|
||||
if (!CloseHandle(hdl))
|
||||
EHS_LOG_INT(LogType::ERR, 0, "Failed to close file at file path, \"" + filePath + "\", with error #" + GetLastError() + ".");
|
||||
|
||||
hdl = nullptr;
|
||||
hdl = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
UInt_8 FileMonitor::Poll()
|
||||
|
@ -108,10 +108,11 @@ namespace ehs
|
||||
if (!keyboard)
|
||||
{
|
||||
UInt_32 bufferSize;
|
||||
GetRawInputDeviceInfo(raw->header.hDevice, RIDI_DEVICENAME, NULL, &bufferSize);
|
||||
GetRawInputDeviceInfoW(raw->header.hDevice, RIDI_DEVICENAME, nullptr, &bufferSize);
|
||||
|
||||
Char_16* deviceName = new Char_16[bufferSize];
|
||||
|
||||
if (GetRawInputDeviceInfo(raw->header.hDevice, RIDI_DEVICENAME, deviceName, &bufferSize) < 0)
|
||||
if (GetRawInputDeviceInfoW(raw->header.hDevice, RIDI_DEVICENAME, deviceName, &bufferSize) < 0)
|
||||
{
|
||||
EHS_LOG_INT(LogType::ERR, 0, "Failed to retrieve device name.");
|
||||
return 0;
|
||||
@ -134,10 +135,11 @@ namespace ehs
|
||||
if (!mouse)
|
||||
{
|
||||
UInt_32 bufferSize;
|
||||
GetRawInputDeviceInfo(raw->header.hDevice, RIDI_DEVICENAME, nullptr, &bufferSize);
|
||||
GetRawInputDeviceInfoW(raw->header.hDevice, RIDI_DEVICENAME, nullptr, &bufferSize);
|
||||
|
||||
Char_16* deviceName = new Char_16[bufferSize];
|
||||
|
||||
if (GetRawInputDeviceInfo(raw->header.hDevice, RIDI_DEVICENAME, deviceName, &bufferSize) < 0)
|
||||
if (GetRawInputDeviceInfoW(raw->header.hDevice, RIDI_DEVICENAME, deviceName, &bufferSize) < 0)
|
||||
{
|
||||
EHS_LOG_INT(LogType::ERR, 1, "Failed to retrieve device name.");
|
||||
return 0;
|
||||
|
@ -187,8 +187,6 @@ namespace ehs
|
||||
|
||||
QueryPrimaryDevices();
|
||||
|
||||
xcb_map_window(server, hdl);
|
||||
|
||||
xcb_flush(server);
|
||||
|
||||
created = true;
|
||||
|
@ -407,13 +407,13 @@ namespace ehs
|
||||
case DataType::SINT_8:
|
||||
return ((SInt_8 *)data)[sampleIndex];
|
||||
case DataType::SINT_16:
|
||||
return (SInt_8)((float)((SInt_16*)data)[sampleIndex] / (float)EHS_SINT_16_MAX * (float)EHS_SINT_8_MAX);
|
||||
return (SInt_8)((double)((SInt_16 *)data)[sampleIndex] / (double)EHS_SINT_16_MAX * (double)EHS_SINT_8_MAX);
|
||||
case DataType::FLOAT:
|
||||
return (SInt_8)(((float*)data)[sampleIndex] * (float)EHS_SINT_8_MAX);
|
||||
return (SInt_8)(((double *)data)[sampleIndex] * (double)EHS_SINT_8_MAX);
|
||||
case DataType::SINT_32:
|
||||
return (SInt_8)((float)((SInt_32*)data)[sampleIndex] / (float)EHS_SINT_32_MAX * (float)EHS_SINT_8_MAX);
|
||||
return (SInt_8)((double)((SInt_32 *)data)[sampleIndex] / (double)EHS_SINT_32_MAX * (double)EHS_SINT_8_MAX);
|
||||
case DataType::SINT_64:
|
||||
return (SInt_8)((float)((SInt_64*)data)[sampleIndex] / (float)EHS_SINT_64_MAX * (float)EHS_SINT_8_MAX);
|
||||
return (SInt_8)((double)((SInt_64 *)data)[sampleIndex] / (double)EHS_SINT_64_MAX * (double)EHS_SINT_8_MAX);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -424,15 +424,15 @@ namespace ehs
|
||||
switch (dataType)
|
||||
{
|
||||
case DataType::SINT_8:
|
||||
return (SInt_16)((float)((SInt_8*)data)[sampleIndex] / (float)EHS_SINT_8_MAX * (float)EHS_SINT_16_MAX);
|
||||
return (SInt_16)((double)((SInt_8*)data)[sampleIndex] / (double)EHS_SINT_8_MAX * (double)EHS_SINT_16_MAX);
|
||||
case DataType::SINT_16:
|
||||
return ((SInt_16 *)data)[sampleIndex];
|
||||
case DataType::FLOAT:
|
||||
return (SInt_16)(((float*)data)[sampleIndex] * (float)EHS_SINT_16_MAX);
|
||||
return (SInt_16)(((double *)data)[sampleIndex] * (double)EHS_SINT_16_MAX);
|
||||
case DataType::SINT_32:
|
||||
return (SInt_16)((float)((SInt_32*)data)[sampleIndex] / (float)EHS_SINT_32_MAX * (float)EHS_SINT_16_MAX);
|
||||
return (SInt_16)((double)((SInt_32 *)data)[sampleIndex] / (double)EHS_SINT_32_MAX * (double)EHS_SINT_16_MAX);
|
||||
case DataType::SINT_64:
|
||||
return (SInt_16)((float)((SInt_64*)data)[sampleIndex] / (float)EHS_SINT_64_MAX * (float)EHS_SINT_16_MAX);
|
||||
return (SInt_16)((double)((SInt_64 *)data)[sampleIndex] / (double)EHS_SINT_64_MAX * (double)EHS_SINT_16_MAX);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -462,15 +462,15 @@ namespace ehs
|
||||
switch (dataType)
|
||||
{
|
||||
case DataType::SINT_8:
|
||||
return (SInt_32)((float)((SInt_8*)data)[sampleIndex] / (float)EHS_SINT_8_MAX * (float)EHS_SINT_32_MAX);
|
||||
return (SInt_32)((double)((SInt_8 *)data)[sampleIndex] / (double)EHS_SINT_8_MAX * (double)EHS_SINT_32_MAX);
|
||||
case DataType::SINT_16:
|
||||
return (SInt_32)((float)((SInt_16*)data)[sampleIndex] / (float)EHS_SINT_16_MAX * (float)EHS_SINT_32_MAX);
|
||||
return (SInt_32)((double)((SInt_16 *)data)[sampleIndex] / (double)EHS_SINT_16_MAX * (double)EHS_SINT_32_MAX);
|
||||
case DataType::FLOAT:
|
||||
return (SInt_32)(((float*)data)[sampleIndex] * (float)EHS_SINT_32_MAX);
|
||||
return (SInt_32)(((double *)data)[sampleIndex] * (double)EHS_SINT_32_MAX);
|
||||
case DataType::SINT_32:
|
||||
return ((SInt_32 *)data)[sampleIndex];
|
||||
case DataType::SINT_64:
|
||||
return (SInt_32)((float)((SInt_64*)data)[sampleIndex] / (float)EHS_SINT_64_MAX * (float)EHS_SINT_32_MAX);
|
||||
return (SInt_32)((double)((SInt_64 *)data)[sampleIndex] / (double)EHS_SINT_64_MAX * (double)EHS_SINT_32_MAX);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -481,13 +481,13 @@ namespace ehs
|
||||
switch (dataType)
|
||||
{
|
||||
case DataType::SINT_8:
|
||||
return (SInt_64)((float)((SInt_8*)data)[sampleIndex] / (float)EHS_SINT_8_MAX * (float)EHS_SINT_64_MAX);
|
||||
return (SInt_64)((double)((SInt_8 *)data)[sampleIndex] / (double)EHS_SINT_8_MAX * (double)EHS_SINT_64_MAX);
|
||||
case DataType::SINT_16:
|
||||
return (SInt_64)((float)((SInt_16*)data)[sampleIndex] / (float)EHS_SINT_16_MAX * (float)EHS_SINT_64_MAX);
|
||||
return (SInt_64)((double)((SInt_16 *)data)[sampleIndex] / (double)EHS_SINT_16_MAX * (double)EHS_SINT_64_MAX);
|
||||
case DataType::FLOAT:
|
||||
return (SInt_64)(((float*)data)[sampleIndex] * (float)EHS_SINT_64_MAX);
|
||||
return (SInt_64)(((double *)data)[sampleIndex] * (double)EHS_SINT_64_MAX);
|
||||
case DataType::SINT_32:
|
||||
return (SInt_64)((float)((SInt_32*)data)[sampleIndex] / (float)EHS_SINT_32_MAX * (float)EHS_SINT_64_MAX);
|
||||
return (SInt_64)((double)((SInt_32 *)data)[sampleIndex] / (double)EHS_SINT_32_MAX * (double)EHS_SINT_64_MAX);
|
||||
case DataType::SINT_64:
|
||||
return ((SInt_64 *)data)[sampleIndex];
|
||||
default:
|
||||
@ -502,13 +502,13 @@ namespace ehs
|
||||
case DataType::SINT_8:
|
||||
return *(SInt_8*)peak;
|
||||
case DataType::SINT_16:
|
||||
return (SInt_8)((float)*(SInt_16*)peak / (float)EHS_SINT_16_MAX * (float)EHS_SINT_8_MAX);
|
||||
return (SInt_8)((double)*(SInt_16 *)peak / (double)EHS_SINT_16_MAX * (double)EHS_SINT_8_MAX);
|
||||
case DataType::FLOAT:
|
||||
return (SInt_8)(*(float*)peak * (float)EHS_SINT_8_MAX);
|
||||
return (SInt_8)(*(double *)peak * (double)EHS_SINT_8_MAX);
|
||||
case DataType::SINT_32:
|
||||
return (SInt_8)((float)*(SInt_32*)peak / (float)EHS_SINT_32_MAX * (float)EHS_SINT_8_MAX);
|
||||
return (SInt_8)((double)*(SInt_32 *)peak / (double)EHS_SINT_32_MAX * (double)EHS_SINT_8_MAX);
|
||||
case DataType::SINT_64:
|
||||
return (SInt_8)((float)*(SInt_64*)peak / (float)EHS_SINT_64_MAX * (float)EHS_SINT_8_MAX);
|
||||
return (SInt_8)((double)*(SInt_64 *)peak / (double)EHS_SINT_64_MAX * (double)EHS_SINT_8_MAX);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -519,15 +519,15 @@ namespace ehs
|
||||
switch (dataType)
|
||||
{
|
||||
case DataType::SINT_8:
|
||||
return (SInt_16)((float)*(SInt_8*)peak / (float)EHS_SINT_8_MAX * (float)EHS_SINT_16_MAX);
|
||||
return (SInt_16)((double)*(SInt_8 *)peak / (double)EHS_SINT_8_MAX * (double)EHS_SINT_16_MAX);
|
||||
case DataType::SINT_16:
|
||||
return *(SInt_16*)peak;
|
||||
case DataType::FLOAT:
|
||||
return (SInt_16)(*(float*)peak * (float)EHS_SINT_16_MAX);
|
||||
return (SInt_16)(*(double*)peak * (double)EHS_SINT_16_MAX);
|
||||
case DataType::SINT_32:
|
||||
return (SInt_16)((float)*(SInt_32*)peak / (float)EHS_SINT_32_MAX * (float)EHS_SINT_16_MAX);
|
||||
return (SInt_16)((double)*(SInt_32 *)peak / (double)EHS_SINT_32_MAX * (double)EHS_SINT_16_MAX);
|
||||
case DataType::SINT_64:
|
||||
return (SInt_16)((float)*(SInt_64*)peak / (float)EHS_SINT_64_MAX * (float)EHS_SINT_16_MAX);
|
||||
return (SInt_16)((double)*(SInt_64 *)peak / (double)EHS_SINT_64_MAX * (double)EHS_SINT_16_MAX);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -557,15 +557,15 @@ namespace ehs
|
||||
switch (dataType)
|
||||
{
|
||||
case DataType::SINT_8:
|
||||
return (SInt_32)((float)*(SInt_8*)peak / (float)EHS_SINT_8_MAX * (float)EHS_SINT_32_MAX);
|
||||
return (SInt_32)((double)*(SInt_8 *)peak / (double)EHS_SINT_8_MAX * (double)EHS_SINT_32_MAX);
|
||||
case DataType::SINT_16:
|
||||
return (SInt_32)((float)*(SInt_16*)peak / (float)EHS_SINT_16_MAX * (float)EHS_SINT_32_MAX);
|
||||
return (SInt_32)((double)*(SInt_16 *)peak / (double)EHS_SINT_16_MAX * (double)EHS_SINT_32_MAX);
|
||||
case DataType::FLOAT:
|
||||
return (SInt_32)(*(float*)peak * (float)EHS_SINT_32_MAX);
|
||||
return (SInt_32)(*(double *)peak * (double)EHS_SINT_32_MAX);
|
||||
case DataType::SINT_32:
|
||||
return *(SInt_32 *)peak;
|
||||
case DataType::SINT_64:
|
||||
return (SInt_32)((float)*(SInt_64*)peak / (float)EHS_SINT_64_MAX * (float)EHS_SINT_32_MAX);
|
||||
return (SInt_32)((double)*(SInt_64 *)peak / (double)EHS_SINT_64_MAX * (double)EHS_SINT_32_MAX);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -576,13 +576,13 @@ namespace ehs
|
||||
switch (dataType)
|
||||
{
|
||||
case DataType::SINT_8:
|
||||
return (SInt_64)((float)*(SInt_8*)peak / (float)EHS_SINT_8_MAX * (float)EHS_SINT_64_MAX);
|
||||
return (SInt_64)((double)*(SInt_8 *)peak / (double)EHS_SINT_8_MAX * (double)EHS_SINT_64_MAX);
|
||||
case DataType::SINT_16:
|
||||
return (SInt_64)((float)*(SInt_16*)peak / (float)EHS_SINT_16_MAX * (float)EHS_SINT_64_MAX);
|
||||
return (SInt_64)((double)*(SInt_16 *)peak / (double)EHS_SINT_16_MAX * (double)EHS_SINT_64_MAX);
|
||||
case DataType::FLOAT:
|
||||
return (SInt_64)(*(float*)peak * (float)EHS_SINT_64_MAX);
|
||||
return (SInt_64)(*(double *)peak * (double)EHS_SINT_64_MAX);
|
||||
case DataType::SINT_32:
|
||||
return (SInt_64)((float)*(SInt_32*)peak / (float)EHS_SINT_32_MAX * (float)EHS_SINT_64_MAX);
|
||||
return (SInt_64)((double)*(SInt_32 *)peak / (double)EHS_SINT_32_MAX * (double)EHS_SINT_64_MAX);
|
||||
case DataType::SINT_64:
|
||||
return *(SInt_64 *)peak;
|
||||
default:
|
||||
|
@ -75,7 +75,7 @@ namespace ehs
|
||||
if (hdl == EHS_INVALID_THREAD)
|
||||
return false;
|
||||
|
||||
#if defined(EHS_WINDOWS)
|
||||
#if defined(EHS_OS_WINDOWS)
|
||||
unsigned int r = WaitForSingleObject(hdl, timeout);
|
||||
if (r == WAIT_ABANDONED)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user