-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
win-asio: Add 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
9
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.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5628a9b
win-asio: Add ASIO source & output
pkviet 12f4913
UI: Add ASIO output frontend plugin
pkviet d9f6fec
libobs: Add ASIO monitoring track
pkviet a2ca336
libobs: Audio routing of MONITOR_ONLY sources
pkviet 341953f
libobs: Don't silence the extra monitoring track for ASIO
pkviet 42ffee9
win-asio: Enable monitoring track for output
pkviet 6d50ce0
UI: Add to Settings > Audio ASIO monitoring
pkviet 8ee58b6
plugins: Enable extra ASIO monitoring track for transitions and slide…
pkviet 3336c2c
obs-transitions: Set tracks for stinger
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,113 @@ | ||
| /****************************************************************************** | ||
| Copyright (C) 2022-2026 pkv <pkv@obsproject.com> | ||
|
|
||
| This file is part of asio-output-ui which requires win-asio. | ||
|
|
||
| This program is free software: you can redistribute it and/or modify | ||
| it under the terms of the GNU General Public License as published by | ||
| the Free Software Foundation, either version 3 of the License, or | ||
| (at your option) any later version. | ||
|
|
||
| This program is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU General Public License for more details. | ||
|
|
||
| You should have received a copy of the GNU General Public License | ||
| along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| ******************************************************************************/ | ||
|
|
||
| #include "ASIOSettingsDialog.h" | ||
|
|
||
| #include <obs-module.h> | ||
| #include <util/platform.h> | ||
| #include <util/util.hpp> | ||
|
|
||
| #include <QLabel> | ||
|
|
||
| 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) { | ||
| // No device swapped to a valid device: start if not running | ||
| if (!output_running) { | ||
| output_start(); | ||
| } | ||
| } else if (!wasEmpty && nowEmpty) { | ||
| // Valid device swapped to 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,49 @@ | ||
| /****************************************************************************** | ||
| Copyright (C) 2022-2026 pkv <pkv@obsproject.com> | ||
|
|
||
| This file is part of asio-output-ui which requires win-asio. | ||
|
|
||
| This program is free software: you can redistribute it and/or modify | ||
| it under the terms of the GNU General Public License as published by | ||
| the Free Software Foundation, either version 3 of the License, or | ||
| (at your option) any later version. | ||
|
|
||
| This program is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU General Public License for more details. | ||
|
|
||
| You should have received a copy of the GNU General Public License | ||
| along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| ******************************************************************************/ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "ui_output.h" | ||
|
|
||
| #include <obs.hpp> | ||
| #include <properties-view.hpp> | ||
|
|
||
| #include <memory> | ||
|
|
||
| #include <QDialog> | ||
|
|
||
| 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.
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.