UI: Add application audio capture to toolbar

master
jpark37 2022-06-02 22:17:14 -07:00 committed by Jim
parent 769a29bd1a
commit 1610ac04ff
3 changed files with 37 additions and 0 deletions

View File

@ -273,6 +273,26 @@ void WindowCaptureToolbar::Init()
ComboSelectToolbar::Init();
}
ApplicationAudioCaptureToolbar::ApplicationAudioCaptureToolbar(QWidget *parent,
OBSSource source)
: ComboSelectToolbar(parent, source)
{
}
void ApplicationAudioCaptureToolbar::Init()
{
delete ui->activateButton;
ui->activateButton = nullptr;
obs_module_t *mod = obs_get_module("win-wasapi");
const char *device_str = obs_module_get_locale_text(mod, "Window");
ui->deviceLabel->setText(device_str);
prop_name = "window";
ComboSelectToolbar::Init();
}
DisplayCaptureToolbar::DisplayCaptureToolbar(QWidget *parent, OBSSource source)
: ComboSelectToolbar(parent, source)
{

View File

@ -82,6 +82,14 @@ public:
void Init() override;
};
class ApplicationAudioCaptureToolbar : public ComboSelectToolbar {
Q_OBJECT
public:
ApplicationAudioCaptureToolbar(QWidget *parent, OBSSource source);
void Init() override;
};
class DisplayCaptureToolbar : public ComboSelectToolbar {
Q_OBJECT

View File

@ -3110,6 +3110,15 @@ void OBSBasic::UpdateContextBar(bool force)
c->Init();
ui->emptySpace->layout()->addWidget(c);
} else if (strcmp(id,
"wasapi_process_output_capture") ==
0) {
ApplicationAudioCaptureToolbar *c =
new ApplicationAudioCaptureToolbar(
ui->emptySpace, source);
c->Init();
ui->emptySpace->layout()->addWidget(c);
} else if (strcmp(id, "window_capture") == 0 ||
strcmp(id, "xcomposite_input") == 0) {
WindowCaptureToolbar *c =