-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
win-asio: ASIO host for obs-studio #12733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pkviet
wants to merge
5
commits into
obsproject:master
Choose a base branch
from
pkviet:asio_host
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,919
−29
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8bbfc0e
win-asio: Add ASIO source & output
pkviet 6baa860
UI: Add ASIO output frontend plugin
pkviet a9e8799
libobs: Add ASIO monitoring track
pkviet c4e84ef
win-asio: Enable monitoring track for output
pkviet ba294ff
UI: Add to Settings > Audio ASIO monitoring
pkviet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| add_subdirectory(aja-output-ui) | ||
| add_obs_plugin(asio-output-ui PLATFORMS WINDOWS) | ||
| add_subdirectory(decklink-captions) | ||
| add_subdirectory(decklink-output-ui) | ||
| add_subdirectory(frontend-tools) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| /* Copyright (c) 2022-2025 pkv <[email protected]> | ||
| * | ||
| * This file is part of win-asio. | ||
| * | ||
| * This file and all modifications by pkv <[email protected]> are licensed under | ||
| * the GNU General Public License, version 3 or later. | ||
| */ | ||
|
|
||
| #include "ASIOSettingsDialog.h" | ||
| #include <util/util.hpp> | ||
|
|
||
| extern void output_start(); | ||
| extern void output_stop(); | ||
| extern bool output_running; | ||
| extern std::string g_currentDeviceName; | ||
|
|
||
| ASIOSettingsDialog::ASIOSettingsDialog(QWidget *parent, obs_output_t *output, OBSData settings) | ||
| : QDialog(parent), | ||
| ui(new Ui::Output), | ||
| _output(output), | ||
| _settings(settings), | ||
| currentDeviceName("") | ||
| { | ||
| ui->setupUi(this); | ||
| setSizeGripEnabled(true); | ||
| setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); | ||
| propertiesView = nullptr; | ||
| } | ||
|
|
||
| void ASIOSettingsDialog::ShowHideDialog(bool enabled) | ||
| { | ||
| SetupPropertiesView(enabled); | ||
| setVisible(!isVisible()); | ||
| } | ||
|
|
||
| void ASIOSettingsDialog::SetupPropertiesView(bool enabled) | ||
| { | ||
| if (propertiesView) | ||
| delete propertiesView; | ||
|
|
||
| propertiesView = new OBSPropertiesView(_settings, "asio_output", | ||
| (PropertiesReloadCallback)obs_get_output_properties, 170); | ||
|
|
||
| if (enabled) { | ||
| ui->propertiesLayout->addWidget(propertiesView); | ||
| currentDeviceName = g_currentDeviceName; | ||
| } else { | ||
| QLabel *noAsioLabel = new QLabel(obs_module_text("AsioOutput.Disabled"), this); | ||
| noAsioLabel->setWordWrap(true); | ||
| noAsioLabel->setAlignment(Qt::AlignCenter); | ||
| ui->propertiesLayout->addWidget(noAsioLabel); | ||
| adjustSize(); | ||
| } | ||
|
|
||
| connect(propertiesView, &OBSPropertiesView::Changed, this, &ASIOSettingsDialog::PropertiesChanged); | ||
| } | ||
|
|
||
| void ASIOSettingsDialog::SaveSettings() | ||
| { | ||
| BPtr<char> modulePath = obs_module_get_config_path(obs_current_module(), ""); | ||
| os_mkdirs(modulePath); | ||
| BPtr<char> path = obs_module_get_config_path(obs_current_module(), "asioOutputProps.json"); | ||
| obs_data_t *settings = propertiesView->GetSettings(); | ||
|
|
||
| if (settings) | ||
| obs_data_save_json_safe(settings, path, "tmp", "bak"); | ||
| } | ||
|
|
||
| void ASIOSettingsDialog::PropertiesChanged() | ||
| { | ||
| obs_output_update(_output, _settings); | ||
| SaveSettings(); | ||
| const char *dev = obs_data_get_string(_settings, "device_name"); | ||
| const std::string newDevice = (dev && *dev) ? dev : std::string{}; | ||
|
|
||
| const bool wasEmpty = currentDeviceName.empty(); | ||
| const bool nowEmpty = newDevice.empty(); | ||
|
|
||
| if (wasEmpty && !nowEmpty) { | ||
| // None -> Valid device: start if not running | ||
| if (!output_running) | ||
| output_start(); | ||
| } else if (!wasEmpty && nowEmpty) { | ||
| // Valid device -> None: stop if running | ||
| if (output_running) | ||
| output_stop(); | ||
| } else if (!nowEmpty && newDevice != currentDeviceName) { | ||
| // output was already started so do nothing ... | ||
| } | ||
|
|
||
| currentDeviceName = newDevice; | ||
| g_currentDeviceName = newDevice; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /* Copyright (c) 2022-2025 pkv <[email protected]> | ||
| * | ||
| * This file is part of win-asio. | ||
| * | ||
| * This file and all modifications by pkv <[email protected]> are licensed under | ||
| * the GNU General Public License, version 3 or later. | ||
| */ | ||
| #ifdef __cplusplus | ||
| #define EXPORT_C extern "C" | ||
| #else | ||
| #define EXPORT_C | ||
| #endif | ||
|
|
||
| #pragma once | ||
| #include <obs-module.h> | ||
| #include <obs-frontend-api.h> | ||
| #include <obs.hpp> | ||
| #include <properties-view.hpp> | ||
|
|
||
| #include <QDialog> | ||
| #include <QAction> | ||
| #include <QMainWindow> | ||
| #include <QLabel> | ||
|
|
||
| #include "./forms/ui_output.h" | ||
|
|
||
| #include <util/platform.h> | ||
|
|
||
| class ASIOSettingsDialog : public QDialog { | ||
| Q_OBJECT | ||
|
|
||
| public: | ||
| explicit ASIOSettingsDialog(QWidget *parent = 0, obs_output_t *output = nullptr, OBSData settings = nullptr); | ||
| std::unique_ptr<Ui_Output> ui; | ||
| void ShowHideDialog(bool enabled); | ||
| void SetupPropertiesView(bool enabled); | ||
| void SaveSettings(); | ||
| OBSData _settings; | ||
| obs_output_t *_output; | ||
| std::string currentDeviceName; | ||
|
|
||
| public slots: | ||
| void PropertiesChanged(); | ||
|
|
||
| private: | ||
| OBSPropertiesView *propertiesView; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| cmake_minimum_required(VERSION 3.28...3.30) | ||
|
|
||
| find_package(Qt6 REQUIRED Widgets) | ||
|
|
||
| add_library(asio-output-ui MODULE) | ||
| add_library(OBS::asio-output-ui ALIAS asio-output-ui) | ||
|
|
||
| target_sources(asio-output-ui PRIVATE asio-ui-main.cpp ASIOSettingsDialog.cpp ASIOSettingsDialog.h) | ||
|
|
||
| target_sources(asio-output-ui PRIVATE forms/output.ui) | ||
|
|
||
| target_link_libraries(asio-output-ui PRIVATE OBS::libobs OBS::frontend-api OBS::properties-view Qt::Widgets) | ||
|
|
||
| configure_file(cmake/windows/obs-module.rc.in asio-output-ui.rc) | ||
| target_sources(asio-output-ui PRIVATE asio-output-ui.rc) | ||
|
|
||
| set_property(TARGET asio-output-ui APPEND PROPERTY AUTORCC_OPTIONS --format-version 1) | ||
|
|
||
| set_target_properties_obs( | ||
| asio-output-ui | ||
| PROPERTIES FOLDER frontend | ||
| PREFIX "" | ||
| AUTOMOC ON | ||
| AUTOUIC ON | ||
| AUTORCC ON | ||
| AUTOUIC_SEARCH_PATHS forms | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.