use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AURenderEventType(pub u8);
impl AURenderEventType {
#[doc(alias = "AURenderEventParameter")]
pub const Parameter: Self = Self(1);
#[doc(alias = "AURenderEventParameterRamp")]
pub const ParameterRamp: Self = Self(2);
#[doc(alias = "AURenderEventMIDI")]
pub const MIDI: Self = Self(8);
#[doc(alias = "AURenderEventMIDISysEx")]
pub const MIDISysEx: Self = Self(9);
#[doc(alias = "AURenderEventMIDIEventList")]
pub const MIDIEventList: Self = Self(10);
}
unsafe impl Encode for AURenderEventType {
const ENCODING: Encoding = u8::ENCODING;
}
unsafe impl RefEncode for AURenderEventType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "AUAudioUnit")]
impl AUAudioUnit {
extern_methods!(
#[cfg(feature = "AudioComponent")]
#[unsafe(method(registerSubclass:asComponentDescription:name:version:))]
#[unsafe(method_family = none)]
pub unsafe fn registerSubclass_asComponentDescription_name_version(
cls: &AnyClass,
component_description: AudioComponentDescription,
name: &NSString,
version: u32,
);
#[unsafe(method(MIDIOutputBufferSizeHint))]
#[unsafe(method_family = none)]
pub unsafe fn MIDIOutputBufferSizeHint(&self) -> NSInteger;
#[unsafe(method(setMIDIOutputBufferSizeHint:))]
#[unsafe(method_family = none)]
pub unsafe fn setMIDIOutputBufferSizeHint(&self, midi_output_buffer_size_hint: NSInteger);
#[unsafe(method(setRenderResourcesAllocated:))]
#[unsafe(method_family = none)]
pub unsafe fn setRenderResourcesAllocated(&self, flag: bool);
);
}
#[cfg(feature = "AUAudioUnit")]
impl AUAudioUnitBus {
extern_methods!(
#[unsafe(method(supportedChannelCounts))]
#[unsafe(method_family = none)]
pub unsafe fn supportedChannelCounts(&self) -> Option<Retained<NSArray<NSNumber>>>;
#[unsafe(method(setSupportedChannelCounts:))]
#[unsafe(method_family = none)]
pub unsafe fn setSupportedChannelCounts(
&self,
supported_channel_counts: Option<&NSArray<NSNumber>>,
);
#[unsafe(method(maximumChannelCount))]
#[unsafe(method_family = none)]
pub unsafe fn maximumChannelCount(&self) -> AUAudioChannelCount;
#[unsafe(method(setMaximumChannelCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setMaximumChannelCount(&self, maximum_channel_count: AUAudioChannelCount);
);
}
#[cfg(feature = "AUAudioUnit")]
impl AUAudioUnitBusArray {
extern_methods!(
#[unsafe(method(replaceBusses:))]
#[unsafe(method_family = none)]
pub unsafe fn replaceBusses(&self, bus_array: &NSArray<AUAudioUnitBus>);
);
}
#[cfg(feature = "AUParameters")]
impl AUParameterTree {
extern_methods!(
#[cfg(feature = "AudioUnitProperties")]
#[unsafe(method(createParameterWithIdentifier:name:address:min:max:unit:unitName:flags:valueStrings:dependentParameters:))]
#[unsafe(method_family = none)]
pub unsafe fn createParameterWithIdentifier_name_address_min_max_unit_unitName_flags_valueStrings_dependentParameters(
identifier: &NSString,
name: &NSString,
address: AUParameterAddress,
min: AUValue,
max: AUValue,
unit: AudioUnitParameterUnit,
unit_name: Option<&NSString>,
flags: AudioUnitParameterOptions,
value_strings: Option<&NSArray<NSString>>,
dependent_parameters: Option<&NSArray<NSNumber>>,
) -> Retained<AUParameter>;
#[unsafe(method(createGroupWithIdentifier:name:children:))]
#[unsafe(method_family = none)]
pub unsafe fn createGroupWithIdentifier_name_children(
identifier: &NSString,
name: &NSString,
children: &NSArray<AUParameterNode>,
) -> Retained<AUParameterGroup>;
#[unsafe(method(createGroupTemplate:))]
#[unsafe(method_family = none)]
pub unsafe fn createGroupTemplate(
children: &NSArray<AUParameterNode>,
) -> Retained<AUParameterGroup>;
#[unsafe(method(createGroupFromTemplate:identifier:name:addressOffset:))]
#[unsafe(method_family = none)]
pub unsafe fn createGroupFromTemplate_identifier_name_addressOffset(
template_group: &AUParameterGroup,
identifier: &NSString,
name: &NSString,
address_offset: AUParameterAddress,
) -> Retained<AUParameterGroup>;
#[unsafe(method(createTreeWithChildren:))]
#[unsafe(method_family = none)]
pub unsafe fn createTreeWithChildren(
children: &NSArray<AUParameterNode>,
) -> Retained<AUParameterTree>;
);
}
#[cfg(all(feature = "AUParameters", feature = "block2"))]
pub type AUImplementorValueObserver = *mut block2::DynBlock<dyn Fn(NonNull<AUParameter>, AUValue)>;
#[cfg(all(feature = "AUParameters", feature = "block2"))]
pub type AUImplementorValueProvider =
*mut block2::DynBlock<dyn Fn(NonNull<AUParameter>) -> AUValue>;
#[cfg(all(feature = "AUParameters", feature = "block2"))]
pub type AUImplementorStringFromValueCallback =
*mut block2::DynBlock<dyn Fn(NonNull<AUParameter>, *const AUValue) -> NonNull<NSString>>;
#[cfg(all(feature = "AUParameters", feature = "block2"))]
pub type AUImplementorValueFromStringCallback =
*mut block2::DynBlock<dyn Fn(NonNull<AUParameter>, NonNull<NSString>) -> AUValue>;
#[cfg(all(feature = "AUParameters", feature = "block2"))]
pub type AUImplementorDisplayNameWithLengthCallback =
*mut block2::DynBlock<dyn Fn(NonNull<AUParameterNode>, NSInteger) -> NonNull<NSString>>;
#[cfg(feature = "AUParameters")]
impl AUParameterNode {
extern_methods!(
#[cfg(feature = "block2")]
#[unsafe(method(implementorValueObserver))]
#[unsafe(method_family = none)]
pub unsafe fn implementorValueObserver(&self) -> AUImplementorValueObserver;
#[cfg(feature = "block2")]
#[unsafe(method(setImplementorValueObserver:))]
#[unsafe(method_family = none)]
pub unsafe fn setImplementorValueObserver(
&self,
implementor_value_observer: AUImplementorValueObserver,
);
#[cfg(feature = "block2")]
#[unsafe(method(implementorValueProvider))]
#[unsafe(method_family = none)]
pub unsafe fn implementorValueProvider(&self) -> AUImplementorValueProvider;
#[cfg(feature = "block2")]
#[unsafe(method(setImplementorValueProvider:))]
#[unsafe(method_family = none)]
pub unsafe fn setImplementorValueProvider(
&self,
implementor_value_provider: AUImplementorValueProvider,
);
#[cfg(feature = "block2")]
#[unsafe(method(implementorStringFromValueCallback))]
#[unsafe(method_family = none)]
pub unsafe fn implementorStringFromValueCallback(
&self,
) -> AUImplementorStringFromValueCallback;
#[cfg(feature = "block2")]
#[unsafe(method(setImplementorStringFromValueCallback:))]
#[unsafe(method_family = none)]
pub unsafe fn setImplementorStringFromValueCallback(
&self,
implementor_string_from_value_callback: AUImplementorStringFromValueCallback,
);
#[cfg(feature = "block2")]
#[unsafe(method(implementorValueFromStringCallback))]
#[unsafe(method_family = none)]
pub unsafe fn implementorValueFromStringCallback(
&self,
) -> AUImplementorValueFromStringCallback;
#[cfg(feature = "block2")]
#[unsafe(method(setImplementorValueFromStringCallback:))]
#[unsafe(method_family = none)]
pub unsafe fn setImplementorValueFromStringCallback(
&self,
implementor_value_from_string_callback: AUImplementorValueFromStringCallback,
);
#[cfg(feature = "block2")]
#[unsafe(method(implementorDisplayNameWithLengthCallback))]
#[unsafe(method_family = none)]
pub unsafe fn implementorDisplayNameWithLengthCallback(
&self,
) -> AUImplementorDisplayNameWithLengthCallback;
#[cfg(feature = "block2")]
#[unsafe(method(setImplementorDisplayNameWithLengthCallback:))]
#[unsafe(method_family = none)]
pub unsafe fn setImplementorDisplayNameWithLengthCallback(
&self,
implementor_display_name_with_length_callback: AUImplementorDisplayNameWithLengthCallback,
);
);
}
extern_class!(
#[unsafe(super(AUAudioUnit, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "AUAudioUnit")]
pub struct AUAudioUnitV2Bridge;
);
#[cfg(feature = "AUAudioUnit")]
extern_conformance!(
unsafe impl NSObjectProtocol for AUAudioUnitV2Bridge {}
);
#[cfg(feature = "AUAudioUnit")]
impl AUAudioUnitV2Bridge {
extern_methods!(
#[cfg(all(feature = "AUComponent", feature = "AudioComponent"))]
#[unsafe(method(audioUnit))]
#[unsafe(method_family = none)]
pub unsafe fn audioUnit(&self) -> AudioUnit;
);
}
#[cfg(feature = "AUAudioUnit")]
impl AUAudioUnitV2Bridge {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "AudioComponent")]
#[unsafe(method(initWithComponentDescription:options:error:_))]
#[unsafe(method_family = init)]
pub unsafe fn initWithComponentDescription_options_error(
this: Allocated<Self>,
component_description: AudioComponentDescription,
options: AudioComponentInstantiationOptions,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(feature = "AudioComponent")]
#[unsafe(method(initWithComponentDescription:error:_))]
#[unsafe(method_family = init)]
pub unsafe fn initWithComponentDescription_error(
this: Allocated<Self>,
component_description: AudioComponentDescription,
) -> Result<Retained<Self>, Retained<NSError>>;
);
}
#[cfg(feature = "AUAudioUnit")]
impl AUAudioUnitV2Bridge {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_protocol!(
pub unsafe trait AUAudioUnitFactory: NSExtensionRequestHandling {
#[cfg(all(feature = "AUAudioUnit", feature = "AudioComponent"))]
#[unsafe(method(createAudioUnitWithComponentDescription:error:_))]
#[unsafe(method_family = none)]
unsafe fn createAudioUnitWithComponentDescription_error(
&self,
desc: AudioComponentDescription,
) -> Result<Retained<AUAudioUnit>, Retained<NSError>>;
}
);