Commit 701e84ad authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

InstanceCX: Initialize MMDevice

parent a909c5bc
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <collection.h> #include <collection.h>
//HACK HACK HACK //HACK HACK HACK
#include "MMDeviceLocator.h"
using namespace Windows::Graphics::Display; using namespace Windows::Graphics::Display;
namespace libVLCX namespace libVLCX
...@@ -32,7 +33,7 @@ namespace libVLCX ...@@ -32,7 +33,7 @@ namespace libVLCX
Instance::Instance(Windows::Foundation::Collections::IVector<Platform::String^>^ argv, SwapChainPanel^ panel) Instance::Instance(Windows::Foundation::Collections::IVector<Platform::String^>^ argv, SwapChainPanel^ panel)
: m_chainPanel(panel) : m_chainPanel(panel)
{ {
int extraArgs = 4; int extraArgs = 5;
auto c_argv = new char*[argv->Size + extraArgs]; auto c_argv = new char*[argv->Size + extraArgs];
unsigned int i = 0; unsigned int i = 0;
for (auto arg : argv) for (auto arg : argv)
...@@ -57,6 +58,27 @@ namespace libVLCX ...@@ -57,6 +58,27 @@ namespace libVLCX
m_dxManager->CreateSwapPanel(m_chainPanel); m_dxManager->CreateSwapPanel(m_chainPanel);
UpdateSize(m_chainPanel->ActualWidth, m_chainPanel->ActualHeight); UpdateSize(m_chainPanel->ActualWidth, m_chainPanel->ActualHeight);
ComPtr<MMDeviceLocator> audioReg = Make<MMDeviceLocator>();
audioReg->m_AudioClient = NULL;
audioReg->m_audioClientReady = CreateEventEx(NULL, TEXT("AudioClientReady"), 0, EVENT_ALL_ACCESS);
audioReg->RegisterForWASAPI();
void *addr = NULL;
DWORD res;
while ((res = WaitForSingleObjectEx(audioReg->m_audioClientReady, 1000, TRUE)) == WAIT_TIMEOUT) {
OutputDebugStringW(L"Waiting for audio\n");
}
CloseHandle(audioReg->m_audioClientReady);
if (res != WAIT_OBJECT_0) {
OutputDebugString(TEXT("Failure while waiting for audio client"));
return;
}
char ptr_astring[40];
sprintf_s(ptr_astring, "--winstore-audioclient=0x%p", audioReg->m_AudioClient);
argv[nbArgs++] = _strdup(ptr_astring);
char ptr_d2dstring[40]; char ptr_d2dstring[40];
sprintf_s(ptr_d2dstring, "--winrt-d2dcontext=0x%p", m_dxManager->cp_d2dContext); sprintf_s(ptr_d2dstring, "--winrt-d2dcontext=0x%p", m_dxManager->cp_d2dContext);
argv[nbArgs++] = _strdup(ptr_d2dstring); argv[nbArgs++] = _strdup(ptr_d2dstring);
......
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