objc2_avf_audio/generated/
AVAudioUnitTimePitch.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
12extern_class!(
13    /// an AVAudioUnitTimeEffect that provides good quality time stretching and pitch shifting
14    ///
15    /// In this time effect, the playback rate and pitch parameters function independently of each other
16    ///
17    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounittimepitch?language=objc)
18    #[unsafe(super(AVAudioUnitTimeEffect, AVAudioUnit, AVAudioNode, NSObject))]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    #[cfg(all(
21        feature = "AVAudioNode",
22        feature = "AVAudioUnit",
23        feature = "AVAudioUnitTimeEffect"
24    ))]
25    pub struct AVAudioUnitTimePitch;
26);
27
28#[cfg(all(
29    feature = "AVAudioNode",
30    feature = "AVAudioUnit",
31    feature = "AVAudioUnitTimeEffect"
32))]
33unsafe impl NSObjectProtocol for AVAudioUnitTimePitch {}
34
35#[cfg(all(
36    feature = "AVAudioNode",
37    feature = "AVAudioUnit",
38    feature = "AVAudioUnitTimeEffect"
39))]
40impl AVAudioUnitTimePitch {
41    extern_methods!(
42        /// playback rate of the input signal
43        ///
44        /// Range:      1/32 -> 32.0
45        /// Default:    1.0
46        /// Unit:       Generic
47        #[unsafe(method(rate))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn rate(&self) -> c_float;
50
51        /// Setter for [`rate`][Self::rate].
52        #[unsafe(method(setRate:))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn setRate(&self, rate: c_float);
55
56        /// amount by which the input signal is pitch shifted
57        ///
58        /// 1 octave  = 1200 cents
59        /// 1 musical semitone  = 100 cents
60        ///
61        /// Range:      -2400 -> 2400
62        /// Default:    0.0
63        /// Unit:       Cents
64        #[unsafe(method(pitch))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn pitch(&self) -> c_float;
67
68        /// Setter for [`pitch`][Self::pitch].
69        #[unsafe(method(setPitch:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn setPitch(&self, pitch: c_float);
72
73        /// amount of overlap between segments of the input audio signal
74        ///
75        /// A higher value results in fewer artifacts in the output signal.
76        /// This parameter also impacts the amount of CPU used.
77        ///
78        /// Range:      3.0 -> 32.0
79        /// Default:    8.0
80        /// Unit:       Generic
81        #[unsafe(method(overlap))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn overlap(&self) -> c_float;
84
85        /// Setter for [`overlap`][Self::overlap].
86        #[unsafe(method(setOverlap:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn setOverlap(&self, overlap: c_float);
89    );
90}
91
92/// Methods declared on superclass `AVAudioUnitTimeEffect`.
93#[cfg(all(
94    feature = "AVAudioNode",
95    feature = "AVAudioUnit",
96    feature = "AVAudioUnitTimeEffect"
97))]
98impl AVAudioUnitTimePitch {
99    extern_methods!(
100        #[cfg(feature = "objc2-audio-toolbox")]
101        #[cfg(not(target_os = "watchos"))]
102        /// create an AVAudioUnitTimeEffect object
103        ///
104        ///
105        /// Parameter `audioComponentDescription`: AudioComponentDescription of the audio unit to be initialized
106        ///
107        /// The componentType must be kAudioUnitType_FormatConverter
108        #[unsafe(method(initWithAudioComponentDescription:))]
109        #[unsafe(method_family = init)]
110        pub unsafe fn initWithAudioComponentDescription(
111            this: Allocated<Self>,
112            audio_component_description: AudioComponentDescription,
113        ) -> Retained<Self>;
114    );
115}
116
117/// Methods declared on superclass `NSObject`.
118#[cfg(all(
119    feature = "AVAudioNode",
120    feature = "AVAudioUnit",
121    feature = "AVAudioUnitTimeEffect"
122))]
123impl AVAudioUnitTimePitch {
124    extern_methods!(
125        #[unsafe(method(init))]
126        #[unsafe(method_family = init)]
127        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
128
129        #[unsafe(method(new))]
130        #[unsafe(method_family = new)]
131        pub unsafe fn new() -> Retained<Self>;
132    );
133}