int CActiveAEDSPDatabase::GetModes(AE_DSP_MODELIST &results, int modeType) { int iReturn(0); string strQuery=PrepareSQL("SELECT * FROM modes WHERE modes.iType=%i ORDER BY iPosition", modeType); m_pDS->query( strQuery.c_str() ); if (m_pDS->num_rows() > 0) { try { while (!m_pDS->eof()) { CActiveAEDSPModePtr mode = CActiveAEDSPModePtr(new CActiveAEDSPMode()); mode->m_iModeId = m_pDS->fv("idMode").get_asInt(); mode->m_iModeType = (AE_DSP_MODE_TYPE)m_pDS->fv("iType").get_asInt(); mode->m_iModePosition = m_pDS->fv("iPosition").get_asInt(); mode->m_iStreamTypeFlags = m_pDS->fv("iStreamTypeFlags").get_asInt(); mode->m_iBaseType = (AE_DSP_BASETYPE)m_pDS->fv("iBaseType").get_asInt(); mode->m_bIsEnabled = m_pDS->fv("bIsEnabled").get_asBool(); mode->m_strOwnIconPath = m_pDS->fv("sOwnIconPath").get_asString(); mode->m_strOverrideIconPath = m_pDS->fv("sOverrideIconPath").get_asString(); mode->m_iModeName = m_pDS->fv("iModeName").get_asInt(); mode->m_iModeSetupName = m_pDS->fv("iModeSetupName").get_asInt(); mode->m_iModeHelp = m_pDS->fv("iModeHelp").get_asInt(); mode->m_iModeDescription = m_pDS->fv("iModeDescription").get_asInt(); mode->m_strModeName = m_pDS->fv("sAddonModeName").get_asString(); mode->m_iAddonId = m_pDS->fv("iAddonId").get_asInt(); mode->m_iAddonModeNumber = m_pDS->fv("iAddonModeNumber").get_asInt(); mode->m_bHasSettingsDialog = m_pDS->fv("bHasSettings").get_asBool(); #ifdef ADSPDB_DEBUGGING CLog::Log(LOGDEBUG, "Audio DSP - %s - mode '%s' loaded from the database", __FUNCTION__, mode->m_strModeName.c_str()); #endif AE_DSP_ADDON addon; if (CActiveAEDSP::Get().GetAudioDSPAddon(mode->m_iAddonId, addon)) results.push_back(AE_DSP_MODEPAIR(mode, addon)); m_pDS->next(); ++iReturn; } m_pDS->close(); } catch (...) { CLog::Log(LOGERROR, "Audio DSP - %s - couldn't load modes from the database", __FUNCTION__); } } else { CLog::Log(LOGERROR, "Audio DSP - %s - query failed", __FUNCTION__); } m_pDS->close(); return iReturn; }
void CGUIDialogAudioDSPManager::Update() { CGUIDialogBusy* pDlgBusy = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY); if (!pDlgBusy) { helper_LogError(__FUNCTION__); return; } pDlgBusy->Open(); Clear(); AE_DSP_MODELIST modes; CActiveAEDSPDatabase db; if (!db.Open()) { pDlgBusy->Close(); CLog::Log(LOGERROR, "DSP Manager - %s - Could not open DSP database for update!", __FUNCTION__); return; } // construct a CFileItemList to pass 'em on to the list CFileItemList items; for (int i = 0; i < AE_DSP_MODE_TYPE_MAX; ++i) { int iModeType = dsp_mode_types[i].iModeType; modes.clear(); db.GetModes(modes, iModeType); // No modes available, nothing to do. if (!modes.empty()) { CFileItemPtr item(new CFileItem()); item->SetLabel(g_localizeStrings.Get(dsp_mode_types[i].iName)); item->SetLabel2(g_localizeStrings.Get(dsp_mode_types[i].iDescription)); item->SetProperty("currentMode", dsp_mode_types[i].sModeType); items.Add(item); AE_DSP_MENUHOOK_CAT menuHook = helper_GetMenuHookCategory(iModeType); int continuesNo = 1; for (unsigned int iModePtr = 0; iModePtr < modes.size(); iModePtr++) { CFileItem *listItem = helper_CreateModeListItem(modes[iModePtr].first, menuHook, &continuesNo); if (listItem) { CFileItemPtr pItem(listItem); if (pItem->GetProperty("ActiveMode").asBoolean()) { m_activeItems[iModeType]->Add(pItem); } else { m_availableItems[iModeType]->Add(pItem); } } ProcessRenderLoop(false); } m_availableItems[iModeType]->Sort(SortByLabel, SortOrderAscending); if (iModeType == AE_DSP_MODE_TYPE_MASTER_PROCESS) { m_activeItems[iModeType]->Sort(SortByLabel, SortOrderAscending); } } } CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST_MODE_SELECTION, 0, 0, &items); OnMessage(msg); db.Close(); pDlgBusy->Close(); }
void CGUIDialogAudioDSPManager::Update() { CGUIDialogBusy* pDlgBusy = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY); if (!pDlgBusy) { helper_LogError(__FUNCTION__); return; } pDlgBusy->Open(); Clear(); AE_DSP_MODELIST modes; CActiveAEDSPDatabase db; if (!db.Open()) { pDlgBusy->Close(); CLog::Log(LOGERROR, "DSP Manager - %s - Could not open DSP database for update!", __FUNCTION__); return; } for (int iModeType = 0; iModeType < AE_DSP_MODE_TYPE_MAX; iModeType++) { modes.clear(); db.GetModes(modes, iModeType); // No modes available, nothing to do. if (!modes.empty()) { AE_DSP_MENUHOOK_CAT menuHook = helper_GetMenuHookCategory(iModeType); int continuesNo = 1; for (unsigned int iModePtr = 0; iModePtr < modes.size(); iModePtr++) { CFileItem *listItem = helper_CreateModeListItem(modes[iModePtr].first, menuHook, &continuesNo); if (listItem) { CFileItemPtr pItem(listItem); if (pItem->GetProperty("ActiveMode").asBoolean()) { m_activeItems[iModeType]->Add(pItem); } else { m_availableItems[iModeType]->Add(pItem); } } g_windowManager.ProcessRenderLoop(false); } m_availableItems[iModeType]->Sort(SortByLabel, SortOrderAscending); if (iModeType == AE_DSP_MODE_TYPE_MASTER_PROCESS) { m_activeItems[iModeType]->Sort(SortByLabel, SortOrderAscending); } } } db.Close(); pDlgBusy->Close(); }