#pragma once

class  IKpiConfig;
class  IKpiDeviceEnumerator;
struct IMMDeviceEnumerator;
struct IMMDevice;
class KbWasapiEnumerator
{
public:
    enum{
        MAX_DEVICE_LENGTH = 256,//デバイス名の最大長
        MAX_ID_LENGTH = 128,    //識別文字列名の最大長
    };
private:
    struct WASAPI_DEVICE
    {
        wchar_t szDeviceName[MAX_DEVICE_LENGTH];//デバイス名
        wchar_t szId[MAX_ID_LENGTH];            //識別文字列
    };
    IMMDeviceEnumerator *m_pEnumerator;
    WASAPI_DEVICE *m_pDevices;
    int  m_nCount;//デバイスの数
    IKpiConfig *m_pConfig;
public:
    enum{
        MODE_UNDEFINED = -1,
        MODE_EVENT = 0,
        MODE_PUSH = 1
    };
    void __fastcall EnumerateDevices(IKpiDeviceEnumerator *pDeviceEnumerator);
    void __fastcall GetMmDevice(const wchar_t *cszDeviceName, const wchar_t *cszId, 
                                IMMDevice **ppMmDevice, 
                                int *pMode);
    void __fastcall GetDeviceName(int nIndex, 
                                  wchar_t *pszDeviceName, int nSizeDevice,
                                  wchar_t *pszId, int nSizeId);
    KbWasapiEnumerator(IKpiConfig *pConfigd);
    ~KbWasapiEnumerator(void);
};
