This commit is contained in:
2019-10-11 20:31:45 +03:00
parent 94d7471aec
commit 3102efaf4f
5 changed files with 774 additions and 773 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -31,9 +31,9 @@
namespace Audio
{
class VistaEnumerator: public Enumerator
{
public:
class VistaEnumerator: public Enumerator
{
public:
VistaEnumerator();
~VistaEnumerator();
@@ -45,7 +45,7 @@ namespace Audio
int idAt(int index);
int indexOfDefaultDevice();
protected:
protected:
IMMDeviceCollection* mCollection;
IMMDevice* mDefaultDevice;
IMMDeviceEnumerator* mEnumerator;
@@ -54,11 +54,11 @@ namespace Audio
void enumerate();
IMMDevice* mapIndexToInterface(int index);
};
};
class XpEnumerator: public Enumerator
{
public:
class XpEnumerator: public Enumerator
{
public:
XpEnumerator();
~XpEnumerator();
@@ -70,25 +70,25 @@ namespace Audio
int idAt(int index);
int indexOfDefaultDevice();
protected:
protected:
std::vector<std::wstring> mNameList;
int mDirection;
};
};
class DSoundHelper
{
public:
class DSoundHelper
{
public:
static void checkComResult(HRESULT code);
static GUID deviceId2Guid(int deviceId, bool captureDevice);
};
};
#if !defined(_MSC_VER)
typedef struct IDirectSoundNotify8 *LPDIRECTSOUNDNOTIFY8;
typedef struct IDirectSoundNotify8 *LPDIRECTSOUNDNOTIFY8;
#endif
class DSoundInputDevice: public InputDevice
{
public:
class DSoundInputDevice: public InputDevice
{
public:
DSoundInputDevice(GUID deviceId);
~DSoundInputDevice();
@@ -102,7 +102,7 @@ namespace Audio
int readBuffer(void* buffer);
Format getFormat();
protected:
protected:
Mutex mGuard; /// Mutex to protect this instance.
LPDIRECTSOUNDCAPTURE8 mDevice;
LPDIRECTSOUNDCAPTUREBUFFER8 mBuffer;
@@ -134,11 +134,11 @@ namespace Audio
void closeDevice();
static void threadProc(void* arg);
};
};
class DSoundOutputDevice: public OutputDevice
{
public:
class DSoundOutputDevice: public OutputDevice
{
public:
DSoundOutputDevice(GUID deviceId);
~DSoundOutputDevice();
@@ -151,7 +151,7 @@ namespace Audio
bool closing();
Format getFormat();
protected:
protected:
Mutex mGuard; /// Mutex to protect this instance
int mDeviceID;
LPDIRECTSOUND8 mDevice;
@@ -181,7 +181,7 @@ namespace Audio
bool getMediaFrame();
static void threadProc(void* arg);
};
};
}
#endif

View File

@@ -5,10 +5,10 @@ set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (USE_NULL_UUID OFF CACHE BOOL "When enabled linking to libuuid is avoided")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
file(GLOB HELPER_LIB_SOURCES "*.cpp" "*.h")
file (GLOB HELPER_LIB_SOURCES "*.cpp" "*.h")
add_library(helper_lib ${HELPER_LIB_SOURCES})
target_include_directories(helper_lib PRIVATE ../../libs/ ../../engine ../)
target_compile_definitions(helper_lib PRIVATE -D_CRT_SECURE_NO_WARNINGS)
target_compile_definitions(helper_lib PRIVATE -D_CRT_SECURE_NO_WARNINGS -D_UNICODE)

View File

@@ -1,5 +1,6 @@
#include "HL_Usb.h"
#include "HL_Exception.h"
#ifdef TARGET_WIN
#include <devguid.h>
@@ -9,7 +10,7 @@
UsbChangeListener::UsbChangeListener()
:mNotifyHandle(NULL), mHiddenWindow(NULL), mDelegate(NULL)
{
wsprintf(mWindowClassName, ADR_WINDOW_CLASS_NAME, (unsigned int)rand());
wsprintfW(mWindowClassName, ADR_WINDOW_CLASS_NAME, (unsigned int)rand());
}
UsbChangeListener::~UsbChangeListener()
@@ -30,16 +31,16 @@ UsbChangeListener::Delegate* UsbChangeListener::getDelegate() const
void UsbChangeListener::start()
{
// Exposing Window to Mixer
WNDCLASSEX wcx;
memset( &wcx, 0, sizeof(WNDCLASSEX) );
wcx.cbSize = sizeof(WNDCLASSEX);
wcx.lpszClassName = mWindowClassName;
WNDCLASSEXW wcx;
memset( &wcx, 0, sizeof(WNDCLASSEXW) );
wcx.cbSize = sizeof(WNDCLASSEXW);
wcx.lpszClassName = mWindowClassName;
wcx.lpfnWndProc = (WNDPROC)ADRWindowProc;
::RegisterClassEx(&wcx);
::RegisterClassExW(&wcx);
wchar_t windowname[128];
wsprintf(windowname, ADR_WINDOW_NAME, rand());
mHiddenWindow = CreateWindow( mWindowClassName,
wsprintfW(windowname, ADR_WINDOW_NAME, rand());
mHiddenWindow = CreateWindowW( mWindowClassName,
windowname,
WS_POPUP | WS_DISABLED,
0, 0, 0, 0,
@@ -102,8 +103,8 @@ void UsbChangeListener::stop()
::DestroyWindow(mHiddenWindow);
mHiddenWindow = NULL;
::UnregisterClass(mWindowClassName, NULL);
::UnregisterClassW(mWindowClassName, NULL);
}
}
#endif
#endif