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