use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub type AUValue = c_float;
pub type AUParameterAddress = u64;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AUParameterAutomationEventType(pub u32);
impl AUParameterAutomationEventType {
#[doc(alias = "AUParameterAutomationEventTypeValue")]
pub const Value: Self = Self(0);
#[doc(alias = "AUParameterAutomationEventTypeTouch")]
pub const Touch: Self = Self(1);
#[doc(alias = "AUParameterAutomationEventTypeRelease")]
pub const Release: Self = Self(2);
}
unsafe impl Encode for AUParameterAutomationEventType {
const ENCODING: Encoding = u32::ENCODING;
}
unsafe impl RefEncode for AUParameterAutomationEventType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AURecordedParameterEvent {
pub hostTime: u64,
pub address: AUParameterAddress,
pub value: AUValue,
}
unsafe impl Encode for AURecordedParameterEvent {
const ENCODING: Encoding = Encoding::Struct(
"AURecordedParameterEvent",
&[
<u64>::ENCODING,
<AUParameterAddress>::ENCODING,
<AUValue>::ENCODING,
],
);
}
unsafe impl RefEncode for AURecordedParameterEvent {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AUParameterAutomationEvent {
pub hostTime: u64,
pub address: AUParameterAddress,
pub value: AUValue,
pub eventType: AUParameterAutomationEventType,
pub reserved: u64,
}
unsafe impl Encode for AUParameterAutomationEvent {
const ENCODING: Encoding = Encoding::Struct(
"AUParameterAutomationEvent",
&[
<u64>::ENCODING,
<AUParameterAddress>::ENCODING,
<AUValue>::ENCODING,
<AUParameterAutomationEventType>::ENCODING,
<u64>::ENCODING,
],
);
}
unsafe impl RefEncode for AUParameterAutomationEvent {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "block2")]
pub type AUParameterObserver = *mut block2::DynBlock<dyn Fn(AUParameterAddress, AUValue)>;
#[cfg(feature = "block2")]
pub type AUParameterRecordingObserver =
*mut block2::DynBlock<dyn Fn(NSInteger, NonNull<AURecordedParameterEvent>)>;
#[cfg(feature = "block2")]
pub type AUParameterAutomationObserver =
*mut block2::DynBlock<dyn Fn(NSInteger, NonNull<AUParameterAutomationEvent>)>;
pub type AUParameterObserverToken = *mut c_void;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct AUParameterNode;
);
extern_conformance!(
unsafe impl NSObjectProtocol for AUParameterNode {}
);
impl AUParameterNode {
extern_methods!(
#[unsafe(method(identifier))]
#[unsafe(method_family = none)]
pub unsafe fn identifier(&self) -> Retained<NSString>;
#[unsafe(method(keyPath))]
#[unsafe(method_family = none)]
pub unsafe fn keyPath(&self) -> Retained<NSString>;
#[unsafe(method(displayName))]
#[unsafe(method_family = none)]
pub unsafe fn displayName(&self) -> Retained<NSString>;
#[unsafe(method(displayNameWithLength:))]
#[unsafe(method_family = none)]
pub unsafe fn displayNameWithLength(&self, maximum_length: NSInteger)
-> Retained<NSString>;
#[cfg(feature = "block2")]
#[unsafe(method(tokenByAddingParameterObserver:))]
#[unsafe(method_family = none)]
pub unsafe fn tokenByAddingParameterObserver(
&self,
observer: AUParameterObserver,
) -> AUParameterObserverToken;
#[cfg(feature = "block2")]
#[unsafe(method(tokenByAddingParameterRecordingObserver:))]
#[unsafe(method_family = none)]
pub unsafe fn tokenByAddingParameterRecordingObserver(
&self,
observer: AUParameterRecordingObserver,
) -> AUParameterObserverToken;
#[cfg(feature = "block2")]
#[unsafe(method(tokenByAddingParameterAutomationObserver:))]
#[unsafe(method_family = none)]
pub unsafe fn tokenByAddingParameterAutomationObserver(
&self,
observer: AUParameterAutomationObserver,
) -> AUParameterObserverToken;
#[unsafe(method(removeParameterObserver:))]
#[unsafe(method_family = none)]
pub unsafe fn removeParameterObserver(&self, token: AUParameterObserverToken);
);
}
impl AUParameterNode {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(AUParameterNode, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct AUParameterGroup;
);
extern_conformance!(
unsafe impl NSCoding for AUParameterGroup {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for AUParameterGroup {}
);
extern_conformance!(
unsafe impl NSSecureCoding for AUParameterGroup {}
);
impl AUParameterGroup {
extern_methods!(
#[unsafe(method(children))]
#[unsafe(method_family = none)]
pub unsafe fn children(&self) -> Retained<NSArray<AUParameterNode>>;
#[unsafe(method(allParameters))]
#[unsafe(method_family = none)]
pub unsafe fn allParameters(&self) -> Retained<NSArray<AUParameter>>;
);
}
impl AUParameterGroup {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(AUParameterGroup, AUParameterNode, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct AUParameterTree;
);
extern_conformance!(
unsafe impl NSCoding for AUParameterTree {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for AUParameterTree {}
);
extern_conformance!(
unsafe impl NSSecureCoding for AUParameterTree {}
);
impl AUParameterTree {
extern_methods!(
#[unsafe(method(parameterWithAddress:))]
#[unsafe(method_family = none)]
pub unsafe fn parameterWithAddress(
&self,
address: AUParameterAddress,
) -> Option<Retained<AUParameter>>;
#[cfg(feature = "AUComponent")]
#[unsafe(method(parameterWithID:scope:element:))]
#[unsafe(method_family = none)]
pub unsafe fn parameterWithID_scope_element(
&self,
param_id: AudioUnitParameterID,
scope: AudioUnitScope,
element: AudioUnitElement,
) -> Option<Retained<AUParameter>>;
);
}
impl AUParameterTree {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(AUParameterNode, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct AUParameter;
);
extern_conformance!(
unsafe impl NSCoding for AUParameter {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for AUParameter {}
);
extern_conformance!(
unsafe impl NSSecureCoding for AUParameter {}
);
impl AUParameter {
extern_methods!(
#[unsafe(method(minValue))]
#[unsafe(method_family = none)]
pub unsafe fn minValue(&self) -> AUValue;
#[unsafe(method(maxValue))]
#[unsafe(method_family = none)]
pub unsafe fn maxValue(&self) -> AUValue;
#[cfg(feature = "AudioUnitProperties")]
#[unsafe(method(unit))]
#[unsafe(method_family = none)]
pub unsafe fn unit(&self) -> AudioUnitParameterUnit;
#[unsafe(method(unitName))]
#[unsafe(method_family = none)]
pub unsafe fn unitName(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "AudioUnitProperties")]
#[unsafe(method(flags))]
#[unsafe(method_family = none)]
pub unsafe fn flags(&self) -> AudioUnitParameterOptions;
#[unsafe(method(address))]
#[unsafe(method_family = none)]
pub unsafe fn address(&self) -> AUParameterAddress;
#[unsafe(method(valueStrings))]
#[unsafe(method_family = none)]
pub unsafe fn valueStrings(&self) -> Option<Retained<NSArray<NSString>>>;
#[unsafe(method(dependentParameters))]
#[unsafe(method_family = none)]
pub unsafe fn dependentParameters(&self) -> Option<Retained<NSArray<NSNumber>>>;
#[unsafe(method(value))]
#[unsafe(method_family = none)]
pub unsafe fn value(&self) -> AUValue;
#[unsafe(method(setValue:))]
#[unsafe(method_family = none)]
pub unsafe fn setValue(&self, value: AUValue);
#[unsafe(method(setValue:originator:))]
#[unsafe(method_family = none)]
pub unsafe fn setValue_originator(
&self,
value: AUValue,
originator: AUParameterObserverToken,
);
#[unsafe(method(setValue:originator:atHostTime:))]
#[unsafe(method_family = none)]
pub unsafe fn setValue_originator_atHostTime(
&self,
value: AUValue,
originator: AUParameterObserverToken,
host_time: u64,
);
#[unsafe(method(setValue:originator:atHostTime:eventType:))]
#[unsafe(method_family = none)]
pub unsafe fn setValue_originator_atHostTime_eventType(
&self,
value: AUValue,
originator: AUParameterObserverToken,
host_time: u64,
event_type: AUParameterAutomationEventType,
);
#[unsafe(method(stringFromValue:))]
#[unsafe(method_family = none)]
pub unsafe fn stringFromValue(&self, value: *const AUValue) -> Retained<NSString>;
#[unsafe(method(valueFromString:))]
#[unsafe(method_family = none)]
pub unsafe fn valueFromString(&self, string: &NSString) -> AUValue;
);
}
impl AUParameter {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}