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))]
91unsafe impl NSObjectProtocol for AVAudioUnitDistortion {}
92
93#[cfg(all(
94    feature = "AVAudioNode",
95    feature = "AVAudioUnit",
96    feature = "AVAudioUnitEffect"
97))]
98impl AVAudioUnitDistortion {
99    extern_methods!(
100        /// Load a distortion preset.
101        /// Default:    AVAudioUnitDistortionPresetDrumsBitBrush
102        #[unsafe(method(loadFactoryPreset:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn loadFactoryPreset(&self, preset: AVAudioUnitDistortionPreset);
105
106        /// Gain applied to the signal before being distorted
107        /// Range:      -80 -> 20
108        /// Default:    -6
109        /// Unit:       dB
110        #[unsafe(method(preGain))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn preGain(&self) -> c_float;
113
114        /// Setter for [`preGain`][Self::preGain].
115        #[unsafe(method(setPreGain:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn setPreGain(&self, pre_gain: c_float);
118
119        /// Blend of the distorted and dry signals
120        /// Range:      0 (all dry) -> 100 (all distorted)
121        /// Default:    50
122        /// Unit:       Percent
123        #[unsafe(method(wetDryMix))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn wetDryMix(&self) -> c_float;
126
127        /// Setter for [`wetDryMix`][Self::wetDryMix].
128        #[unsafe(method(setWetDryMix:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn setWetDryMix(&self, wet_dry_mix: c_float);
131    );
132}
133
134/// Methods declared on superclass `AVAudioUnitEffect`.
135#[cfg(all(
136    feature = "AVAudioNode",
137    feature = "AVAudioUnit",
138    feature = "AVAudioUnitEffect"
139))]
140impl AVAudioUnitDistortion {
141    extern_methods!(
142        #[cfg(feature = "objc2-audio-toolbox")]
143        #[cfg(not(target_os = "watchos"))]
144        /// Create an AVAudioUnitEffect object.
145        ///
146        ///
147        /// Parameter `audioComponentDescription`: AudioComponentDescription of the audio unit to be instantiated.
148        ///
149        /// The componentType must be one of these types
150        /// kAudioUnitType_Effect
151        /// kAudioUnitType_MusicEffect
152        /// kAudioUnitType_Panner
153        /// kAudioUnitType_RemoteEffect
154        /// kAudioUnitType_RemoteMusicEffect
155        #[unsafe(method(initWithAudioComponentDescription:))]
156        #[unsafe(method_family = init)]
157        pub unsafe fn initWithAudioComponentDescription(
158            this: Allocated<Self>,
159            audio_component_description: AudioComponentDescription,
160        ) -> Retained<Self>;
161    );
162}
163
164/// Methods declared on superclass `NSObject`.
165#[cfg(all(
166    feature = "AVAudioNode",
167    feature = "AVAudioUnit",
168    feature = "AVAudioUnitEffect"
169))]
170impl AVAudioUnitDistortion {
171    extern_methods!(
172        #[unsafe(method(init))]
173        #[unsafe(method_family = init)]
174        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
175
176        #[unsafe(method(new))]
177        #[unsafe(method_family = new)]
178        pub unsafe fn new() -> Retained<Self>;
179    );
180}