Skip to main content

gstreamer_controller/auto/
lfo_control_source.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{LFOWaveform, ffi};
7use glib::{
8    prelude::*,
9    signal::{SignalHandlerId, connect_raw},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// [`LFOControlSource`][crate::LFOControlSource] is a [`gst::ControlSource`][crate::gst::ControlSource], that provides several periodic
16    /// waveforms as control values.
17    ///
18    /// To use [`LFOControlSource`][crate::LFOControlSource] get a new instance by calling
19    /// [`new()`][Self::new()], bind it to a `GParamSpec` and set the relevant
20    /// properties.
21    ///
22    /// All functions are MT-safe.
23    ///
24    /// ## Properties
25    ///
26    ///
27    /// #### `amplitude`
28    ///  Specifies the amplitude for the waveform of this [`LFOControlSource`][crate::LFOControlSource].
29    ///
30    /// Readable | Writeable
31    ///
32    ///
33    /// #### `frequency`
34    ///  Specifies the frequency that should be used for the waveform
35    /// of this [`LFOControlSource`][crate::LFOControlSource]. It should be large enough
36    /// so that the period is longer than one nanosecond.
37    ///
38    /// Readable | Writeable
39    ///
40    ///
41    /// #### `offset`
42    ///  Specifies the value offset for the waveform of this [`LFOControlSource`][crate::LFOControlSource].
43    ///
44    /// Readable | Writeable
45    ///
46    ///
47    /// #### `timeshift`
48    ///  Specifies the timeshift to the right that should be used for the waveform
49    /// of this [`LFOControlSource`][crate::LFOControlSource] in nanoseconds.
50    ///
51    /// To get a n nanosecond shift to the left use
52    /// "(GST_SECOND / frequency) - n".
53    ///
54    /// Readable | Writeable
55    ///
56    ///
57    /// #### `waveform`
58    ///  Specifies the waveform that should be used for this [`LFOControlSource`][crate::LFOControlSource].
59    ///
60    /// Readable | Writeable
61    /// <details><summary><h4>Object</h4></summary>
62    ///
63    ///
64    /// #### `name`
65    ///  Readable | Writeable | Construct
66    ///
67    ///
68    /// #### `parent`
69    ///  The parent of the object. Please note, that when changing the 'parent'
70    /// property, we don't emit `GObject::notify` and [`deep-notify`][struct@crate::gst::Object#deep-notify]
71    /// signals due to locking issues. In some cases one can use
72    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
73    /// achieve a similar effect.
74    ///
75    /// Readable | Writeable
76    /// </details>
77    ///
78    /// # Implements
79    ///
80    /// [`LFOControlSourceExt`][trait@crate::prelude::LFOControlSourceExt], [`trait@gst::prelude::ControlSourceExt`], [`trait@gst::prelude::ObjectExt`]
81    #[doc(alias = "GstLFOControlSource")]
82    pub struct LFOControlSource(Object<ffi::GstLFOControlSource, ffi::GstLFOControlSourceClass>) @extends gst::ControlSource, gst::Object;
83
84    match fn {
85        type_ => || ffi::gst_lfo_control_source_get_type(),
86    }
87}
88
89impl LFOControlSource {
90    pub const NONE: Option<&'static LFOControlSource> = None;
91
92    /// This returns a new, unbound [`LFOControlSource`][crate::LFOControlSource].
93    ///
94    /// # Returns
95    ///
96    /// a new, unbound [`LFOControlSource`][crate::LFOControlSource].
97    #[doc(alias = "gst_lfo_control_source_new")]
98    pub fn new() -> LFOControlSource {
99        assert_initialized_main_thread!();
100        unsafe {
101            gst::ControlSource::from_glib_full(ffi::gst_lfo_control_source_new()).unsafe_cast()
102        }
103    }
104}
105
106impl Default for LFOControlSource {
107    fn default() -> Self {
108        Self::new()
109    }
110}
111
112unsafe impl Send for LFOControlSource {}
113unsafe impl Sync for LFOControlSource {}
114
115/// Trait containing all [`struct@LFOControlSource`] methods.
116///
117/// # Implementors
118///
119/// [`LFOControlSource`][struct@crate::LFOControlSource]
120pub trait LFOControlSourceExt: IsA<LFOControlSource> + 'static {
121    /// Specifies the amplitude for the waveform of this [`LFOControlSource`][crate::LFOControlSource].
122    fn amplitude(&self) -> f64 {
123        ObjectExt::property(self.as_ref(), "amplitude")
124    }
125
126    /// Specifies the amplitude for the waveform of this [`LFOControlSource`][crate::LFOControlSource].
127    fn set_amplitude(&self, amplitude: f64) {
128        ObjectExt::set_property(self.as_ref(), "amplitude", amplitude)
129    }
130
131    /// Specifies the frequency that should be used for the waveform
132    /// of this [`LFOControlSource`][crate::LFOControlSource]. It should be large enough
133    /// so that the period is longer than one nanosecond.
134    fn frequency(&self) -> f64 {
135        ObjectExt::property(self.as_ref(), "frequency")
136    }
137
138    /// Specifies the frequency that should be used for the waveform
139    /// of this [`LFOControlSource`][crate::LFOControlSource]. It should be large enough
140    /// so that the period is longer than one nanosecond.
141    fn set_frequency(&self, frequency: f64) {
142        ObjectExt::set_property(self.as_ref(), "frequency", frequency)
143    }
144
145    /// Specifies the value offset for the waveform of this [`LFOControlSource`][crate::LFOControlSource].
146    fn offset(&self) -> f64 {
147        ObjectExt::property(self.as_ref(), "offset")
148    }
149
150    /// Specifies the value offset for the waveform of this [`LFOControlSource`][crate::LFOControlSource].
151    fn set_offset(&self, offset: f64) {
152        ObjectExt::set_property(self.as_ref(), "offset", offset)
153    }
154
155    /// Specifies the timeshift to the right that should be used for the waveform
156    /// of this [`LFOControlSource`][crate::LFOControlSource] in nanoseconds.
157    ///
158    /// To get a n nanosecond shift to the left use
159    /// "(GST_SECOND / frequency) - n".
160    fn timeshift(&self) -> u64 {
161        ObjectExt::property(self.as_ref(), "timeshift")
162    }
163
164    /// Specifies the timeshift to the right that should be used for the waveform
165    /// of this [`LFOControlSource`][crate::LFOControlSource] in nanoseconds.
166    ///
167    /// To get a n nanosecond shift to the left use
168    /// "(GST_SECOND / frequency) - n".
169    fn set_timeshift(&self, timeshift: u64) {
170        ObjectExt::set_property(self.as_ref(), "timeshift", timeshift)
171    }
172
173    /// Specifies the waveform that should be used for this [`LFOControlSource`][crate::LFOControlSource].
174    fn waveform(&self) -> LFOWaveform {
175        ObjectExt::property(self.as_ref(), "waveform")
176    }
177
178    /// Specifies the waveform that should be used for this [`LFOControlSource`][crate::LFOControlSource].
179    fn set_waveform(&self, waveform: LFOWaveform) {
180        ObjectExt::set_property(self.as_ref(), "waveform", waveform)
181    }
182
183    #[doc(alias = "amplitude")]
184    fn connect_amplitude_notify<F: Fn(&Self) + Send + Sync + 'static>(
185        &self,
186        f: F,
187    ) -> SignalHandlerId {
188        unsafe extern "C" fn notify_amplitude_trampoline<
189            P: IsA<LFOControlSource>,
190            F: Fn(&P) + Send + Sync + 'static,
191        >(
192            this: *mut ffi::GstLFOControlSource,
193            _param_spec: glib::ffi::gpointer,
194            f: glib::ffi::gpointer,
195        ) {
196            unsafe {
197                let f: &F = &*(f as *const F);
198                f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
199            }
200        }
201        unsafe {
202            let f: Box_<F> = Box_::new(f);
203            connect_raw(
204                self.as_ptr() as *mut _,
205                c"notify::amplitude".as_ptr(),
206                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
207                    notify_amplitude_trampoline::<Self, F> as *const (),
208                )),
209                Box_::into_raw(f),
210            )
211        }
212    }
213
214    #[doc(alias = "frequency")]
215    fn connect_frequency_notify<F: Fn(&Self) + Send + Sync + 'static>(
216        &self,
217        f: F,
218    ) -> SignalHandlerId {
219        unsafe extern "C" fn notify_frequency_trampoline<
220            P: IsA<LFOControlSource>,
221            F: Fn(&P) + Send + Sync + 'static,
222        >(
223            this: *mut ffi::GstLFOControlSource,
224            _param_spec: glib::ffi::gpointer,
225            f: glib::ffi::gpointer,
226        ) {
227            unsafe {
228                let f: &F = &*(f as *const F);
229                f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
230            }
231        }
232        unsafe {
233            let f: Box_<F> = Box_::new(f);
234            connect_raw(
235                self.as_ptr() as *mut _,
236                c"notify::frequency".as_ptr(),
237                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
238                    notify_frequency_trampoline::<Self, F> as *const (),
239                )),
240                Box_::into_raw(f),
241            )
242        }
243    }
244
245    #[doc(alias = "offset")]
246    fn connect_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
247        unsafe extern "C" fn notify_offset_trampoline<
248            P: IsA<LFOControlSource>,
249            F: Fn(&P) + Send + Sync + 'static,
250        >(
251            this: *mut ffi::GstLFOControlSource,
252            _param_spec: glib::ffi::gpointer,
253            f: glib::ffi::gpointer,
254        ) {
255            unsafe {
256                let f: &F = &*(f as *const F);
257                f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
258            }
259        }
260        unsafe {
261            let f: Box_<F> = Box_::new(f);
262            connect_raw(
263                self.as_ptr() as *mut _,
264                c"notify::offset".as_ptr(),
265                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
266                    notify_offset_trampoline::<Self, F> as *const (),
267                )),
268                Box_::into_raw(f),
269            )
270        }
271    }
272
273    #[doc(alias = "timeshift")]
274    fn connect_timeshift_notify<F: Fn(&Self) + Send + Sync + 'static>(
275        &self,
276        f: F,
277    ) -> SignalHandlerId {
278        unsafe extern "C" fn notify_timeshift_trampoline<
279            P: IsA<LFOControlSource>,
280            F: Fn(&P) + Send + Sync + 'static,
281        >(
282            this: *mut ffi::GstLFOControlSource,
283            _param_spec: glib::ffi::gpointer,
284            f: glib::ffi::gpointer,
285        ) {
286            unsafe {
287                let f: &F = &*(f as *const F);
288                f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
289            }
290        }
291        unsafe {
292            let f: Box_<F> = Box_::new(f);
293            connect_raw(
294                self.as_ptr() as *mut _,
295                c"notify::timeshift".as_ptr(),
296                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
297                    notify_timeshift_trampoline::<Self, F> as *const (),
298                )),
299                Box_::into_raw(f),
300            )
301        }
302    }
303
304    #[doc(alias = "waveform")]
305    fn connect_waveform_notify<F: Fn(&Self) + Send + Sync + 'static>(
306        &self,
307        f: F,
308    ) -> SignalHandlerId {
309        unsafe extern "C" fn notify_waveform_trampoline<
310            P: IsA<LFOControlSource>,
311            F: Fn(&P) + Send + Sync + 'static,
312        >(
313            this: *mut ffi::GstLFOControlSource,
314            _param_spec: glib::ffi::gpointer,
315            f: glib::ffi::gpointer,
316        ) {
317            unsafe {
318                let f: &F = &*(f as *const F);
319                f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
320            }
321        }
322        unsafe {
323            let f: Box_<F> = Box_::new(f);
324            connect_raw(
325                self.as_ptr() as *mut _,
326                c"notify::waveform".as_ptr(),
327                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
328                    notify_waveform_trampoline::<Self, F> as *const (),
329                )),
330                Box_::into_raw(f),
331            )
332        }
333    }
334}
335
336impl<O: IsA<LFOControlSource>> LFOControlSourceExt for O {}