Esempio n. 1
0
bool EnumDevices(const GUID &type, EnumDeviceCallback callback, void *param)
{
	CComPtr<ICreateDevEnum> deviceEnum;
	CComPtr<IEnumMoniker>   enumMoniker;
	CComPtr<IMoniker>       deviceInfo;
	HRESULT                 hr;
	DWORD                   count = 0;

	hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
		CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void**)&deviceEnum);
	if (FAILED(hr)) {
		WarningHR(L"EnumAudioDevices: Could not create "
		          L"ICreateDeviceEnum", hr);
		return false;
	}

	hr = deviceEnum->CreateClassEnumerator(type, &enumMoniker, 0);
	if (FAILED(hr)) {
		WarningHR(L"EnumAudioDevices: CreateClassEnumerator failed",
				hr);
		return false;
	}

	if (hr == S_FALSE)
		return true;

	while (enumMoniker->Next(1, &deviceInfo, &count) == S_OK) {
		if (!EnumDevice(deviceInfo, callback, param))
			return true;

		deviceInfo.Release();
	}

	return true;
}
Esempio n. 2
0
bool SVGroupview::triggerSlot(WObject *sender, const WSlot_ *slot, void **args)
{
  if (slot == slots_ + 0) {
    sender_ = sender;    MenuItemRequestProc(*((MENU_REQUEST *)args[0]));
    return true;
  }
  if (slot == slots_ + 1) {
    sender_ = sender;    backParent();
    return true;
  }
  if (slot == slots_ + 2) {
    sender_ = sender;    AddNewGroup();
    return true;
  }
  if (slot == slots_ + 3) {
    sender_ = sender;    EditGroupParam(*((string *)args[0]));
    return true;
  }
  if (slot == slots_ + 4) {
    sender_ = sender;    showIconView();
    return true;
  }
  if (slot == slots_ + 5) {
    sender_ = sender;    showListView();
    return true;
  }
  if (slot == slots_ + 6) {
    sender_ = sender;    AddGroupData(*((string *)args[0]), *((string *)args[1]));
    return true;
  }
  if (slot == slots_ + 7) {
    sender_ = sender;    EditGroupData(*((string *)args[0]), *((string *)args[1]));
    return true;
  }
  if (slot == slots_ + 8) {
    sender_ = sender;    ChangeGroupState(*((string *)args[0]), *((int *)args[1]));
    return true;
  }
  if (slot == slots_ + 9) {
    sender_ = sender;    showMainView();
    return true;
  }
  if (slot == slots_ + 10) {
    sender_ = sender;    AddNewDevice();
    return true;
  }
  if (slot == slots_ + 11) {
    sender_ = sender;    AddDevice2nd(*((string *)args[0]));
    return true;
  }
  if (slot == slots_ + 12) {
    sender_ = sender;    EnumDevice(*((string *)args[0]));
    return true;
  }
  if (slot == slots_ + 13) {
    sender_ = sender;    EditDeviceByIndex(*((string *)args[0]));
    return true;
  }
  if (slot == slots_ + 14) {
    sender_ = sender;    AddNewDeviceSucc(*((string *)args[0]), *((string *)args[1]));
    return true;
  }
  if (slot == slots_ + 15) {
    sender_ = sender;    EditDeviceSuccByID(*((string *)args[0]), *((string *)args[1]));
    return true;
  }
  if (slot == slots_ + 16) {
    sender_ = sender;    ChangeDeviceState(*((string *)args[0]), *((int *)args[1]));
    return true;
  }
  if (slot == slots_ + 17) {
    sender_ = sender;    EnterDeviceByID(*((string *)args[0]));
    return true;
  }
  if (slot == slots_ + 18) {
    sender_ = sender;    EnterNewDeviceByID(*((string *)args[0]));
    return true;
  }
  if (slot == slots_ + 19) {
    sender_ = sender;    AddMonitor(*((string *)args[0]), *((string *)args[1]));
    return true;
  }
  if (slot == slots_ + 20) {
    sender_ = sender;    CancelAddMonitor();
    return true;
  }
  if (slot == slots_ + 21) {
    sender_ = sender;    AddNewMonitorByType(*((int *)args[0]), *((string *)args[1]));
    return true;
  }
  if (slot == slots_ + 22) {
    sender_ = sender;    AddMonitorSucc(*((string *)args[0]), *((string *)args[1]));
    return true;
  }
  if (slot == slots_ + 23) {
    sender_ = sender;    EditMonitorSuccByID(*((string *)args[0]), *((string *)args[1]));
    return true;
  }
  if (slot == slots_ + 24) {
    sender_ = sender;    EditMonitorByIndex(*((string *)args[0]));
    return true;
  }
  if (slot == slots_ + 25) {
    sender_ = sender;    BackMonitorList();
    return true;
  }
  if (slot == slots_ + 26) {
    sender_ = sender;    BackGroupDeviceList(*((string *)args[0]));
    return true;
  }
  if (slot == slots_ + 27) {
    sender_ = sender;    EditSVSESuccByIndex(*((string *)args[0]), *((string *)args[1]));
    return true;
  }
  if (slot == slots_ + 28) {
    sender_ = sender;    EditSVSEByIndex(*((string *)args[0]));
    return true;
  }
  if (slot == slots_ + 29) {
    sender_ = sender;    enterSVSE(*((string *)args[0]));
    return true;
  }
  if (slot == slots_ + 30) {
    sender_ = sender;    enterGroup(*((string *)args[0]));
    return true;
  }
  if (slot == slots_ + 31) {
    sender_ = sender;    backSVSEView();
    return true;
  }
  if (slot == slots_ + 32) {
    sender_ = sender;    DelDeviceByIdProc(*((string *)args[0]), *((string *)args[1]));
    return true;
  }
  if (slot == slots_ + 33) {
    sender_ = sender;    DelGroupByIdProc(*((string *)args[0]), *((string *)args[1]));
    return true;
  }
  if (slot == slots_ + 34) {
    sender_ = sender;    BatchAddMonitor();
    return true;
  }
  if (slot == slots_ + 35) {
    sender_ = sender;    ReloadCurrentView();
    return true;
  }
  if (slot == slots_ + 36) {
    sender_ = sender;    SortObjects(*((int *)args[0]));
    return true;
  }
  if (slot == slots_ + 37) {
    sender_ = sender;    RefreshCurrentList();
    return true;
  }
  if (slot == slots_ + 38) {
    sender_ = sender;    enterGroupByID(*((const std::string *)args[0]));
    return true;
  }
  if (slot == slots_ + 39) {
    sender_ = sender;    Translate();
    return true;
  }
  if (slot == slots_ + 40) {
    sender_ = sender;    ExChange();
    return true;
  }
  if (slot == slots_ + 41) {
    sender_ = sender;    CopyNewDeviceSucc(*((string *)args[0]), *((string *)args[1]));
    return true;
  }
  if (slot == slots_ + 42) {
    sender_ = sender;    CopyNewMonitorSucc(*((string *)args[0]), *((string *)args[1]));
    return true;
  }
  return WContainerWidget::triggerSlot(sender, slot, args);
}