From f61bc809ddd38b530954a94eaefb63d423ceb6d6 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Mon, 27 Apr 2020 08:30:39 -0700 Subject: [PATCH 01/27] [Bug Fix] Fix FreeType2 source type recognition OBS appears to be using a new format for the FreeType2 source, so we add the new kinds. One thing I'm unsure on is if anything still uses the old naming stuff `text_ft2`/`text_ft2_v2`, since if not then we should not check --- src/WSRequestHandler_Sources.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WSRequestHandler_Sources.cpp b/src/WSRequestHandler_Sources.cpp index 579f76b4..8dfdef98 100644 --- a/src/WSRequestHandler_Sources.cpp +++ b/src/WSRequestHandler_Sources.cpp @@ -15,7 +15,7 @@ bool isTextGDIPlusSource(const QString& sourceKind) bool isTextFreeType2Source(const QString& sourceKind) { - return (sourceKind == "text_ft2" || sourceKind == "text_ft2_v2"); + return (sourceKind == "text_ft2" || sourceKind == "text_ft2_v2" || sourceKind == "text_ft2_source" || sourceKind == "text_ft2_source_v2"); } /** From 47492c3fa267ed5686b46779489921bea19e127f Mon Sep 17 00:00:00 2001 From: tt2468 Date: Thu, 30 Apr 2020 09:46:22 -0700 Subject: [PATCH 02/27] Implement fix for Ubuntu users #478 Broke building on linux. This implements a new variable to apply the fix. --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5648a963..a6bbd38f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,8 +187,13 @@ if(UNIX AND NOT APPLE) file(GLOB locale_files data/locale/*.ini) - install(TARGETS obs-websocket - LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/obs-plugins") + if(${USE_UBUNTU_FIX}) + install(TARGETS obs-websocket + LIBRARY DESTINATION "/usr/lib/obs-plugins") + else() + install(TARGETS obs-websocket + LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/obs-plugins") + endif() install(FILES ${locale_files} DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/obs/obs-plugins/obs-websocket/locale") From ba75c45cee1d7d6fcf0a7c251fe78e618b0569be Mon Sep 17 00:00:00 2001 From: tt2468 Date: Thu, 30 Apr 2020 09:58:10 -0700 Subject: [PATCH 03/27] Update build docs to add Ubuntu fix flag --- BUILDING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILDING.md b/BUILDING.md index 83f93a99..0770fd59 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -24,7 +24,7 @@ sudo apt-get install libboost-all-dev git clone --recursive https://github.com/Palakis/obs-websocket.git cd obs-websocket mkdir build && cd build -cmake -DLIBOBS_INCLUDE_DIR="" -DCMAKE_INSTALL_PREFIX=/usr .. +cmake -DLIBOBS_INCLUDE_DIR="" -DCMAKE_INSTALL_PREFIX=/usr -DUSE_UBUNTU_FIX=true .. make -j4 sudo make install ``` From 97836cc5eb402921ccc7f110a7c9abfb10376d91 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Thu, 30 Apr 2020 10:58:10 -0700 Subject: [PATCH 04/27] Remove extra source type strings --- src/WSRequestHandler_Sources.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WSRequestHandler_Sources.cpp b/src/WSRequestHandler_Sources.cpp index 8dfdef98..ae926ef6 100644 --- a/src/WSRequestHandler_Sources.cpp +++ b/src/WSRequestHandler_Sources.cpp @@ -15,7 +15,7 @@ bool isTextGDIPlusSource(const QString& sourceKind) bool isTextFreeType2Source(const QString& sourceKind) { - return (sourceKind == "text_ft2" || sourceKind == "text_ft2_v2" || sourceKind == "text_ft2_source" || sourceKind == "text_ft2_source_v2"); + return (sourceKind == "text_ft2_source" || sourceKind == "text_ft2_source_v2"); } /** From b2aa54f3f8ac145bea11bbadd42dc1c00d994543 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Thu, 30 Apr 2020 16:25:31 -0700 Subject: [PATCH 05/27] Add obs-websocket-http obs-websocket-http is a simple python script which allows users to run obs-websocket requests using an http-based api system. It is very simple and is a useful converter. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a0afb404..1c210f96 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ It is **highly recommended** to protect obs-websocket with a password against un ### For developers The server is a typical Websockets server running by default on port 4444 (the port number can be changed in the Settings dialog). -The protocol understood by the server is documented in [PROTOCOL.md](docs/generated/protocol.md). +The protocol understood by the server is documented in [PROTOCOL.md](docs/generated/protocol.md). Here's a list of available language APIs for obs-websocket : - Javascript (browser & nodejs): [obs-websocket-js](https://github.com/haganbmj/obs-websocket-js) by Brendan Hagan @@ -36,6 +36,7 @@ Here's a list of available language APIs for obs-websocket : - Python 3.6+ with asyncio: [simpleobsws](https://github.com/IRLToolkit/simpleobsws) by tt2468 - Java 8+: [obs-websocket-java](https://github.com/Twasi/websocket-obs-java) by TwasiNET - Golang: [go-obs-websocket](https://github.com/christopher-dG/go-obs-websocket) by Chris de Graaf +- HTTP API: [obs-websocket-http](https://github.com/IRLToolkit/obs-websocket-http) by tt2468 I'd like to know what you're building with or for obs-websocket. If you do something in this fashion, feel free to drop me an email at `stephane /dot/ lepin /at/ gmail /dot/ com` ! From 4ded810ba97c0d721590148e0c55cd5e5de18951 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Thu, 30 Apr 2020 20:09:13 -0700 Subject: [PATCH 06/27] Add optional `fileFormat` and `fileCompressionRatio` parameters to `TakeSourceScreenshot` --- src/WSRequestHandler_Sources.cpp | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/WSRequestHandler_Sources.cpp b/src/WSRequestHandler_Sources.cpp index 579f76b4..29ee2882 100644 --- a/src/WSRequestHandler_Sources.cpp +++ b/src/WSRequestHandler_Sources.cpp @@ -1437,6 +1437,8 @@ RpcResponse WSRequestHandler::SetSourceFilterVisibility(const RpcRequest& reques * @param {String} `sourceName` Source name. Note that, since scenes are also sources, you can also provide a scene name. * @param {String (optional)} `embedPictureFormat` Format of the Data URI encoded picture. Can be "png", "jpg", "jpeg" or "bmp" (or any other value supported by Qt's Image module) * @param {String (optional)} `saveToFilePath` Full file path (file extension included) where the captured image is to be saved. Can be in a format different from `pictureFormat`. Can be a relative path. +* @param {String (optional)} `fileFormat` Format to save the image file as. If not specified, tries to guess based on file extension. +* @param {int (optional)} `fileCompressionQuality` Compression ratio between -1 and 100 to save the file with. -1 is automatic, 1 is smallest file/most compression, 100 is largest file/least compression. Varies with image type. * @param {int (optional)} `width` Screenshot width. Defaults to the source's base width. * @param {int (optional)} `height` Screenshot height. Defaults to the source's base height. * @@ -1544,7 +1546,7 @@ RpcResponse WSRequestHandler::TakeSourceScreenshot(const RpcRequest& request) { QByteArrayList supportedFormats = QImageWriter::supportedImageFormats(); if (!supportedFormats.contains(pictureFormat)) { - QString errorMessage = QString("Unsupported picture format: %1").arg(pictureFormat); + QString errorMessage = QString("unsupported picture format: %1").arg(pictureFormat); return request.failed(errorMessage.toUtf8()); } @@ -1552,7 +1554,7 @@ RpcResponse WSRequestHandler::TakeSourceScreenshot(const RpcRequest& request) { QBuffer buffer(&encodedImgBytes); buffer.open(QBuffer::WriteOnly); if (!sourceImage.save(&buffer, pictureFormat)) { - return request.failed("Embed image encoding failed"); + return request.failed("embed image encoding failed"); } buffer.close(); @@ -1569,7 +1571,31 @@ RpcResponse WSRequestHandler::TakeSourceScreenshot(const RpcRequest& request) { QFileInfo filePathInfo(filePathStr); QString absoluteFilePath = filePathInfo.absoluteFilePath(); - if (!sourceImage.save(absoluteFilePath)) { + const char* fileFormat; + if (request.hasField("fileFormat")) { + fileFormat = obs_data_get_string(request.parameters(), "fileFormat"); + QByteArrayList supportedFormats = QImageWriter::supportedImageFormats(); + + if (!supportedFormats.contains(fileFormat)) { + QString errorMessage = QString("unsupported file format: %1").arg(fileFormat); + return request.failed(errorMessage.toUtf8()); + } + } + else { + fileFormat = nullptr; + } + + int fileCompressionQuality {-1}; + if (request.hasField("fileCompressionQuality")) { + fileCompressionQuality = obs_data_get_int(request.parameters(), "fileCompressionQuality"); + + if (fileCompressionQuality < -1 || fileCompressionQuality > 100) { + QString errorMessage = QString("compression quality out of range: %1").arg(fileCompressionQuality); + return request.failed(errorMessage.toUtf8()); + } + } + + if (!sourceImage.save(absoluteFilePath, fileFormat, fileCompressionQuality)) { return request.failed("Image save failed"); } obs_data_set_string(response, "imageFile", absoluteFilePath.toUtf8()); From 333ffa0e895fb16300b84b9b0c4acf7125534334 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Thu, 30 Apr 2020 20:17:11 -0700 Subject: [PATCH 07/27] `compressionQuality` should be for embed and file saving --- src/WSRequestHandler_Sources.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/WSRequestHandler_Sources.cpp b/src/WSRequestHandler_Sources.cpp index 29ee2882..06f33380 100644 --- a/src/WSRequestHandler_Sources.cpp +++ b/src/WSRequestHandler_Sources.cpp @@ -1438,7 +1438,7 @@ RpcResponse WSRequestHandler::SetSourceFilterVisibility(const RpcRequest& reques * @param {String (optional)} `embedPictureFormat` Format of the Data URI encoded picture. Can be "png", "jpg", "jpeg" or "bmp" (or any other value supported by Qt's Image module) * @param {String (optional)} `saveToFilePath` Full file path (file extension included) where the captured image is to be saved. Can be in a format different from `pictureFormat`. Can be a relative path. * @param {String (optional)} `fileFormat` Format to save the image file as. If not specified, tries to guess based on file extension. -* @param {int (optional)} `fileCompressionQuality` Compression ratio between -1 and 100 to save the file with. -1 is automatic, 1 is smallest file/most compression, 100 is largest file/least compression. Varies with image type. +* @param {int (optional)} `compressionQuality` Compression ratio between -1 and 100 to write the image with. -1 is automatic, 1 is smallest file/most compression, 100 is largest file/least compression. Varies with image type. * @param {int (optional)} `width` Screenshot width. Defaults to the source's base width. * @param {int (optional)} `height` Screenshot height. Defaults to the source's base height. * @@ -1541,6 +1541,16 @@ RpcResponse WSRequestHandler::TakeSourceScreenshot(const RpcRequest& request) { OBSDataAutoRelease response = obs_data_create(); + int compressionQuality {-1}; + if (request.hasField("compressionQuality")) { + compressionQuality = obs_data_get_int(request.parameters(), "compressionQuality"); + + if (compressionQuality < -1 || compressionQuality > 100) { + QString errorMessage = QString("compression quality out of range: %1").arg(compressionQuality); + return request.failed(errorMessage.toUtf8()); + } + } + if (request.hasField("embedPictureFormat")) { const char* pictureFormat = obs_data_get_string(request.parameters(), "embedPictureFormat"); @@ -1553,7 +1563,7 @@ RpcResponse WSRequestHandler::TakeSourceScreenshot(const RpcRequest& request) { QByteArray encodedImgBytes; QBuffer buffer(&encodedImgBytes); buffer.open(QBuffer::WriteOnly); - if (!sourceImage.save(&buffer, pictureFormat)) { + if (!sourceImage.save(&buffer, pictureFormat, compressionQuality)) { return request.failed("embed image encoding failed"); } buffer.close(); @@ -1585,17 +1595,7 @@ RpcResponse WSRequestHandler::TakeSourceScreenshot(const RpcRequest& request) { fileFormat = nullptr; } - int fileCompressionQuality {-1}; - if (request.hasField("fileCompressionQuality")) { - fileCompressionQuality = obs_data_get_int(request.parameters(), "fileCompressionQuality"); - - if (fileCompressionQuality < -1 || fileCompressionQuality > 100) { - QString errorMessage = QString("compression quality out of range: %1").arg(fileCompressionQuality); - return request.failed(errorMessage.toUtf8()); - } - } - - if (!sourceImage.save(absoluteFilePath, fileFormat, fileCompressionQuality)) { + if (!sourceImage.save(absoluteFilePath, fileFormat, compressionQuality)) { return request.failed("Image save failed"); } obs_data_set_string(response, "imageFile", absoluteFilePath.toUtf8()); From 8d88bc19eda31a3c0a0826afbd3539f760fa336f Mon Sep 17 00:00:00 2001 From: tt2468 Date: Fri, 8 May 2020 13:15:24 -0700 Subject: [PATCH 08/27] Deprecate SetBrowserSourceProperties and GetBrowserSourceProperties Both of these requests are doing essentially the same thing as `GetSourceSettings` and `SetSourceSettings`, so there is no reason to have the extra bloat. --- src/WSRequestHandler_Sources.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/WSRequestHandler_Sources.cpp b/src/WSRequestHandler_Sources.cpp index 579f76b4..0d49053d 100644 --- a/src/WSRequestHandler_Sources.cpp +++ b/src/WSRequestHandler_Sources.cpp @@ -919,6 +919,7 @@ RpcResponse WSRequestHandler::SetTextFreetype2Properties(const RpcRequest& reque * @name GetBrowserSourceProperties * @category sources * @since 4.1.0 + * @deprecated Since 4.8.0. Prefer the use of GetSourceSettings. */ RpcResponse WSRequestHandler::GetBrowserSourceProperties(const RpcRequest& request) { @@ -960,6 +961,7 @@ RpcResponse WSRequestHandler::GetBrowserSourceProperties(const RpcRequest& reque * @api requests * @name SetBrowserSourceProperties * @category sources + * @deprecated Since 4.8.0. Prefer the use of SetSourceSettings. * @since 4.1.0 */ RpcResponse WSRequestHandler::SetBrowserSourceProperties(const RpcRequest& request) From a3bc9f768ab0e1d071b1daa5b5cba40c900986dd Mon Sep 17 00:00:00 2001 From: tt2468 Date: Fri, 8 May 2020 15:30:40 -0700 Subject: [PATCH 09/27] 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` --- src/WSRequestHandler_StudioMode.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/WSRequestHandler_StudioMode.cpp b/src/WSRequestHandler_StudioMode.cpp index fb958f3b..badae29d 100644 --- a/src/WSRequestHandler_StudioMode.cpp +++ b/src/WSRequestHandler_StudioMode.cpp @@ -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); From 728ea1670185972bbf21a46a447c80521f34350d Mon Sep 17 00:00:00 2001 From: tt2468 Date: Sun, 10 May 2020 18:39:24 -0700 Subject: [PATCH 10/27] Introduce `useDecibel` bool to `GetVolume` and `SetVolume` to give a better, built-in option for people to use decibels of attenuation instead of amplitude. --- src/WSRequestHandler_Sources.cpp | 53 +++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/src/WSRequestHandler_Sources.cpp b/src/WSRequestHandler_Sources.cpp index 579f76b4..44bf1b7c 100644 --- a/src/WSRequestHandler_Sources.cpp +++ b/src/WSRequestHandler_Sources.cpp @@ -156,12 +156,13 @@ RpcResponse WSRequestHandler::GetSourceTypesList(const RpcRequest& request) } /** -* Get the volume of the specified source. +* Get the volume of the specified source. Default response uses mul format, NOT SLIDER PERCENTAGE. * * @param {String} `source` Source name. +* @param {boolean (optional)} `useDecibel` Output volume in decibels of attenuation instead of amplitude/mul. * * @return {String} `name` Source name. -* @return {double} `volume` Volume of the source. Between `0.0` and `1.0`. +* @return {double} `volume` Volume of the source. Between `0.0` and `1.0` if using mul, under `0.0` if using dB (since it is attenuating). * @return {boolean} `muted` Indicates whether the source is muted. * * @api requests @@ -175,6 +176,11 @@ RpcResponse WSRequestHandler::GetVolume(const RpcRequest& request) return request.failed("missing request parameters"); } + bool useDecibel = false; + if (request.hasField("useDecibel")) { + useDecibel = obs_data_get_bool(request.parameters(), "useDecibel"); + } + QString sourceName = obs_data_get_string(request.parameters(), "source"); if (sourceName.isEmpty()) { return request.failed("invalid request parameters"); @@ -187,33 +193,45 @@ RpcResponse WSRequestHandler::GetVolume(const RpcRequest& request) OBSDataAutoRelease response = obs_data_create(); obs_data_set_string(response, "name", obs_source_get_name(source)); - obs_data_set_double(response, "volume", obs_source_get_volume(source)); + if (!useDecibel) { + obs_data_set_double(response, "volume", obs_source_get_volume(source)); + } else { + float volume = obs_source_get_volume(source); + obs_data_set_double(response, "volume", obs_mul_to_db(volume)); + } obs_data_set_bool(response, "muted", obs_source_muted(source)); return request.success(response); } /** - * Set the volume of the specified source. - * - * @param {String} `source` Source name. - * @param {double} `volume` Desired volume. Must be between `0.0` and `1.0`. - * - * @api requests - * @name SetVolume - * @category sources - * @since 4.0.0 - */ +* Set the volume of the specified source. Default request format uses mul, NOT SLIDER PERCENTAGE. +* +* @param {String} `source` Source name. +* @param {double} `volume` Desired volume. Must be between `0.0` and `1.0` for mul, and under 0.0 for dB. Note: OBS will interpret dB values under -100.0 as Inf. +* @param {boolean (optional)} `useDecibel` Interperet `volume` data as decibels instead of amplitude/mul. +* +* @api requests +* @name SetVolume +* @category sources +* @since 4.0.0 +*/ RpcResponse WSRequestHandler::SetVolume(const RpcRequest& request) { if (!request.hasField("source") || !request.hasField("volume")) { return request.failed("missing request parameters"); } + bool useDecibel = false; + if (request.hasField("useDecibel")) { + useDecibel = obs_data_get_bool(request.parameters(), "useDecibel"); + } + QString sourceName = obs_data_get_string(request.parameters(), "source"); float sourceVolume = obs_data_get_double(request.parameters(), "volume"); - if (sourceName.isEmpty() || sourceVolume < 0.0 || sourceVolume > 1.0) { + if ((useDecibel && sourceVolume > 0.0) || +(!useDecibel && (sourceVolume < 0.0 || sourceVolume > 1.0)) || (sourceName.isEmpty())) { return request.failed("invalid request parameters"); } @@ -222,7 +240,12 @@ RpcResponse WSRequestHandler::SetVolume(const RpcRequest& request) return request.failed("specified source doesn't exist"); } - obs_source_set_volume(source, sourceVolume); + if (!useDecibel) { + obs_source_set_volume(source, sourceVolume); + } else { + float mul = obs_db_to_mul(sourceVolume); + obs_source_set_volume(source, mul); + } return request.success(); } From 88c72cd80a2d3f2405bdab23ca5c757617c7f151 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Sun, 10 May 2020 20:07:57 -0700 Subject: [PATCH 11/27] Add audio monitoring request items. --- src/WSRequestHandler.cpp | 2 + src/WSRequestHandler.h | 2 + src/WSRequestHandler_Sources.cpp | 93 ++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) diff --git a/src/WSRequestHandler.cpp b/src/WSRequestHandler.cpp index f2ae6c47..58cddc23 100644 --- a/src/WSRequestHandler.cpp +++ b/src/WSRequestHandler.cpp @@ -97,6 +97,8 @@ const QHash WSRequestHandler::messageMap { { "GetSourceTypesList", &WSRequestHandler::GetSourceTypesList }, { "GetSourceSettings", &WSRequestHandler::GetSourceSettings }, { "SetSourceSettings", &WSRequestHandler::SetSourceSettings }, + { "GetAudioMonitor", &WSRequestHandler::GetAudioMonitor }, + { "SetAudioMonitor", &WSRequestHandler::SetAudioMonitor }, { "TakeSourceScreenshot", &WSRequestHandler::TakeSourceScreenshot }, { "GetSourceFilters", &WSRequestHandler::GetSourceFilters }, diff --git a/src/WSRequestHandler.h b/src/WSRequestHandler.h index d17384ee..b55c2fb5 100644 --- a/src/WSRequestHandler.h +++ b/src/WSRequestHandler.h @@ -112,6 +112,8 @@ class WSRequestHandler { RpcResponse GetSourceTypesList(const RpcRequest&); RpcResponse GetSourceSettings(const RpcRequest&); RpcResponse SetSourceSettings(const RpcRequest&); + RpcResponse GetAudioMonitor(const RpcRequest&); + RpcResponse SetAudioMonitor(const RpcRequest&); RpcResponse TakeSourceScreenshot(const RpcRequest&); RpcResponse GetSourceFilters(const RpcRequest&); diff --git a/src/WSRequestHandler_Sources.cpp b/src/WSRequestHandler_Sources.cpp index 579f76b4..12bce74c 100644 --- a/src/WSRequestHandler_Sources.cpp +++ b/src/WSRequestHandler_Sources.cpp @@ -1424,6 +1424,99 @@ RpcResponse WSRequestHandler::SetSourceFilterVisibility(const RpcRequest& reques return request.success(); } +/** +* Get the audio monitoring type of the specified source. +* +* @param {String} `sourceName` Source name. +* +* @return {String} `monitorType` The monitor type in use. Options: `none`, `monitor_only`, `monitor_and_output`. +* +* @api requests +* @name GetAudioMonitor +* @category sources +* @since 4.8.0 +*/ +RpcResponse WSRequestHandler::GetAudioMonitor(const RpcRequest& request) + { + if (!request.hasField("sourceName")) { + return request.failed("missing request parameters"); + } + + QString sourceName = obs_data_get_string(request.parameters(), "sourceName"); + + if (sourceName.isEmpty()) { + return request.failed("invalid request parameters"); + } + + OBSSourceAutoRelease source = obs_get_source_by_name(sourceName.toUtf8()); + if (!source) { + return request.failed("specified source doesn't exist"); + } + + OBSDataAutoRelease response = obs_data_create(); + + QString monitorType; + enum obs_monitoring_type mtype = obs_source_get_monitoring_type(source); + switch (mtype) { + case OBS_MONITORING_TYPE_NONE: + monitorType = "none"; + break; + case OBS_MONITORING_TYPE_MONITOR_ONLY: + monitorType = "monitor_only"; + break; + case OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT: + monitorType = "monitor_and_output"; + break; + default: + monitorType = "unknown"; + break; + } + obs_data_set_string(response, "monitorType", monitorType.toUtf8()); + + return request.success(response); +} + +/** +* Set the audio monitoring type of the specified source. +* +* @param {String} `sourceName` Source name. +* @param {String} `monitorType` The monitor type to use. Options: `none`, `monitor_only`, `monitor_and_output`. +* +* @api requests +* @name SetAudioMonitor +* @category sources +* @since 4.8.0 +*/ +RpcResponse WSRequestHandler::SetAudioMonitor(const RpcRequest& request) + { + if (!request.hasField("sourceName") || !request.hasField("monitorType")) { + return request.failed("missing request parameters"); + } + + QString sourceName = obs_data_get_string(request.parameters(), "sourceName"); + QString monitorType = obs_data_get_string(request.parameters(), "monitorType"); + + if (sourceName.isEmpty() || monitorType.isEmpty()) { + return request.failed("invalid request parameters"); + } + + OBSSourceAutoRelease source = obs_get_source_by_name(sourceName.toUtf8()); + if (!source) { + return request.failed("specified source doesn't exist"); + } + + if (monitorType == "none") { + obs_source_set_monitoring_type(source, OBS_MONITORING_TYPE_NONE); + } else if (monitorType == "monitor_only") { + obs_source_set_monitoring_type(source, OBS_MONITORING_TYPE_MONITOR_ONLY); + } else if (monitorType == "monitor_and_output") { + obs_source_set_monitoring_type(source, OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT); + } else { + return request.failed("invalid monitorType"); + } + return request.success(); +} + /** * Takes a picture snapshot of a source and then can either or both: * - Send it over as a Data URI (base64-encoded data) in the response (by specifying `embedPictureFormat` in the request) From f9c81f99f2f5987d88b63334771817eb30d9deb8 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Tue, 12 May 2020 02:24:27 -0700 Subject: [PATCH 12/27] Install into both dirs on Ubuntu instead of only one --- CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6bbd38f..56130453 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -190,10 +190,9 @@ if(UNIX AND NOT APPLE) if(${USE_UBUNTU_FIX}) install(TARGETS obs-websocket LIBRARY DESTINATION "/usr/lib/obs-plugins") - else() - install(TARGETS obs-websocket - LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/obs-plugins") endif() + install(TARGETS obs-websocket + LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/obs-plugins") install(FILES ${locale_files} DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/obs/obs-plugins/obs-websocket/locale") From ff21f5b3571c49483cb421f6bd69f3abf2258d2b Mon Sep 17 00:00:00 2001 From: Azure CI <> Date: Tue, 12 May 2020 09:37:41 +0000 Subject: [PATCH 13/27] docs(ci): Update protocol.md - 98db248 [skip ci] --- docs/generated/comments.json | 14 ++++++++++++++ docs/generated/protocol.md | 2 ++ 2 files changed, 16 insertions(+) diff --git a/docs/generated/comments.json b/docs/generated/comments.json index 0731d3d7..28f82e48 100644 --- a/docs/generated/comments.json +++ b/docs/generated/comments.json @@ -6870,6 +6870,7 @@ "name": "GetBrowserSourceProperties", "category": "sources", "since": "4.1.0", + "deprecated": "Since 4.8.0. Prefer the use of GetSourceSettings.", "returns": [ { "type": "String", @@ -6942,6 +6943,12 @@ "description": "4.1.0" } ], + "deprecateds": [ + { + "name": "", + "description": "Since 4.8.0. Prefer the use of GetSourceSettings." + } + ], "heading": { "level": 2, "text": "GetBrowserSourceProperties" @@ -6968,6 +6975,7 @@ "api": "requests", "name": "SetBrowserSourceProperties", "category": "sources", + "deprecated": "Since 4.8.0. Prefer the use of SetSourceSettings.", "since": "4.1.0", "params": [ { @@ -7033,6 +7041,12 @@ "description": "sources" } ], + "deprecateds": [ + { + "name": "", + "description": "Since 4.8.0. Prefer the use of SetSourceSettings." + } + ], "sinces": [ { "name": "", diff --git a/docs/generated/protocol.md b/docs/generated/protocol.md index 5325ee13..e5f47ec1 100644 --- a/docs/generated/protocol.md +++ b/docs/generated/protocol.md @@ -2643,6 +2643,7 @@ _No additional response items._ ### GetBrowserSourceProperties +- **⚠️ Deprecated. Since 4.8.0. Prefer the use of GetSourceSettings. ⚠️** - Added in v4.1.0 @@ -2674,6 +2675,7 @@ Get current properties for a Browser Source. ### SetBrowserSourceProperties +- **⚠️ Deprecated. Since 4.8.0. Prefer the use of SetSourceSettings. ⚠️** - Added in v4.1.0 From 71392613b2ad56248aa54e4a3733f2b682165fd6 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Tue, 12 May 2020 17:46:49 -0700 Subject: [PATCH 14/27] [Docs] Bump version to 4.8 --- docs/partials/introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/partials/introduction.md b/docs/partials/introduction.md index c8de4503..c63a52cd 100644 --- a/docs/partials/introduction.md +++ b/docs/partials/introduction.md @@ -1,4 +1,4 @@ -# obs-websocket 4.7.0 protocol reference +# obs-websocket 4.8.0 protocol reference # General Introduction Messages are exchanged between the client and the server as JSON objects. From 2810787156f6902af1d2a268fd83ffaccff78412 Mon Sep 17 00:00:00 2001 From: Azure CI <> Date: Thu, 14 May 2020 08:04:35 +0000 Subject: [PATCH 15/27] docs(ci): Update protocol.md - 6b53cb5 [skip ci] --- docs/generated/protocol.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/generated/protocol.md b/docs/generated/protocol.md index e5f47ec1..92db4587 100644 --- a/docs/generated/protocol.md +++ b/docs/generated/protocol.md @@ -1,6 +1,6 @@ -# obs-websocket 4.7.0 protocol reference +# obs-websocket 4.8.0 protocol reference # General Introduction Messages are exchanged between the client and the server as JSON objects. From 56371a7d80211241372e1dfad47f2edf9bf24091 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Wed, 13 May 2020 23:33:59 -0700 Subject: [PATCH 16/27] Add `GetTransitionPosition` Gets the current position of the active transition. Works on manual and also auto transition modes --- src/WSRequestHandler.cpp | 1 + src/WSRequestHandler.h | 6 +++--- src/WSRequestHandler_Transitions.cpp | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/WSRequestHandler.cpp b/src/WSRequestHandler.cpp index f2ae6c47..de6aea06 100644 --- a/src/WSRequestHandler.cpp +++ b/src/WSRequestHandler.cpp @@ -84,6 +84,7 @@ const QHash WSRequestHandler::messageMap { { "SetCurrentTransition", &WSRequestHandler::SetCurrentTransition }, { "SetTransitionDuration", &WSRequestHandler::SetTransitionDuration }, { "GetTransitionDuration", &WSRequestHandler::GetTransitionDuration }, + { "GetTransitionPosition", &WSRequestHandler::GetTransitionPosition }, { "SetVolume", &WSRequestHandler::SetVolume }, { "GetVolume", &WSRequestHandler::GetVolume }, diff --git a/src/WSRequestHandler.h b/src/WSRequestHandler.h index d17384ee..bf89998d 100644 --- a/src/WSRequestHandler.h +++ b/src/WSRequestHandler.h @@ -99,6 +99,9 @@ class WSRequestHandler { RpcResponse GetTransitionList(const RpcRequest&); RpcResponse GetCurrentTransition(const RpcRequest&); RpcResponse SetCurrentTransition(const RpcRequest&); + RpcResponse SetTransitionDuration(const RpcRequest&); + RpcResponse GetTransitionDuration(const RpcRequest&); + RpcResponse GetTransitionPosition(const RpcRequest&); RpcResponse SetVolume(const RpcRequest&); RpcResponse GetVolume(const RpcRequest&); @@ -138,9 +141,6 @@ class WSRequestHandler { RpcResponse SendCaptions(const RpcRequest&); #endif - RpcResponse SetTransitionDuration(const RpcRequest&); - RpcResponse GetTransitionDuration(const RpcRequest&); - RpcResponse GetStudioModeStatus(const RpcRequest&); RpcResponse GetPreviewScene(const RpcRequest&); RpcResponse SetPreviewScene(const RpcRequest&); diff --git a/src/WSRequestHandler_Transitions.cpp b/src/WSRequestHandler_Transitions.cpp index 7c22687c..9bcee450 100644 --- a/src/WSRequestHandler_Transitions.cpp +++ b/src/WSRequestHandler_Transitions.cpp @@ -120,3 +120,22 @@ RpcResponse WSRequestHandler::GetTransitionDuration(const RpcRequest& request) { obs_data_set_int(response, "transition-duration", obs_frontend_get_transition_duration()); return request.success(response); } + +/** + * Get the position of the current transition. + * + * @return {double} `position` current transition position. This value will be between 0.0 and 1.0. Note: Transition returns 1.0 when not active. + * + * @api requests + * @name GetTransitionPosition + * @category transitions + * @since 4.8.0 + */ +RpcResponse WSRequestHandler::GetTransitionPosition(const RpcRequest& request) { + OBSSourceAutoRelease currentTransition = obs_frontend_get_current_transition(); + + OBSDataAutoRelease response = obs_data_create(); + obs_data_set_double(response, "position", obs_transition_get_time(currentTransition)); + + return request.success(response); +} From 497443f012a968f469355a3c507ca9695da5c2bb Mon Sep 17 00:00:00 2001 From: tt2468 Date: Thu, 14 May 2020 01:47:55 -0700 Subject: [PATCH 17/27] Update CI scripts to use ubuntu fix --- CI/build-ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/build-ubuntu.sh b/CI/build-ubuntu.sh index b19158ae..498840ef 100755 --- a/CI/build-ubuntu.sh +++ b/CI/build-ubuntu.sh @@ -2,5 +2,5 @@ set -ex mkdir build && cd build -cmake -DCMAKE_INSTALL_PREFIX=/usr .. +cmake -DCMAKE_INSTALL_PREFIX=/usr -DUSE_UBUNTU_FIX=true .. make -j4 From bed6a1b1e28519e0cc7ccb2225f361f9b0a1fe4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Thu, 14 May 2020 11:02:51 +0200 Subject: [PATCH 18/27] ci(windows): simplified OBS Preparation script + shorter build times --- CI/checkout-cmake-obs-windows.cmd | 137 ------------------------------ CI/prepare-obs-windows.cmd | 37 ++++++++ azure-pipelines.yml | 2 +- 3 files changed, 38 insertions(+), 138 deletions(-) delete mode 100644 CI/checkout-cmake-obs-windows.cmd create mode 100644 CI/prepare-obs-windows.cmd diff --git a/CI/checkout-cmake-obs-windows.cmd b/CI/checkout-cmake-obs-windows.cmd deleted file mode 100644 index 0fc6c12c..00000000 --- a/CI/checkout-cmake-obs-windows.cmd +++ /dev/null @@ -1,137 +0,0 @@ -@echo off -SETLOCAL EnableDelayedExpansion - -REM Check if obs-studio build exists. -REM If the obs-studio directory does exist, check if the last OBS tag built -REM matches the latest OBS tag. -REM If the tags match, do not build obs-studio. -REM If the tags do not match, build obs-studio. -REM If the obs-studio directory doesn't exist, build obs-studio. -echo Checking for obs-studio build... - -set OBSLatestTagPrePull=0 -set OBSLatestTagPostPull=0 -echo Latest tag pre-pull: %OBSLatestTagPrePull% -echo Latest tag post-pull: %OBSLatestTagPostPull% - -REM Set up the build flag as undefined. -set "BuildOBS=" - -REM Check the last tag successfully built by CI. -if exist "%OBSPath%\obs-studio-last-tag-built.txt" ( - set /p OBSLastTagBuilt=<"%OBSPath%\obs-studio-last-tag-built.txt" -) else ( - set OBSLastTagBuilt=0 -) - -REM If obs-studio directory exists, run git pull and get the latest tag number. -if exist %OBSPath% ( - echo obs-studio directory exists - echo Updating tag info - cd /D %OBSPath% - git describe --tags --abbrev=0 --exclude="*-rc*" > "%OBSPath%\latest-obs-studio-tag-pre-pull.txt" - set /p OBSLatestTagPrePull=<"%OBSPath%\latest-obs-studio-tag-pre-pull.txt" - git checkout master - git pull - git describe --tags --abbrev=0 --exclude="*-rc*" > "%OBSPath%\latest-obs-studio-tag-post-pull.txt" - set /p OBSLatestTagPostPull=<"%OBSPath%\latest-obs-studio-tag-post-pull.txt" - set /p OBSLatestTag=<"%OBSPath%\latest-obs-studio-tag-post-pull.txt" - echo %OBSLatestTagPostPull%> "%OBSPath%\latest-obs-studio-tag.txt" -) - -REM Check the obs-studio tags for mismatches. -REM If a new tag was pulled, set the build flag. -if not %OBSLatestTagPrePull%==%OBSLatestTagPostPull% ( - echo Latest tag pre-pull: %OBSLatestTagPrePull% - echo Latest tag post-pull: %OBSLatestTagPostPull% - echo Tags do not match. Need to rebuild OBS. - set BuildOBS=true -) - -REM If the latest git tag doesn't match the last built tag, set the build flag. -if not %OBSLatestTagPostPull%==%OBSLastTagBuilt% ( - echo Last built OBS tag: %OBSLastTagBuilt% - echo Latest tag post-pull: %OBSLatestTagPostPull% - echo Tags do not match. Need to rebuild OBS. - set BuildOBS=true -) - -REM If obs-studio directory does not exist, clone the git repo, get the latest -REM tag number, and set the build flag. -if not exist %OBSPath% ( - echo obs-studio directory does not exist - git clone https://github.com/obsproject/obs-studio %OBSPath% - cd /D %OBSPath%\ - git describe --tags --abbrev=0 --exclude="*-rc*" > "%OBSPath%\obs-studio-latest-tag.txt" - set /p OBSLatestTag=<"%OBSPath%\obs-studio-latest-tag.txt" - set BuildOBS=true -) - -REM If the needed obs-studio libs for this build_config do not exist, -REM set the build flag. -if not exist %OBSPath%\build32\libobs\%build_config%\obs.lib ( - echo obs-studio\build32\libobs\%build_config%\obs.lib does not exist - set BuildOBS=true -) -if not exist %OBSPath%\build32\UI\obs-frontend-api\%build_config%\obs-frontend-api.lib ( - echo obs-studio\build32\UI\obs-frontend-api\%build_config%\obs-frontend-api.lib does not exist - set BuildOBS=true -) - -REM Some debug info -echo: -echo Latest tag pre-pull: %OBSLatestTagPrePull% -echo Latest tag post-pull: %OBSLatestTagPostPull% -echo Latest tag: %OBSLatestTag% -echo Last built OBS tag: %OBSLastTagBuilt% - -if defined BuildOBS ( - echo BuildOBS: true -) else ( - echo BuildOBS: false -) -echo: - -REM If the build flag is set, build obs-studio. -if defined BuildOBS ( - echo Building obs-studio... - cd /D %OBSPath% - echo git checkout %OBSLatestTag% - git checkout %OBSLatestTag% - echo: - - echo Removing previous build dirs... - if exist build32 rmdir /s /q "%OBSPath%\build32" - if exist build64 rmdir /s /q "%OBSPath%\build64" - - echo Making new build dirs... - mkdir build32 - mkdir build64 - - echo Running cmake for obs-studio %OBSLatestTag% 32-bit... - cd build32 - cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_SYSTEM_VERSION=10.0 -DQTDIR="%QTDIR32%" -DDepsPath="%DepsPath32%" -DBUILD_CAPTIONS=true -DDISABLE_PLUGINS=true -DCOPIED_DEPENDENCIES=false -DCOPY_DEPENDENCIES=true .. - echo: - echo: - - echo Running cmake for obs-studio %OBSLatestTag% 64-bit... - cd ..\build64 - cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0 -DQTDIR="%QTDIR64%" -DDepsPath="%DepsPath64%" -DBUILD_CAPTIONS=true -DDISABLE_PLUGINS=true -DCOPIED_DEPENDENCIES=false -DCOPY_DEPENDENCIES=true .. - echo: - echo: - - REM echo Building obs-studio %OBSLatestTag% 32-bit ^(Build Config: %build_config%^)... - REM call msbuild /m /p:Configuration=%build_config% %OBSPath%\build32\obs-studio.sln - - REM echo Building obs-studio %OBSLatestTag% 64-bit ^(Build Config: %build_config%^)... - REM call msbuild /m /p:Configuration=%build_config% %OBSPath%\build64\obs-studio.sln - - cd .. - git describe --tags --abbrev=0 > "%OBSPath%\obs-studio-last-tag-built.txt" - set /p OBSLastTagBuilt=<"%OBSPath%\obs-studio-last-tag-built.txt" -) else ( - echo Last OBS tag built is: %OBSLastTagBuilt% - echo No need to rebuild OBS. -) - -dir "%OBSPath%\libobs" diff --git a/CI/prepare-obs-windows.cmd b/CI/prepare-obs-windows.cmd new file mode 100644 index 00000000..961fbe17 --- /dev/null +++ b/CI/prepare-obs-windows.cmd @@ -0,0 +1,37 @@ + +@echo off +SETLOCAL EnableDelayedExpansion + +REM If obs-studio directory does not exist, clone the git repo +if not exist %OBSPath% ( + echo obs-studio directory does not exist + git clone https://github.com/obsproject/obs-studio %OBSPath% + cd /D %OBSPath%\ + git describe --tags --abbrev=0 --exclude="*-rc*" > "%OBSPath%\obs-studio-latest-tag.txt" + set /p OBSLatestTag=<"%OBSPath%\obs-studio-latest-tag.txt" +) + +REM Prepare OBS Studio builds + +echo Running CMake... +cd /D %OBSPath% +echo git checkout %OBSLatestTag% +git checkout %OBSLatestTag% +echo: + +if not exist build32 mkdir build32 +if not exist build64 mkdir build64 + +echo Running cmake for obs-studio %OBSLatestTag% 32-bit... +cd build32 +cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_SYSTEM_VERSION=10.0 -DQTDIR="%QTDIR32%" -DDepsPath="%DepsPath32%" -DBUILD_CAPTIONS=true -DDISABLE_PLUGINS=true -DCOPIED_DEPENDENCIES=false -DCOPY_DEPENDENCIES=true .. +echo: +echo: + +echo Running cmake for obs-studio %OBSLatestTag% 64-bit... +cd ..\build64 +cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0 -DQTDIR="%QTDIR64%" -DDepsPath="%DepsPath64%" -DBUILD_CAPTIONS=true -DDISABLE_PLUGINS=true -DCOPIED_DEPENDENCIES=false -DCOPY_DEPENDENCIES=true .. +echo: +echo: + +dir "%OBSPath%\libobs" \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0f3f10b9..7fce0542 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -68,7 +68,7 @@ jobs: obs | "$(Agent.OS)" path: $(OBSPath) - - script: ./CI/checkout-cmake-obs-windows.cmd + - script: ./CI/prepare-obs-windows.cmd displayName: 'Checkout & CMake OBS Studio' env: build_config: $(build_config) From 5534f9a2486d7370dda42212815855600435f3bd Mon Sep 17 00:00:00 2001 From: Azure CI <> Date: Thu, 14 May 2020 20:15:44 +0000 Subject: [PATCH 19/27] docs(ci): Update protocol.md - eb20654 [skip ci] --- docs/generated/comments.json | 41 ++++++++++++++++++++++++++++++++++++ docs/generated/protocol.md | 21 ++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/docs/generated/comments.json b/docs/generated/comments.json index 28f82e48..dc7f68c2 100644 --- a/docs/generated/comments.json +++ b/docs/generated/comments.json @@ -8678,6 +8678,47 @@ "lead": "", "type": "class", "examples": [] + }, + { + "subheads": [], + "description": "Get the position of the current transition.", + "return": "{double} `position` current transition position. This value will be between 0.0 and 1.0. Note: Transition returns 1.0 when not active.", + "api": "requests", + "name": "GetTransitionPosition", + "category": "transitions", + "since": "4.8.0", + "returns": [ + { + "type": "double", + "name": "position", + "description": "current transition position. This value will be between 0.0 and 1.0. Note: Transition returns 1.0 when not active." + } + ], + "names": [ + { + "name": "", + "description": "GetTransitionPosition" + } + ], + "categories": [ + { + "name": "", + "description": "transitions" + } + ], + "sinces": [ + { + "name": "", + "description": "4.8.0" + } + ], + "heading": { + "level": 2, + "text": "GetTransitionPosition" + }, + "lead": "", + "type": "class", + "examples": [] } ] } diff --git a/docs/generated/protocol.md b/docs/generated/protocol.md index 92db4587..2f553495 100644 --- a/docs/generated/protocol.md +++ b/docs/generated/protocol.md @@ -215,6 +215,7 @@ auth_response = base64_encode(auth_response_hash) + [SetCurrentTransition](#setcurrenttransition) + [SetTransitionDuration](#settransitionduration) + [GetTransitionDuration](#gettransitionduration) + + [GetTransitionPosition](#gettransitionposition) @@ -3372,3 +3373,23 @@ _No specified parameters._ --- +### GetTransitionPosition + + +- Added in v4.8.0 + +Get the position of the current transition. + +**Request Fields:** + +_No specified parameters._ + +**Response Items:** + +| Name | Type | Description | +| ---- | :---: | ------------| +| `position` | _double_ | current transition position. This value will be between 0.0 and 1.0. Note: Transition returns 1.0 when not active. | + + +--- + From ba4e5959b10d274eb3498afdd7981fb310331d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Thu, 14 May 2020 22:24:58 +0200 Subject: [PATCH 20/27] requests(Get/SetVolume): code nitpicks --- src/WSRequestHandler_Sources.cpp | 34 ++++++++++++-------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/src/WSRequestHandler_Sources.cpp b/src/WSRequestHandler_Sources.cpp index 44bf1b7c..3ca1a82b 100644 --- a/src/WSRequestHandler_Sources.cpp +++ b/src/WSRequestHandler_Sources.cpp @@ -176,11 +176,6 @@ RpcResponse WSRequestHandler::GetVolume(const RpcRequest& request) return request.failed("missing request parameters"); } - bool useDecibel = false; - if (request.hasField("useDecibel")) { - useDecibel = obs_data_get_bool(request.parameters(), "useDecibel"); - } - QString sourceName = obs_data_get_string(request.parameters(), "source"); if (sourceName.isEmpty()) { return request.failed("invalid request parameters"); @@ -191,16 +186,17 @@ RpcResponse WSRequestHandler::GetVolume(const RpcRequest& request) return request.failed("specified source doesn't exist"); } + float volume = obs_source_get_volume(source); + + bool useDecibel = obs_data_get_bool(request.parameters(), "useDecibel"); + if (useDecibel) { + volume = obs_mul_to_db(volume); + } + OBSDataAutoRelease response = obs_data_create(); obs_data_set_string(response, "name", obs_source_get_name(source)); - if (!useDecibel) { - obs_data_set_double(response, "volume", obs_source_get_volume(source)); - } else { - float volume = obs_source_get_volume(source); - obs_data_set_double(response, "volume", obs_mul_to_db(volume)); - } + obs_data_set_double(response, "volume", volume); obs_data_set_bool(response, "muted", obs_source_muted(source)); - return request.success(response); } @@ -222,10 +218,7 @@ RpcResponse WSRequestHandler::SetVolume(const RpcRequest& request) return request.failed("missing request parameters"); } - bool useDecibel = false; - if (request.hasField("useDecibel")) { - useDecibel = obs_data_get_bool(request.parameters(), "useDecibel"); - } + bool useDecibel = obs_data_get_bool(request.parameters(), "useDecibel"); QString sourceName = obs_data_get_string(request.parameters(), "source"); float sourceVolume = obs_data_get_double(request.parameters(), "volume"); @@ -240,12 +233,11 @@ RpcResponse WSRequestHandler::SetVolume(const RpcRequest& request) return request.failed("specified source doesn't exist"); } - if (!useDecibel) { - obs_source_set_volume(source, sourceVolume); - } else { - float mul = obs_db_to_mul(sourceVolume); - obs_source_set_volume(source, mul); + if (useDecibel) { + sourceVolume = obs_db_to_mul(sourceVolume); } + obs_source_set_volume(source, sourceVolume); + return request.success(); } From 1c85894472f88cbb4c9c409d6379f13d4ddbb6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Thu, 14 May 2020 22:31:10 +0200 Subject: [PATCH 21/27] request(SetVolume): simplified params check --- src/WSRequestHandler_Sources.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/WSRequestHandler_Sources.cpp b/src/WSRequestHandler_Sources.cpp index 3ca1a82b..7f4df0d1 100644 --- a/src/WSRequestHandler_Sources.cpp +++ b/src/WSRequestHandler_Sources.cpp @@ -223,8 +223,9 @@ RpcResponse WSRequestHandler::SetVolume(const RpcRequest& request) QString sourceName = obs_data_get_string(request.parameters(), "source"); float sourceVolume = obs_data_get_double(request.parameters(), "volume"); - if ((useDecibel && sourceVolume > 0.0) || -(!useDecibel && (sourceVolume < 0.0 || sourceVolume > 1.0)) || (sourceName.isEmpty())) { + bool isNotValidDecibel = (useDecibel && sourceVolume > 0.0); + bool isNotValidMul = (!useDecibel && (sourceVolume < 0.0 || sourceVolume > 1.0)); + if (sourceName.isEmpty() || isNotValidDecibel || isNotValidMul) { return request.failed("invalid request parameters"); } From 344f5bda697869513bf133279c09a0887777072a Mon Sep 17 00:00:00 2001 From: Azure CI <> Date: Thu, 14 May 2020 20:48:16 +0000 Subject: [PATCH 22/27] docs(ci): Update protocol.md - 33b080b [skip ci] --- docs/generated/comments.json | 28 +++++++++++++++++++++------- docs/generated/protocol.md | 10 ++++++---- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/docs/generated/comments.json b/docs/generated/comments.json index dc7f68c2..6bc300a7 100644 --- a/docs/generated/comments.json +++ b/docs/generated/comments.json @@ -5642,11 +5642,14 @@ }, { "subheads": [], - "description": "Get the volume of the specified source.", - "param": "{String} `source` Source name.", + "description": "Get the volume of the specified source. Default response uses mul format, NOT SLIDER PERCENTAGE.", + "param": [ + "{String} `source` Source name.", + "{boolean (optional)} `useDecibel` Output volume in decibels of attenuation instead of amplitude/mul." + ], "return": [ "{String} `name` Source name.", - "{double} `volume` Volume of the source. Between `0.0` and `1.0`.", + "{double} `volume` Volume of the source. Between `0.0` and `1.0` if using mul, under `0.0` if using dB (since it is attenuating).", "{boolean} `muted` Indicates whether the source is muted." ], "api": "requests", @@ -5662,7 +5665,7 @@ { "type": "double", "name": "volume", - "description": "Volume of the source. Between `0.0` and `1.0`." + "description": "Volume of the source. Between `0.0` and `1.0` if using mul, under `0.0` if using dB (since it is attenuating)." }, { "type": "boolean", @@ -5675,6 +5678,11 @@ "type": "String", "name": "source", "description": "Source name." + }, + { + "type": "boolean (optional)", + "name": "useDecibel", + "description": "Output volume in decibels of attenuation instead of amplitude/mul." } ], "names": [ @@ -5705,10 +5713,11 @@ }, { "subheads": [], - "description": "Set the volume of the specified source.", + "description": "Set the volume of the specified source. Default request format uses mul, NOT SLIDER PERCENTAGE.", "param": [ "{String} `source` Source name.", - "{double} `volume` Desired volume. Must be between `0.0` and `1.0`." + "{double} `volume` Desired volume. Must be between `0.0` and `1.0` for mul, and under 0.0 for dB. Note: OBS will interpret dB values under -100.0 as Inf.", + "{boolean (optional)} `useDecibel` Interperet `volume` data as decibels instead of amplitude/mul." ], "api": "requests", "name": "SetVolume", @@ -5723,7 +5732,12 @@ { "type": "double", "name": "volume", - "description": "Desired volume. Must be between `0.0` and `1.0`." + "description": "Desired volume. Must be between `0.0` and `1.0` for mul, and under 0.0 for dB. Note: OBS will interpret dB values under -100.0 as Inf." + }, + { + "type": "boolean (optional)", + "name": "useDecibel", + "description": "Interperet `volume` data as decibels instead of amplitude/mul." } ], "names": [ diff --git a/docs/generated/protocol.md b/docs/generated/protocol.md index 2f553495..08b8efe5 100644 --- a/docs/generated/protocol.md +++ b/docs/generated/protocol.md @@ -2267,13 +2267,14 @@ _No specified parameters._ - Added in v4.0.0 -Get the volume of the specified source. +Get the volume of the specified source. Default response uses mul format, NOT SLIDER PERCENTAGE. **Request Fields:** | Name | Type | Description | | ---- | :---: | ------------| | `source` | _String_ | Source name. | +| `useDecibel` | _boolean (optional)_ | Output volume in decibels of attenuation instead of amplitude/mul. | **Response Items:** @@ -2281,7 +2282,7 @@ Get the volume of the specified source. | Name | Type | Description | | ---- | :---: | ------------| | `name` | _String_ | Source name. | -| `volume` | _double_ | Volume of the source. Between `0.0` and `1.0`. | +| `volume` | _double_ | Volume of the source. Between `0.0` and `1.0` if using mul, under `0.0` if using dB (since it is attenuating). | | `muted` | _boolean_ | Indicates whether the source is muted. | @@ -2292,14 +2293,15 @@ Get the volume of the specified source. - Added in v4.0.0 -Set the volume of the specified source. +Set the volume of the specified source. Default request format uses mul, NOT SLIDER PERCENTAGE. **Request Fields:** | Name | Type | Description | | ---- | :---: | ------------| | `source` | _String_ | Source name. | -| `volume` | _double_ | Desired volume. Must be between `0.0` and `1.0`. | +| `volume` | _double_ | Desired volume. Must be between `0.0` and `1.0` for mul, and under 0.0 for dB. Note: OBS will interpret dB values under -100.0 as Inf. | +| `useDecibel` | _boolean (optional)_ | Interperet `volume` data as decibels instead of amplitude/mul. | **Response Items:** From 0eaa9187ead361d78079d874a181401b3f1400f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Fri, 15 May 2020 02:35:53 +0200 Subject: [PATCH 23/27] requests(TakeSourceScreenshot): improved docs --- src/WSRequestHandler_Sources.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/WSRequestHandler_Sources.cpp b/src/WSRequestHandler_Sources.cpp index 06f33380..5e90e158 100644 --- a/src/WSRequestHandler_Sources.cpp +++ b/src/WSRequestHandler_Sources.cpp @@ -1437,7 +1437,7 @@ RpcResponse WSRequestHandler::SetSourceFilterVisibility(const RpcRequest& reques * @param {String} `sourceName` Source name. Note that, since scenes are also sources, you can also provide a scene name. * @param {String (optional)} `embedPictureFormat` Format of the Data URI encoded picture. Can be "png", "jpg", "jpeg" or "bmp" (or any other value supported by Qt's Image module) * @param {String (optional)} `saveToFilePath` Full file path (file extension included) where the captured image is to be saved. Can be in a format different from `pictureFormat`. Can be a relative path. -* @param {String (optional)} `fileFormat` Format to save the image file as. If not specified, tries to guess based on file extension. +* @param {String (optional)} `fileFormat` Format to save the image file as (one of the values provided in the `supported-image-export-formats` response field of `GetVersion`). If not specified, tries to guess based on file extension. * @param {int (optional)} `compressionQuality` Compression ratio between -1 and 100 to write the image with. -1 is automatic, 1 is smallest file/most compression, 100 is largest file/least compression. Varies with image type. * @param {int (optional)} `width` Screenshot width. Defaults to the source's base width. * @param {int (optional)} `height` Screenshot height. Defaults to the source's base height. @@ -1581,7 +1581,7 @@ RpcResponse WSRequestHandler::TakeSourceScreenshot(const RpcRequest& request) { QFileInfo filePathInfo(filePathStr); QString absoluteFilePath = filePathInfo.absoluteFilePath(); - const char* fileFormat; + const char* fileFormat = nullptr; if (request.hasField("fileFormat")) { fileFormat = obs_data_get_string(request.parameters(), "fileFormat"); QByteArrayList supportedFormats = QImageWriter::supportedImageFormats(); @@ -1591,9 +1591,6 @@ RpcResponse WSRequestHandler::TakeSourceScreenshot(const RpcRequest& request) { return request.failed(errorMessage.toUtf8()); } } - else { - fileFormat = nullptr; - } if (!sourceImage.save(absoluteFilePath, fileFormat, compressionQuality)) { return request.failed("Image save failed"); From 133d3fdda7bdd974c3774a917728cbaf337b9330 Mon Sep 17 00:00:00 2001 From: Azure CI <> Date: Fri, 15 May 2020 00:48:51 +0000 Subject: [PATCH 24/27] docs(ci): Update protocol.md - 53e98db [skip ci] --- docs/generated/comments.json | 12 ++++++++++++ docs/generated/protocol.md | 2 ++ 2 files changed, 14 insertions(+) diff --git a/docs/generated/comments.json b/docs/generated/comments.json index 6bc300a7..d2929e46 100644 --- a/docs/generated/comments.json +++ b/docs/generated/comments.json @@ -7631,6 +7631,8 @@ "{String} `sourceName` Source name. Note that, since scenes are also sources, you can also provide a scene name.", "{String (optional)} `embedPictureFormat` Format of the Data URI encoded picture. Can be \"png\", \"jpg\", \"jpeg\" or \"bmp\" (or any other value supported by Qt's Image module)", "{String (optional)} `saveToFilePath` Full file path (file extension included) where the captured image is to be saved. Can be in a format different from `pictureFormat`. Can be a relative path.", + "{String (optional)} `fileFormat` Format to save the image file as (one of the values provided in the `supported-image-export-formats` response field of `GetVersion`). If not specified, tries to guess based on file extension.", + "{int (optional)} `compressionQuality` Compression ratio between -1 and 100 to write the image with. -1 is automatic, 1 is smallest file/most compression, 100 is largest file/least compression. Varies with image type.", "{int (optional)} `width` Screenshot width. Defaults to the source's base width.", "{int (optional)} `height` Screenshot height. Defaults to the source's base height." ], @@ -7676,6 +7678,16 @@ "name": "saveToFilePath", "description": "Full file path (file extension included) where the captured image is to be saved. Can be in a format different from `pictureFormat`. Can be a relative path." }, + { + "type": "String (optional)", + "name": "fileFormat", + "description": "Format to save the image file as (one of the values provided in the `supported-image-export-formats` response field of `GetVersion`). If not specified, tries to guess based on file extension." + }, + { + "type": "int (optional)", + "name": "compressionQuality", + "description": "Compression ratio between -1 and 100 to write the image with. -1 is automatic, 1 is smallest file/most compression, 100 is largest file/least compression. Varies with image type." + }, { "type": "int (optional)", "name": "width", diff --git a/docs/generated/protocol.md b/docs/generated/protocol.md index 08b8efe5..13b7c50b 100644 --- a/docs/generated/protocol.md +++ b/docs/generated/protocol.md @@ -2935,6 +2935,8 @@ preserved if only one of these two parameters is specified. | `sourceName` | _String_ | Source name. Note that, since scenes are also sources, you can also provide a scene name. | | `embedPictureFormat` | _String (optional)_ | Format of the Data URI encoded picture. Can be "png", "jpg", "jpeg" or "bmp" (or any other value supported by Qt's Image module) | | `saveToFilePath` | _String (optional)_ | Full file path (file extension included) where the captured image is to be saved. Can be in a format different from `pictureFormat`. Can be a relative path. | +| `fileFormat` | _String (optional)_ | Format to save the image file as (one of the values provided in the `supported-image-export-formats` response field of `GetVersion`). If not specified, tries to guess based on file extension. | +| `compressionQuality` | _int (optional)_ | Compression ratio between -1 and 100 to write the image with. -1 is automatic, 1 is smallest file/most compression, 100 is largest file/least compression. Varies with image type. | | `width` | _int (optional)_ | Screenshot width. Defaults to the source's base width. | | `height` | _int (optional)_ | Screenshot height. Defaults to the source's base height. | From 0b0560019a3426539f7b67ef49cfda92b3bba2e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Fri, 15 May 2020 04:08:40 +0200 Subject: [PATCH 25/27] requests(Get/SetAudioMonitor): change values to camelCase for consistency --- src/WSRequestHandler_Sources.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/WSRequestHandler_Sources.cpp b/src/WSRequestHandler_Sources.cpp index 26db95f6..73ddae9f 100644 --- a/src/WSRequestHandler_Sources.cpp +++ b/src/WSRequestHandler_Sources.cpp @@ -1431,7 +1431,7 @@ RpcResponse WSRequestHandler::SetSourceFilterVisibility(const RpcRequest& reques * * @param {String} `sourceName` Source name. * -* @return {String} `monitorType` The monitor type in use. Options: `none`, `monitor_only`, `monitor_and_output`. +* @return {String} `monitorType` The monitor type in use. Options: `none`, `monitorOnly`, `monitorAndOutput`. * * @api requests * @name GetAudioMonitor @@ -1464,10 +1464,10 @@ RpcResponse WSRequestHandler::GetAudioMonitor(const RpcRequest& request) monitorType = "none"; break; case OBS_MONITORING_TYPE_MONITOR_ONLY: - monitorType = "monitor_only"; + monitorType = "monitorOnly"; break; case OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT: - monitorType = "monitor_and_output"; + monitorType = "monitorAndOutput"; break; default: monitorType = "unknown"; @@ -1482,7 +1482,7 @@ RpcResponse WSRequestHandler::GetAudioMonitor(const RpcRequest& request) * Set the audio monitoring type of the specified source. * * @param {String} `sourceName` Source name. -* @param {String} `monitorType` The monitor type to use. Options: `none`, `monitor_only`, `monitor_and_output`. +* @param {String} `monitorType` The monitor type to use. Options: `none`, `monitorOnly`, `monitorAndOutput`. * * @api requests * @name SetAudioMonitor @@ -1509,9 +1509,9 @@ RpcResponse WSRequestHandler::SetAudioMonitor(const RpcRequest& request) if (monitorType == "none") { obs_source_set_monitoring_type(source, OBS_MONITORING_TYPE_NONE); - } else if (monitorType == "monitor_only") { + } else if (monitorType == "monitorOnly") { obs_source_set_monitoring_type(source, OBS_MONITORING_TYPE_MONITOR_ONLY); - } else if (monitorType == "monitor_and_output") { + } else if (monitorType == "monitorAndOutput") { obs_source_set_monitoring_type(source, OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT); } else { return request.failed("invalid monitorType"); From f8c8e42ae97675298b5bf1b874a2d65c96d6c602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Fri, 15 May 2020 04:10:40 +0200 Subject: [PATCH 26/27] requests: rename Get/SetAudioMonitor to Get/SetAudioMonitorType --- src/WSRequestHandler.cpp | 4 ++-- src/WSRequestHandler.h | 4 ++-- src/WSRequestHandler_Sources.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/WSRequestHandler.cpp b/src/WSRequestHandler.cpp index 58cddc23..86a9df70 100644 --- a/src/WSRequestHandler.cpp +++ b/src/WSRequestHandler.cpp @@ -97,8 +97,8 @@ const QHash WSRequestHandler::messageMap { { "GetSourceTypesList", &WSRequestHandler::GetSourceTypesList }, { "GetSourceSettings", &WSRequestHandler::GetSourceSettings }, { "SetSourceSettings", &WSRequestHandler::SetSourceSettings }, - { "GetAudioMonitor", &WSRequestHandler::GetAudioMonitor }, - { "SetAudioMonitor", &WSRequestHandler::SetAudioMonitor }, + { "GetAudioMonitorType", &WSRequestHandler::GetAudioMonitorType }, + { "SetAudioMonitorType", &WSRequestHandler::SetAudioMonitorType }, { "TakeSourceScreenshot", &WSRequestHandler::TakeSourceScreenshot }, { "GetSourceFilters", &WSRequestHandler::GetSourceFilters }, diff --git a/src/WSRequestHandler.h b/src/WSRequestHandler.h index b55c2fb5..300915e7 100644 --- a/src/WSRequestHandler.h +++ b/src/WSRequestHandler.h @@ -112,8 +112,8 @@ class WSRequestHandler { RpcResponse GetSourceTypesList(const RpcRequest&); RpcResponse GetSourceSettings(const RpcRequest&); RpcResponse SetSourceSettings(const RpcRequest&); - RpcResponse GetAudioMonitor(const RpcRequest&); - RpcResponse SetAudioMonitor(const RpcRequest&); + RpcResponse GetAudioMonitorType(const RpcRequest&); + RpcResponse SetAudioMonitorType(const RpcRequest&); RpcResponse TakeSourceScreenshot(const RpcRequest&); RpcResponse GetSourceFilters(const RpcRequest&); diff --git a/src/WSRequestHandler_Sources.cpp b/src/WSRequestHandler_Sources.cpp index 73ddae9f..f71a3518 100644 --- a/src/WSRequestHandler_Sources.cpp +++ b/src/WSRequestHandler_Sources.cpp @@ -1434,11 +1434,11 @@ RpcResponse WSRequestHandler::SetSourceFilterVisibility(const RpcRequest& reques * @return {String} `monitorType` The monitor type in use. Options: `none`, `monitorOnly`, `monitorAndOutput`. * * @api requests -* @name GetAudioMonitor +* @name GetAudioMonitorType * @category sources * @since 4.8.0 */ -RpcResponse WSRequestHandler::GetAudioMonitor(const RpcRequest& request) +RpcResponse WSRequestHandler::GetAudioMonitorType(const RpcRequest& request) { if (!request.hasField("sourceName")) { return request.failed("missing request parameters"); @@ -1485,11 +1485,11 @@ RpcResponse WSRequestHandler::GetAudioMonitor(const RpcRequest& request) * @param {String} `monitorType` The monitor type to use. Options: `none`, `monitorOnly`, `monitorAndOutput`. * * @api requests -* @name SetAudioMonitor +* @name SetAudioMonitorType * @category sources * @since 4.8.0 */ -RpcResponse WSRequestHandler::SetAudioMonitor(const RpcRequest& request) +RpcResponse WSRequestHandler::SetAudioMonitorType(const RpcRequest& request) { if (!request.hasField("sourceName") || !request.hasField("monitorType")) { return request.failed("missing request parameters"); From 590943ed957386a483ec6fca2a8178f7bbd5a0d3 Mon Sep 17 00:00:00 2001 From: Azure CI <> Date: Fri, 15 May 2020 02:20:46 +0000 Subject: [PATCH 27/27] docs(ci): Update protocol.md - e9c17c9 [skip ci] --- docs/generated/comments.json | 98 ++++++++++++++++++++++++++++++++++++ docs/generated/protocol.md | 46 +++++++++++++++++ 2 files changed, 144 insertions(+) diff --git a/docs/generated/comments.json b/docs/generated/comments.json index d2929e46..a6e24f82 100644 --- a/docs/generated/comments.json +++ b/docs/generated/comments.json @@ -7624,6 +7624,104 @@ "type": "class", "examples": [] }, + { + "subheads": [], + "description": "Get the audio monitoring type of the specified source.", + "param": "{String} `sourceName` Source name.", + "return": "{String} `monitorType` The monitor type in use. Options: `none`, `monitorOnly`, `monitorAndOutput`.", + "api": "requests", + "name": "GetAudioMonitorType", + "category": "sources", + "since": "4.8.0", + "returns": [ + { + "type": "String", + "name": "monitorType", + "description": "The monitor type in use. Options: `none`, `monitorOnly`, `monitorAndOutput`." + } + ], + "params": [ + { + "type": "String", + "name": "sourceName", + "description": "Source name." + } + ], + "names": [ + { + "name": "", + "description": "GetAudioMonitorType" + } + ], + "categories": [ + { + "name": "", + "description": "sources" + } + ], + "sinces": [ + { + "name": "", + "description": "4.8.0" + } + ], + "heading": { + "level": 2, + "text": "GetAudioMonitorType" + }, + "lead": "", + "type": "class", + "examples": [] + }, + { + "subheads": [], + "description": "Set the audio monitoring type of the specified source.", + "param": [ + "{String} `sourceName` Source name.", + "{String} `monitorType` The monitor type to use. Options: `none`, `monitorOnly`, `monitorAndOutput`." + ], + "api": "requests", + "name": "SetAudioMonitorType", + "category": "sources", + "since": "4.8.0", + "params": [ + { + "type": "String", + "name": "sourceName", + "description": "Source name." + }, + { + "type": "String", + "name": "monitorType", + "description": "The monitor type to use. Options: `none`, `monitorOnly`, `monitorAndOutput`." + } + ], + "names": [ + { + "name": "", + "description": "SetAudioMonitorType" + } + ], + "categories": [ + { + "name": "", + "description": "sources" + } + ], + "sinces": [ + { + "name": "", + "description": "4.8.0" + } + ], + "heading": { + "level": 2, + "text": "SetAudioMonitorType" + }, + "lead": "", + "type": "class", + "examples": [] + }, { "subheads": [], "description": "\n\nAt least `embedPictureFormat` or `saveToFilePath` must be specified.\n\nClients can specify `width` and `height` parameters to receive scaled pictures. Aspect ratio is\npreserved if only one of these two parameters is specified.", diff --git a/docs/generated/protocol.md b/docs/generated/protocol.md index 13b7c50b..b7ff296b 100644 --- a/docs/generated/protocol.md +++ b/docs/generated/protocol.md @@ -191,6 +191,8 @@ auth_response = base64_encode(auth_response_hash) + [MoveSourceFilter](#movesourcefilter) + [SetSourceFilterSettings](#setsourcefiltersettings) + [SetSourceFilterVisibility](#setsourcefiltervisibility) + + [GetAudioMonitorType](#getaudiomonitortype) + + [SetAudioMonitorType](#setaudiomonitortype) + [TakeSourceScreenshot](#takesourcescreenshot) * [Streaming](#streaming-1) + [GetStreamingStatus](#getstreamingstatus) @@ -2910,6 +2912,50 @@ Change the visibility/enabled state of a filter | `filterEnabled` | _Boolean_ | New filter state | +**Response Items:** + +_No additional response items._ + +--- + +### GetAudioMonitorType + + +- Added in v4.8.0 + +Get the audio monitoring type of the specified source. + +**Request Fields:** + +| Name | Type | Description | +| ---- | :---: | ------------| +| `sourceName` | _String_ | Source name. | + + +**Response Items:** + +| Name | Type | Description | +| ---- | :---: | ------------| +| `monitorType` | _String_ | The monitor type in use. Options: `none`, `monitorOnly`, `monitorAndOutput`. | + + +--- + +### SetAudioMonitorType + + +- Added in v4.8.0 + +Set the audio monitoring type of the specified source. + +**Request Fields:** + +| Name | Type | Description | +| ---- | :---: | ------------| +| `sourceName` | _String_ | Source name. | +| `monitorType` | _String_ | The monitor type to use. Options: `none`, `monitorOnly`, `monitorAndOutput`. | + + **Response Items:** _No additional response items._