|
1 | 1 | #include <AudioUnit/AudioUnit.h>
|
2 | 2 | #include <CoreFoundation/CFString.h>
|
3 | 3 | #include <CoreAudio/CoreAudio.h>
|
| 4 | +#include <AVFoundation/AVCaptureDevice.h> |
4 | 5 | #include <unistd.h>
|
5 | 6 | #include <errno.h>
|
6 | 7 |
|
|
51 | 52 | enum speaker_layout speakers;
|
52 | 53 | bool enable_downmix;
|
53 | 54 |
|
| 55 | + char *effect_warning; |
| 56 | + |
54 | 57 | pthread_t reconnect_thread;
|
55 | 58 | os_event_t *exit_event;
|
56 | 59 | volatile bool reconnecting;
|
@@ -996,6 +999,27 @@ static bool coreaudio_downmix_changed(void *data, obs_properties_t *props, obs_p
|
996 | 999 |
|
997 | 1000 | obs_property_set_modified_callback2(property, coreaudio_device_changed, ca);
|
998 | 1001 |
|
| 1002 | + // This file is compiled as Objective-C so that we may more easily check this class property |
| 1003 | + if (@available(macOS 12.0, *)) { |
| 1004 | + AVCaptureMicrophoneMode activeMicrophoneMode = AVCaptureDevice.activeMicrophoneMode; |
| 1005 | + NSString *effectWarningKey = nil; |
| 1006 | + switch (activeMicrophoneMode) { |
| 1007 | + case AVCaptureMicrophoneModeStandard: |
| 1008 | + break; |
| 1009 | + case AVCaptureMicrophoneModeWideSpectrum: |
| 1010 | + effectWarningKey = @"Warning.Effect.Audio.WideSpectrum"; |
| 1011 | + break; |
| 1012 | + case AVCaptureMicrophoneModeVoiceIsolation: |
| 1013 | + effectWarningKey = @"Warning.Effect.Audio.VoiceIsolation"; |
| 1014 | + break; |
| 1015 | + } |
| 1016 | + if (effectWarningKey) { |
| 1017 | + property = obs_properties_add_text(props, "effect_warning", obs_module_text(effectWarningKey.UTF8String), |
| 1018 | + OBS_TEXT_INFO); |
| 1019 | + obs_property_text_set_info_type(property, OBS_TEXT_INFO_WARNING); |
| 1020 | + } |
| 1021 | + } |
| 1022 | + |
999 | 1023 | property = obs_properties_add_bool(props, "enable_downmix", obs_module_text("CoreAudio.Downmix"));
|
1000 | 1024 | obs_property_set_modified_callback2(property, coreaudio_downmix_changed, ca);
|
1001 | 1025 |
|
|
0 commit comments