json_t* OBSAPIMessageHandler::HandleGetStreamingStatus(OBSAPIMessageHandler* handler, json_t* message) { json_t* ret = GetOkResponse(); json_object_set_new(ret, "streaming", json_boolean(OBSGetStreaming())); json_object_set_new(ret, "preview-only", json_boolean(OBSGetPreviewOnly())); return ret; }
void NoiseGateSettings::MsgInitDialog() { HWND ctrlHwnd; // Disable the filter if we are currently streaming if(OBSGetStreaming()) parent->isDisabledFromConfig = true; LocalizeWindow(hwnd); // Load settings from parent object RefreshConfig(); // Volume preview // Custom drawn progress bar, beware, static member ctrlHwnd = GetDlgItem(hwnd, IDC_CURVOL); SetWindowSubclass(ctrlHwnd, PBSubclassProc, 0, 0); SendMessage(ctrlHwnd, PBM_SETRANGE32, 0, CURVOL_RESOLUTION); // Bottom = 0, top = CURVOL_RESOLUTION RepaintVolume(); // Repaint immediately SetTimer(hwnd, REPAINT_TIMER_ID, 16, NULL); // Repaint every 16ms (~60fps) // Enable/disable stream button ctrlHwnd = GetDlgItem(hwnd, IDC_PREVIEWON); if(OBSGetStreaming()) { SetWindowText(ctrlHwnd, Str("Plugins.NoiseGate.DisablePreview")); // If not in preview mode then prevent the user from stopping the stream from this window if(OBSGetPreviewOnly()) EnableWindow(ctrlHwnd, TRUE); else EnableWindow(ctrlHwnd, FALSE); } else { SetWindowText(ctrlHwnd, Str("Plugins.NoiseGate.EnablePreview")); EnableWindow(ctrlHwnd, TRUE); } SetChangedSettings(false); }
/** * Updates the current audio volume control. */ void NoiseGateSettings::RepaintVolume() { float rms, max, peak; rms = max = peak = -96.0f; if(OBSGetStreaming()) OBSGetCurMicVolumeStats(&rms, &max, &peak); //SetWindowText(GetDlgItem(hwnd, IDC_OPENTHRES_DB), FormattedString(TEXT("%.3f"), max)); //SetWindowText(GetDlgItem(hwnd, IDC_CLOSETHRES_DB), FormattedString(TEXT("%d"), (int)((max + 96.0f) * 4.0f))); SendMessage(GetDlgItem(hwnd, IDC_CURVOL), PBM_SETPOS, (int)((max + 96.0f) * 4.0f), 0); }
INT_PTR NoiseGateSettings::MsgClicked(int controlId, int code, HWND controlHwnd) { switch(controlId) { default: // Unknown button break; case IDC_ATTACKTIME_EDIT: case IDC_HOLDTIME_EDIT: case IDC_RELEASETIME_EDIT: if(code == EN_CHANGE) // Modified the text box SetChangedSettings(true); break; case IDC_ENABLEGATE: if(code == BN_CLICKED) // Changed the check box SetChangedSettings(true); break; case IDC_PREVIEWON: // Toggle stream preview if(OBSGetStreaming()) { OBSStartStopPreview(); parent->isDisabledFromConfig = false; SetWindowText(controlHwnd, Str("Plugins.NoiseGate.EnablePreview")); } else { OBSStartStopPreview(); parent->isDisabledFromConfig = true; SetWindowText(controlHwnd, Str("Plugins.NoiseGate.DisablePreview")); } return TRUE; } return FALSE; }