objc2_avf_audio/generated/
AVAudioUnitDistortion.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-audio-toolbox")]
7#[cfg(not(target_os = "watchos"))]
8use objc2_audio_toolbox::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitdistortionpreset?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct AVAudioUnitDistortionPreset(pub NSInteger);
17impl AVAudioUnitDistortionPreset {
18    #[doc(alias = "AVAudioUnitDistortionPresetDrumsBitBrush")]
19    pub const DrumsBitBrush: Self = Self(0);
20    #[doc(alias = "AVAudioUnitDistortionPresetDrumsBufferBeats")]
21    pub const DrumsBufferBeats: Self = Self(1);
22    #[doc(alias = "AVAudioUnitDistortionPresetDrumsLoFi")]
23    pub const DrumsLoFi: Self = Self(2);
24    #[doc(alias = "AVAudioUnitDistortionPresetMultiBrokenSpeaker")]
25    pub const MultiBrokenSpeaker: Self = Self(3);
26    #[doc(alias = "AVAudioUnitDistortionPresetMultiCellphoneConcert")]
27    pub const MultiCellphoneConcert: Self = Self(4);
28    #[doc(alias = "AVAudioUnitDistortionPresetMultiDecimated1")]
29    pub const MultiDecimated1: Self = Self(5);
30    #[doc(alias = "AVAudioUnitDistortionPresetMultiDecimated2")]
31    pub const MultiDecimated2: Self = Self(6);
32    #[doc(alias = "AVAudioUnitDistortionPresetMultiDecimated3")]
33    pub const MultiDecimated3: Self = Self(7);
34    #[doc(alias = "AVAudioUnitDistortionPresetMultiDecimated4")]
35    pub const MultiDecimated4: Self = Self(8);
36    #[doc(alias = "AVAudioUnitDistortionPresetMultiDistortedFunk")]
37    pub const MultiDistortedFunk: Self = Self(9);
38    #[doc(alias = "AVAudioUnitDistortionPresetMultiDistortedCubed")]
39    pub const MultiDistortedCubed: Self = Self(10);
40    #[doc(alias = "AVAudioUnitDistortionPresetMultiDistortedSquared")]
41    pub const MultiDistortedSquared: Self = Self(11);
42    #[doc(alias = "AVAudioUnitDistortionPresetMultiEcho1")]
43    pub const MultiEcho1: Self = Self(12);
44    #[doc(alias = "AVAudioUnitDistortionPresetMultiEcho2")]
45    pub const MultiEcho2: Self = Self(13);
46    #[doc(alias = "AVAudioUnitDistortionPresetMultiEchoTight1")]
47    pub const MultiEchoTight1: Self = Self(14);
48    #[doc(alias = "AVAudioUnitDistortionPresetMultiEchoTight2")]
49    pub const MultiEchoTight2: Self = Self(15);
50    #[doc(alias = "AVAudioUnitDistortionPresetMultiEverythingIsBroken")]
51    pub const MultiEverythingIsBroken: Self = Self(16);
52    #[doc(alias = "AVAudioUnitDistortionPresetSpeechAlienChatter")]
53    pub const SpeechAlienChatter: Self = Self(17);
54    #[doc(alias = "AVAudioUnitDistortionPresetSpeechCosmicInterference")]
55    pub const SpeechCosmicInterference: Self = Self(18);
56    #[doc(alias = "AVAudioUnitDistortionPresetSpeechGoldenPi")]
57    pub const SpeechGoldenPi: Self = Self(19);
58    #[doc(alias = "AVAudioUnitDistortionPresetSpeechRadioTower")]
59    pub const SpeechRadioTower: Self = Self(20);
60    #[doc(alias = "AVAudioUnitDistortionPresetSpeechWaves")]
61    pub const SpeechWaves: Self = Self(21);
62}
63
64unsafe impl Encode for AVAudioUnitDistortionPreset {
65    const ENCODING: Encoding = NSInteger::ENCODING;
66}
67
68unsafe impl RefEncode for AVAudioUnitDistortionPreset {
69    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
70}
71
72extern_class!(
73    /// An AVAudioUnitEffect that implements a multi-stage distortion effect.
74    ///
75    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitdistortion?language=objc)
76    #[unsafe(super(AVAudioUnitEffect, AVAudioUnit, AVAudioNode, NSObject))]
77    #[derive(Debug, PartialEq, Eq, Hash)]
78    #[cfg(all(
79        feature = "AVAudioNode",
80        feature = "AVAudioUnit",
81        feature = "AVAudioUnitEffect"
82    ))]
83    pub struct AVAudioUnitDistortion;
84);
85
86#[cfg(all(
87    feature = "AVAudioNode",
88    feature = "AVAudioUnit",
89    feature = "AVAudioUnitEffect"
90))]
91extern_conformance!(
92    unsafe impl NSObjectProtocol for AVAudioUnitDistortion {}
93);
94
95#[cfg(all(
96    feature = "AVAudioNode",
97    feature = "AVAudioUnit",
98    feature = "AVAudioUnitEffect"
99))]
100impl AVAudioUnitDistortion {
101    extern_methods!(
102        /// Load a distortion preset.
103        /// Default:    AVAudioUnitDistortionPresetDrumsBitBrush
104        #[unsafe(method(loadFactoryPreset:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn loadFactoryPreset(&self, preset: AVAudioUnitDistortionPreset);
107
108        /// Gain applied to the signal before being distorted
109        /// Range:      -80 -> 20
110        /// Default:    -6
111        /// Unit:       dB
112        #[unsafe(method(preGain))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn preGain(&self) -> c_float;
115
116        /// Setter for [`preGain`][Self::preGain].
117        #[unsafe(method(setPreGain:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn setPreGain(&self, pre_gain: c_float);
120
121        /// Blend of the distorted and dry signals
122        /// Range:      0 (all dry) -> 100 (all distorted)
123        /// Default:    50
124        /// Unit:       Percent
125        #[unsafe(method(wetDryMix))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn wetDryMix(&self) -> c_float;
128
129        /// Setter for [`wetDryMix`][Self::wetDryMix].
130        #[unsafe(method(setWetDryMix:))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn setWetDryMix(&self, wet_dry_mix: c_float);
133    );
134}
135
136/// Methods declared on superclass `AVAudioUnitEffect`.
137#[cfg(all(
138    feature = "AVAudioNode",
139    feature = "AVAudioUnit",
140    feature = "AVAudioUnitEffect"
141))]
142impl AVAudioUnitDistortion {
143    extern_methods!(
144        #[cfg(feature = "objc2-audio-toolbox")]
145        #[cfg(not(target_os = "watchos"))]
146        /// Create an AVAudioUnitEffect object.
147        ///
148        ///
149        /// Parameter `audioComponentDescription`: AudioComponentDescription of the audio unit to be instantiated.
150        ///
151        /// The componentType must be one of these types
152        /// kAudioUnitType_Effect
153        /// kAudioUnitType_MusicEffect
154        /// kAudioUnitType_Panner
155        /// kAudioUnitType_RemoteEffect
156        /// kAudioUnitType_RemoteMusicEffect
157        #[unsafe(method(initWithAudioComponentDescription:))]
158        #[unsafe(method_family = init)]
159        pub unsafe fn initWithAudioComponentDescription(
160            this: Allocated<Self>,
161            audio_component_description: AudioComponentDescription,
162        ) -> Retained<Self>;
163    );
164}
165
166/// Methods declared on superclass `NSObject`.
167#[cfg(all(
168    feature = "AVAudioNode",
169    feature = "AVAudioUnit",
170    feature = "AVAudioUnitEffect"
171))]
172impl AVAudioUnitDistortion {
173    extern_methods!(
174        #[unsafe(method(init))]
175        #[unsafe(method_family = init)]
176        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
177
178        #[unsafe(method(new))]
179        #[unsafe(method_family = new)]
180        pub unsafe fn new() -> Retained<Self>;
181    );
182}