bool CPeripherals::OnAction(const CAction &action) { if (action.GetID() == ACTION_MUTE) { return ToggleMute(); } if (SupportsCEC() && action.GetAmount() && (action.GetID() == ACTION_VOLUME_UP || action.GetID() == ACTION_VOLUME_DOWN)) { vector<CPeripheral *> peripherals; if (GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) { for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < peripherals.size(); iPeripheralPtr++) { CPeripheralCecAdapter *cecDevice = (CPeripheralCecAdapter *) peripherals.at(iPeripheralPtr); if (cecDevice && cecDevice->HasAudioControl()) { if (action.GetID() == ACTION_VOLUME_UP) cecDevice->VolumeUp(); else cecDevice->VolumeDown(); return true; } } } } return false; }
bool CPeripherals::OnAction(const CAction &action) { if (action.GetID() == ACTION_MUTE) { return ToggleMute(); } if (SupportsCEC() && action.GetAmount() && (action.GetID() == ACTION_VOLUME_UP || action.GetID() == ACTION_VOLUME_DOWN)) { std::vector<CPeripheral *> peripherals; if (GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) { for (auto& peripheral : peripherals) { CPeripheralCecAdapter *cecDevice = reinterpret_cast<CPeripheralCecAdapter*>(peripheral); if (cecDevice && cecDevice->HasAudioControl()) { if (action.GetID() == ACTION_VOLUME_UP) cecDevice->VolumeUp(); else cecDevice->VolumeDown(); return true; } } } } return false; }
bool CPeripherals::ToggleMute(void) { vector<CPeripheral *> peripherals; if (SupportsCEC() && GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) { for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < peripherals.size(); iPeripheralPtr++) { CPeripheralCecAdapter *cecDevice = (CPeripheralCecAdapter *) peripherals.at(iPeripheralPtr); if (cecDevice && cecDevice->HasAudioControl()) { cecDevice->ToggleMute(); return true; } } } return false; }
bool CPeripherals::ToggleMute() { std::vector<CPeripheral *> peripherals; if (SupportsCEC() && GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) { for (auto& peripheral : peripherals) { CPeripheralCecAdapter *cecDevice = reinterpret_cast<CPeripheralCecAdapter*>(peripheral); if (cecDevice && cecDevice->HasAudioControl()) { cecDevice->ToggleMute(); return true; } } } return false; }