diff --git a/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart b/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart index 5ab673e89..0fb0dae8c 100644 --- a/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart +++ b/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart @@ -492,6 +492,36 @@ late final _sel_channelAssignments = objc.registerName("channelAssignments"); late final _sel_setChannelAssignments_ = objc.registerName( "setChannelAssignments:", ); + +/// WARNING: CASpatialAudioExperience is a stub. To generate bindings for this class, include +/// CASpatialAudioExperience in your config's objc-interfaces list. +/// +/// CASpatialAudioExperience +class CASpatialAudioExperience extends objc.ObjCObjectBase { + CASpatialAudioExperience._( + ffi.Pointer pointer, { + bool retain = false, + bool release = false, + }) : super(pointer, retain: retain, release: release); + + /// Constructs a [CASpatialAudioExperience] that points to the same underlying object as [other]. + CASpatialAudioExperience.castFrom(objc.ObjCObjectBase other) + : this._(other.ref.pointer, retain: true, release: true); + + /// Constructs a [CASpatialAudioExperience] that wraps the given raw object pointer. + CASpatialAudioExperience.castFromPointer( + ffi.Pointer other, { + bool retain = false, + bool release = false, + }) : this._(other, retain: retain, release: release); +} + +late final _sel_intendedSpatialExperience = objc.registerName( + "intendedSpatialExperience", +); +late final _sel_setIntendedSpatialExperience_ = objc.registerName( + "setIntendedSpatialExperience:", +); late final _sel_init = objc.registerName("init"); late final _sel_new = objc.registerName("new"); late final _sel_allocWithZone_ = objc.registerName("allocWithZone:"); @@ -813,6 +843,24 @@ extension AVAudioPlayer$Methods on AVAudioPlayer { : AVAudioPlayer.castFromPointer($ret, retain: false, release: true); } + /// intendedSpatialExperience + CASpatialAudioExperience get intendedSpatialExperience { + objc.checkOsVersionInternal( + 'AVAudioPlayer.intendedSpatialExperience', + iOS: (true, null), + macOS: (true, null), + ); + final $ret = _objc_msgSend_151sglz( + this.ref.pointer, + _sel_intendedSpatialExperience, + ); + return CASpatialAudioExperience.castFromPointer( + $ret, + retain: true, + release: true, + ); + } + /// isMeteringEnabled bool get isMeteringEnabled { objc.checkOsVersionInternal( @@ -999,6 +1047,20 @@ extension AVAudioPlayer$Methods on AVAudioPlayer { _objc_msgSend_1s56lr9(this.ref.pointer, _sel_setEnableRate_, value); } + /// setIntendedSpatialExperience: + set intendedSpatialExperience(CASpatialAudioExperience value) { + objc.checkOsVersionInternal( + 'AVAudioPlayer.setIntendedSpatialExperience:', + iOS: (true, null), + macOS: (true, null), + ); + _objc_msgSend_xtuoz7( + this.ref.pointer, + _sel_setIntendedSpatialExperience_, + value.ref.pointer, + ); + } + /// setMeteringEnabled: set isMeteringEnabled(bool value) { objc.checkOsVersionInternal( diff --git a/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart.m b/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart.m deleted file mode 100644 index c2b8aefd5..000000000 --- a/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart.m +++ /dev/null @@ -1,55 +0,0 @@ -#include -#import -#import -#import - -#if !__has_feature(objc_arc) -#error "This file must be compiled with ARC enabled" -#endif - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wundeclared-selector" - -typedef struct { - int64_t version; - void* (*newWaiter)(void); - void (*awaitWaiter)(void*); - void* (*currentIsolate)(void); - void (*enterIsolate)(void*); - void (*exitIsolate)(void); - int64_t (*getMainPortId)(void); - bool (*getCurrentThreadOwnsIsolate)(int64_t); -} DOBJC_Context; - -id objc_retainBlock(id); - -#define BLOCKING_BLOCK_IMPL(ctx, BLOCK_SIG, INVOKE_DIRECT, INVOKE_LISTENER) \ - assert(ctx->version >= 1); \ - void* targetIsolate = ctx->currentIsolate(); \ - int64_t targetPort = ctx->getMainPortId == NULL ? 0 : ctx->getMainPortId(); \ - return BLOCK_SIG { \ - void* currentIsolate = ctx->currentIsolate(); \ - bool mayEnterIsolate = \ - currentIsolate == NULL && \ - ctx->getCurrentThreadOwnsIsolate != NULL && \ - ctx->getCurrentThreadOwnsIsolate(targetPort); \ - if (currentIsolate == targetIsolate || mayEnterIsolate) { \ - if (mayEnterIsolate) { \ - ctx->enterIsolate(targetIsolate); \ - } \ - INVOKE_DIRECT; \ - if (mayEnterIsolate) { \ - ctx->exitIsolate(); \ - } \ - } else { \ - void* waiter = ctx->newWaiter(); \ - INVOKE_LISTENER; \ - ctx->awaitWaiter(waiter); \ - } \ - }; - - -Protocol* _NativeLibrary_AVAudioPlayerDelegate(void) { return @protocol(AVAudioPlayerDelegate); } -#undef BLOCKING_BLOCK_IMPL - -#pragma clang diagnostic pop diff --git a/pkgs/ffigen/lib/src/code_generator/objc_protocol.dart b/pkgs/ffigen/lib/src/code_generator/objc_protocol.dart index 4d3ba5da4..a8c01048e 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_protocol.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_protocol.dart @@ -329,6 +329,8 @@ ${generateInstanceMethodBindings(w, this)} @override BindingString? toObjCBindingString(Writer w) { + if (generateAsStub) return null; + final wrapName = context.objCBuiltInFunctions.wrapperName; final mainString = '''