Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ add_obs_plugin(linux-jack PLATFORMS LINUX FREEBSD OPENBSD)
add_obs_plugin(linux-pipewire PLATFORMS LINUX FREEBSD OPENBSD)
add_obs_plugin(linux-pulseaudio PLATFORMS LINUX FREEBSD OPENBSD)
add_obs_plugin(linux-v4l2 PLATFORMS LINUX FREEBSD OPENBSD)
add_obs_plugin(mac-au PLATFORMS MACOS)
add_obs_plugin(mac-avcapture PLATFORMS MACOS)
add_obs_plugin(mac-capture PLATFORMS MACOS)
add_obs_plugin(mac-syphon PLATFORMS MACOS)
Expand Down
36 changes: 36 additions & 0 deletions plugins/mac-au/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
cmake_minimum_required(VERSION 3.28...3.30)

add_library(mac-au MODULE)
add_library(OBS::au ALIAS mac-au)

target_sources(
mac-au
PRIVATE mac-au.cpp mac-au.h mac-au-scan.mm mac-au-scan.h mac-au-plugin.mm mac-au-plugin.h plugin-main.cpp
)

target_link_libraries(
mac-au
PRIVATE
OBS::libobs
"$<LINK_LIBRARY:FRAMEWORK,AudioUnit.framework>"
"$<LINK_LIBRARY:FRAMEWORK,AudioToolbox.framework>"
"$<LINK_LIBRARY:FRAMEWORK,AVFoundation.framework>"
"$<LINK_LIBRARY:FRAMEWORK,Cocoa.framework>"
"$<LINK_LIBRARY:FRAMEWORK,CoreAudio.framework>"
"$<LINK_LIBRARY:FRAMEWORK,CoreAudioKit.framework>"
"$<LINK_LIBRARY:FRAMEWORK,CoreFoundation.framework>"
)

set_source_files_properties(mac-au-plugin.mm mac-au-scan.mm PROPERTIES COMPILE_FLAGS "-fobjc-arc")

set_target_properties_obs(
mac-au
PROPERTIES FOLDER plugins
PREFIX ""
XCODE_ATTRIBUTE_CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION YES
XCODE_ATTRIBUTE_GCC_WARN_SHADOW YES
)

if(CMAKE_VERSION VERSION_LESS_EQUAL 3.25.0)
set_property(TARGET mac-au PROPERTY XCODE_LINK_BUILD_PHASE_MODE BUILT_ONLY)
endif()
7 changes: 7 additions & 0 deletions plugins/mac-au/data/locale/en-US.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
AU.Filter="AU host filter"
AU.Plugin="AU Plugin"
AU.Button="Open/Close AU Editor"
AU.NOGUI="Warning: this AU has no GUI."
AU.ERR="This AU failed to initialize.\nCheck the log for more info."
AU.Select="Select an AU ..."
AU.SidechainSource="Sidechain source"
82 changes: 82 additions & 0 deletions plugins/mac-au/mac-au-plugin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*****************************************************************************
Copyright (C) 2025 by pkv@obsproject.com

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 2 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 "mac-au-scan.h"
#include <stdint.h>
#include <stdbool.h>

#ifdef __OBJC__
#import <AVFoundation/AVFoundation.h>
#import <CoreAudioKit/CoreAudioKit.h>
#import <Cocoa/Cocoa.h>
#else
typedef void AVAudioUnit;
typedef void AUAudioUnit;
typedef void AUViewControllerBase;
typedef void NSWindow;
#endif

struct au_data;

struct au_plugin {
char uid[32];
char name[64];
NSString *title;
char vendor[64];

OSType type;
OSType subtype;
OSType manufacturer;
bool is_v3;

AVAudioUnit *av_unit;
AUAudioUnit *au;
void *objc;

bool has_view;
bool editor_is_visible;

uint32_t max_frames;
double sample_rate;
uint32_t channels;
double sample_time;

int num_in_audio_buses;
int num_out_audio_buses;
int num_enabled_in_audio_buses;
int num_enabled_out_audio_buses;
int sidechain_num_channels;
};

#ifdef __cplusplus
extern "C" {
#endif

struct au_plugin *au_plugin_create(const struct au_descriptor *desc, double sr, uint32_t frames, uint32_t channels);
void au_plugin_destroy(struct au_plugin *p);
void au_plugin_process(struct au_plugin *p, float *const *channels, float *const *sc_channels,
bool sidechain_enabled, uint32_t num_frames, uint32_t num_channels);

CFDataRef au_plugin_save_state(struct au_plugin *p);
void au_plugin_load_state(struct au_plugin *p, CFDataRef data);

void au_plugin_show_editor(struct au_plugin *p);
void au_plugin_hide_editor(struct au_plugin *p);

#ifdef __cplusplus
}
#endif
Loading
Loading