AudRecordLib
Namespaces | Defines
AudRecordCLI/AudRecordWrap.cpp File Reference

Implements the wrapper of the native IAudRecord interface. More...

#include "stdafx.h"
#include "AudRecordWrap.h"
#include "error.h"
#include "InterfaceWrap.h"
#include <exception>

Namespaces

namespace  AudRecordCLI

Defines

#define NATIVE_ENDPOINT_FROM_MANAGED(managed, native)
#define NATIVE_CODECCONFIG_FROM_MANAGED(managed, native)

Detailed Description

Implements the wrapper of the native IAudRecord interface.


Define Documentation

#define NATIVE_CODECCONFIG_FROM_MANAGED (   managed,
  native 
)
Value:
pin_ptr<const WCHAR> _name_string = PtrToStringChars(managed->Name); \
        { \
                IntPtr origUnknownPtr = Marshal::GetIUnknownForObject(managed->DescInterface); \
                IWMStreamConfig* pConfig = (static_cast<IWMStreamConfig*>(origUnknownPtr.ToPointer())); \
                /* We don't need a reference to persist, since managed->Interface */ \
                /* already has a reference that will outlive the call */ \
                Marshal::Release(origUnknownPtr); \
                IWMStreamConfig* pTest = NULL; \
                HRESULT hrQI = S_OK; \
                /* assert that the returned interface of the correct type */ \
                ASSERT((hrQI = pConfig->QueryInterface(&pTest), (pTest ? pTest->Release() : 0ul), SUCCEEDED(hrQI))); \
                native.pConfig = pConfig; \
                native.pName = _name_string; \
        }

Fills in a native CondecConfig struct using the info in a managed AudRecordCLI::CodecConfiguration struct. This isn't a function because the pin_ptr needs to live for the lifetime of the cstring it produces

#define NATIVE_ENDPOINT_FROM_MANAGED (   managed,
  native 
)
Value:
pin_ptr<const WCHAR> _name_string = PtrToStringChars(managed->Name); \
        { \
                IntPtr origUnknownPtr = Marshal::GetIUnknownForObject(managed->Interface); \
                IMMDevice* pMMDevice = (static_cast<IMMDevice*>(origUnknownPtr.ToPointer())); \
                /* We don't need a reference to persist, since managed->Interface */ \
                /* already has a reference that will outlive the call */ \
                Marshal::Release(origUnknownPtr); \
                IMMDevice* pTest = NULL; \
                HRESULT hrQI = S_OK; \
                /* assert that the returned interface of the correct type */ \
                ASSERT((hrQI = pMMDevice->QueryInterface(&pTest), (pTest ? pTest->Release() : 0ul), SUCCEEDED(hrQI))); \
                native.pEndPoint = pMMDevice; \
                native.pName = _name_string; \
        }

Fills in a native Endpoint struct using the info in a managed AudRecordCLI::Endpoint struct. This isn't a function because the pin_ptr needs to live for the lifetime of the cstring it produces

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Defines