objc2_avf_audio/generated/
AVAudioUnitVarispeed.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 can be used to control the playback rate
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitvarispeed?language=objc)
16    #[unsafe(super(AVAudioUnitTimeEffect, AVAudioUnit, AVAudioNode, NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    #[cfg(all(
19        feature = "AVAudioNode",
20        feature = "AVAudioUnit",
21        feature = "AVAudioUnitTimeEffect"
22    ))]
23    pub struct AVAudioUnitVarispeed;
24);
25
26#[cfg(all(
27    feature = "AVAudioNode",
28    feature = "AVAudioUnit",
29    feature = "AVAudioUnitTimeEffect"
30))]
31unsafe impl NSObjectProtocol for AVAudioUnitVarispeed {}
32
33#[cfg(all(
34    feature = "AVAudioNode",
35    feature = "AVAudioUnit",
36    feature = "AVAudioUnitTimeEffect"
37))]
38impl AVAudioUnitVarispeed {
39    extern_methods!(
40        /// controls the playback rate of the audio signal
41        ///
42        /// Since this unit resamples the input signal, changing the playback rate also changes the pitch.
43        ///
44        /// i.e. changing the rate to 2.0 results in the output audio playing one octave higher.
45        /// Similarly changing the rate to 0.5, results in the output audio playing one octave lower.
46        ///
47        /// The playback rate and pitch can be calculated as
48        /// rate  = pow(2, cents/1200.0)
49        /// pitch in cents  = 1200.0 * log2(rate)
50        ///
51        /// Where,    1 octave  = 1200 cents
52        /// 1 musical semitone  = 100 cents
53        ///
54        /// Range:      0.25 -> 4.0
55        /// Default:    1.0
56        /// Unit:       Generic
57        #[unsafe(method(rate))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn rate(&self) -> c_float;
60
61        /// Setter for [`rate`][Self::rate].
62        #[unsafe(method(setRate:))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn setRate(&self, rate: c_float);
65    );
66}
67
68/// Methods declared on superclass `AVAudioUnitTimeEffect`.
69#[cfg(all(
70    feature = "AVAudioNode",
71    feature = "AVAudioUnit",
72    feature = "AVAudioUnitTimeEffect"
73))]
74impl AVAudioUnitVarispeed {
75    extern_methods!(
76        #[cfg(feature = "objc2-audio-toolbox")]
77        #[cfg(not(target_os = "watchos"))]
78        /// create an AVAudioUnitTimeEffect object
79        ///
80        ///
81        /// Parameter `audioComponentDescription`: AudioComponentDescription of the audio unit to be initialized
82        ///
83        /// The componentType must be kAudioUnitType_FormatConverter
84        #[unsafe(method(initWithAudioComponentDescription:))]
85        #[unsafe(method_family = init)]
86        pub unsafe fn initWithAudioComponentDescription(
87            this: Allocated<Self>,
88            audio_component_description: AudioComponentDescription,
89        ) -> Retained<Self>;
90    );
91}
92
93/// Methods declared on superclass `NSObject`.
94#[cfg(all(
95    feature = "AVAudioNode",
96    feature = "AVAudioUnit",
97    feature = "AVAudioUnitTimeEffect"
98))]
99impl AVAudioUnitVarispeed {
100    extern_methods!(
101        #[unsafe(method(init))]
102        #[unsafe(method_family = init)]
103        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
104
105        #[unsafe(method(new))]
106        #[unsafe(method_family = new)]
107        pub unsafe fn new() -> Retained<Self>;
108    );
109}