Add error system to EnableStudioMode and DisableStudioMode

As talked about in #144 this adds a check to `EnableStudioMode` and `DisableStudioMode` in order to be consistent with `StartRecording`/`StopRecording`
This commit is contained in:
tt2468 2020-05-08 15:30:40 -07:00 committed by GitHub
parent b1df0dca97
commit a3bc9f768a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,6 +133,9 @@ RpcResponse WSRequestHandler::TransitionToProgram(const RpcRequest& request) {
* @since 4.1.0
*/
RpcResponse WSRequestHandler::EnableStudioMode(const RpcRequest& request) {
if (obs_frontend_preview_program_mode_active()) {
return request.failed("studio mode already active");
}
obs_queue_task(OBS_TASK_UI, [](void* param) {
obs_frontend_set_preview_program_mode(true);
@ -150,6 +153,9 @@ RpcResponse WSRequestHandler::EnableStudioMode(const RpcRequest& request) {
* @since 4.1.0
*/
RpcResponse WSRequestHandler::DisableStudioMode(const RpcRequest& request) {
if (!obs_frontend_preview_program_mode_active()) {
return request.failed("studio mode not active");
}
obs_queue_task(OBS_TASK_UI, [](void* param) {
obs_frontend_set_preview_program_mode(false);