json_t* OBSAPIMessageHandler::HandleGetVolumes(OBSAPIMessageHandler* handler, json_t* message) { json_t* ret = GetOkResponse(); json_object_set_new(ret, "mic-volume", json_real(OBSGetMicVolume())); json_object_set_new(ret, "mic-muted", json_boolean(OBSGetMicMuted())); json_object_set_new(ret, "desktop-volume", json_real(OBSGetDesktopVolume())); json_object_set_new(ret, "desktop-muted", json_boolean(OBSGetDesktopMuted())); return ret; }
void SaveInitialVolumes() { float dVol, mVol; bool dMuted, mMuted; if(!bPSVEnabled) return; dVol = OBSGetDesktopVolume(); mVol = OBSGetMicVolume(); dMuted = OBSGetDesktopMuted(); mMuted = OBSGetMicMuted(); config.SetFloat(TEXT("General"), TEXT("PrevDesktopVolume"), dVol); config.SetFloat(TEXT("General"), TEXT("PrevMicVolume"), mVol); config.SetInt(TEXT("General"), TEXT("PrevDesktopMuted"), dMuted ? 1 : 0); config.SetInt(TEXT("General"), TEXT("PrevMicMuted"), mMuted ? 1 : 0); OnDesktopVolumeChanged(dVol, dMuted, true); OnMicVolumeChanged(mVol, mMuted, true); }