Fixed FileMonitor, Window, Thread, and Audio on Windows.
All checks were successful
Build & Release / Windows-AMD64-Build (push) Successful in 1m25s
Build & Release / Linux-AMD64-Build (push) Successful in 1m38s
Build & Release / Linux-AARCH64-Build (push) Successful in 3m36s

This commit is contained in:
Arron David Nelson 2024-07-01 19:16:45 -07:00
parent 2a2296685e
commit e2e5a1b8db
5 changed files with 47 additions and 47 deletions

View File

@ -16,7 +16,7 @@ namespace ehs
} }
FileMonitor::FileMonitor() FileMonitor::FileMonitor()
: hdl(nullptr), time{} : hdl(INVALID_HANDLE_VALUE), time{}
{ {
} }
@ -93,7 +93,7 @@ namespace ehs
if (!CloseHandle(hdl)) if (!CloseHandle(hdl))
EHS_LOG_INT(LogType::ERR, 0, "Failed to close file at file path, \"" + filePath + "\", with error #" + GetLastError() + "."); 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() UInt_8 FileMonitor::Poll()

View File

@ -108,10 +108,11 @@ namespace ehs
if (!keyboard) if (!keyboard)
{ {
UInt_32 bufferSize; 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]; 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."); EHS_LOG_INT(LogType::ERR, 0, "Failed to retrieve device name.");
return 0; return 0;
@ -134,10 +135,11 @@ namespace ehs
if (!mouse) if (!mouse)
{ {
UInt_32 bufferSize; 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]; 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."); EHS_LOG_INT(LogType::ERR, 1, "Failed to retrieve device name.");
return 0; return 0;

View File

@ -187,8 +187,6 @@ namespace ehs
QueryPrimaryDevices(); QueryPrimaryDevices();
xcb_map_window(server, hdl);
xcb_flush(server); xcb_flush(server);
created = true; created = true;

View File

@ -407,13 +407,13 @@ namespace ehs
case DataType::SINT_8: case DataType::SINT_8:
return ((SInt_8 *)data)[sampleIndex]; return ((SInt_8 *)data)[sampleIndex];
case DataType::SINT_16: 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: 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: 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: 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: default:
return 0; return 0;
} }
@ -424,15 +424,15 @@ namespace ehs
switch (dataType) switch (dataType)
{ {
case DataType::SINT_8: 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: case DataType::SINT_16:
return ((SInt_16 *)data)[sampleIndex]; return ((SInt_16 *)data)[sampleIndex];
case DataType::FLOAT: 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: 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: 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: default:
return 0; return 0;
} }
@ -462,15 +462,15 @@ namespace ehs
switch (dataType) switch (dataType)
{ {
case DataType::SINT_8: 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: 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: 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: case DataType::SINT_32:
return ((SInt_32 *)data)[sampleIndex]; return ((SInt_32 *)data)[sampleIndex];
case DataType::SINT_64: 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: default:
return 0; return 0;
} }
@ -481,13 +481,13 @@ namespace ehs
switch (dataType) switch (dataType)
{ {
case DataType::SINT_8: 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: 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: 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: 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: case DataType::SINT_64:
return ((SInt_64 *)data)[sampleIndex]; return ((SInt_64 *)data)[sampleIndex];
default: default:
@ -502,13 +502,13 @@ namespace ehs
case DataType::SINT_8: case DataType::SINT_8:
return *(SInt_8*)peak; return *(SInt_8*)peak;
case DataType::SINT_16: 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: 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: 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: 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: default:
return 0; return 0;
} }
@ -519,15 +519,15 @@ namespace ehs
switch (dataType) switch (dataType)
{ {
case DataType::SINT_8: 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: case DataType::SINT_16:
return *(SInt_16*)peak; return *(SInt_16*)peak;
case DataType::FLOAT: 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: 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: 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: default:
return 0; return 0;
} }
@ -557,15 +557,15 @@ namespace ehs
switch (dataType) switch (dataType)
{ {
case DataType::SINT_8: 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: 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: 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: case DataType::SINT_32:
return *(SInt_32 *)peak; return *(SInt_32 *)peak;
case DataType::SINT_64: 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: default:
return 0; return 0;
} }
@ -576,13 +576,13 @@ namespace ehs
switch (dataType) switch (dataType)
{ {
case DataType::SINT_8: 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: 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: 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: 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: case DataType::SINT_64:
return *(SInt_64 *)peak; return *(SInt_64 *)peak;
default: default:

View File

@ -75,7 +75,7 @@ namespace ehs
if (hdl == EHS_INVALID_THREAD) if (hdl == EHS_INVALID_THREAD)
return false; return false;
#if defined(EHS_WINDOWS) #if defined(EHS_OS_WINDOWS)
unsigned int r = WaitForSingleObject(hdl, timeout); unsigned int r = WaitForSingleObject(hdl, timeout);
if (r == WAIT_ABANDONED) if (r == WAIT_ABANDONED)
{ {