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    #[doc(alias = "GstLFOControlSource")]
16    pub struct LFOControlSource(Object<ffi::GstLFOControlSource, ffi::GstLFOControlSourceClass>) @extends gst::ControlSource, gst::Object;
17
18    match fn {
19        type_ => || ffi::gst_lfo_control_source_get_type(),
20    }
21}
22
23impl LFOControlSource {
24    pub const NONE: Option<&'static LFOControlSource> = None;
25
26    #[doc(alias = "gst_lfo_control_source_new")]
27    pub fn new() -> LFOControlSource {
28        assert_initialized_main_thread!();
29        unsafe {
30            gst::ControlSource::from_glib_full(ffi::gst_lfo_control_source_new()).unsafe_cast()
31        }
32    }
33}
34
35impl Default for LFOControlSource {
36    fn default() -> Self {
37        Self::new()
38    }
39}
40
41unsafe impl Send for LFOControlSource {}
42unsafe impl Sync for LFOControlSource {}
43
44pub trait LFOControlSourceExt: IsA<LFOControlSource> + 'static {
45    fn amplitude(&self) -> f64 {
46        ObjectExt::property(self.as_ref(), "amplitude")
47    }
48
49    fn set_amplitude(&self, amplitude: f64) {
50        ObjectExt::set_property(self.as_ref(), "amplitude", amplitude)
51    }
52
53    fn frequency(&self) -> f64 {
54        ObjectExt::property(self.as_ref(), "frequency")
55    }
56
57    fn set_frequency(&self, frequency: f64) {
58        ObjectExt::set_property(self.as_ref(), "frequency", frequency)
59    }
60
61    fn offset(&self) -> f64 {
62        ObjectExt::property(self.as_ref(), "offset")
63    }
64
65    fn set_offset(&self, offset: f64) {
66        ObjectExt::set_property(self.as_ref(), "offset", offset)
67    }
68
69    fn timeshift(&self) -> u64 {
70        ObjectExt::property(self.as_ref(), "timeshift")
71    }
72
73    fn set_timeshift(&self, timeshift: u64) {
74        ObjectExt::set_property(self.as_ref(), "timeshift", timeshift)
75    }
76
77    fn waveform(&self) -> LFOWaveform {
78        ObjectExt::property(self.as_ref(), "waveform")
79    }
80
81    fn set_waveform(&self, waveform: LFOWaveform) {
82        ObjectExt::set_property(self.as_ref(), "waveform", waveform)
83    }
84
85    #[doc(alias = "amplitude")]
86    fn connect_amplitude_notify<F: Fn(&Self) + Send + Sync + 'static>(
87        &self,
88        f: F,
89    ) -> SignalHandlerId {
90        unsafe extern "C" fn notify_amplitude_trampoline<
91            P: IsA<LFOControlSource>,
92            F: Fn(&P) + Send + Sync + 'static,
93        >(
94            this: *mut ffi::GstLFOControlSource,
95            _param_spec: glib::ffi::gpointer,
96            f: glib::ffi::gpointer,
97        ) {
98            unsafe {
99                let f: &F = &*(f as *const F);
100                f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
101            }
102        }
103        unsafe {
104            let f: Box_<F> = Box_::new(f);
105            connect_raw(
106                self.as_ptr() as *mut _,
107                c"notify::amplitude".as_ptr() as *const _,
108                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
109                    notify_amplitude_trampoline::<Self, F> as *const (),
110                )),
111                Box_::into_raw(f),
112            )
113        }
114    }
115
116    #[doc(alias = "frequency")]
117    fn connect_frequency_notify<F: Fn(&Self) + Send + Sync + 'static>(
118        &self,
119        f: F,
120    ) -> SignalHandlerId {
121        unsafe extern "C" fn notify_frequency_trampoline<
122            P: IsA<LFOControlSource>,
123            F: Fn(&P) + Send + Sync + 'static,
124        >(
125            this: *mut ffi::GstLFOControlSource,
126            _param_spec: glib::ffi::gpointer,
127            f: glib::ffi::gpointer,
128        ) {
129            unsafe {
130                let f: &F = &*(f as *const F);
131                f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
132            }
133        }
134        unsafe {
135            let f: Box_<F> = Box_::new(f);
136            connect_raw(
137                self.as_ptr() as *mut _,
138                c"notify::frequency".as_ptr() as *const _,
139                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
140                    notify_frequency_trampoline::<Self, F> as *const (),
141                )),
142                Box_::into_raw(f),
143            )
144        }
145    }
146
147    #[doc(alias = "offset")]
148    fn connect_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
149        unsafe extern "C" fn notify_offset_trampoline<
150            P: IsA<LFOControlSource>,
151            F: Fn(&P) + Send + Sync + 'static,
152        >(
153            this: *mut ffi::GstLFOControlSource,
154            _param_spec: glib::ffi::gpointer,
155            f: glib::ffi::gpointer,
156        ) {
157            unsafe {
158                let f: &F = &*(f as *const F);
159                f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
160            }
161        }
162        unsafe {
163            let f: Box_<F> = Box_::new(f);
164            connect_raw(
165                self.as_ptr() as *mut _,
166                c"notify::offset".as_ptr() as *const _,
167                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
168                    notify_offset_trampoline::<Self, F> as *const (),
169                )),
170                Box_::into_raw(f),
171            )
172        }
173    }
174
175    #[doc(alias = "timeshift")]
176    fn connect_timeshift_notify<F: Fn(&Self) + Send + Sync + 'static>(
177        &self,
178        f: F,
179    ) -> SignalHandlerId {
180        unsafe extern "C" fn notify_timeshift_trampoline<
181            P: IsA<LFOControlSource>,
182            F: Fn(&P) + Send + Sync + 'static,
183        >(
184            this: *mut ffi::GstLFOControlSource,
185            _param_spec: glib::ffi::gpointer,
186            f: glib::ffi::gpointer,
187        ) {
188            unsafe {
189                let f: &F = &*(f as *const F);
190                f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
191            }
192        }
193        unsafe {
194            let f: Box_<F> = Box_::new(f);
195            connect_raw(
196                self.as_ptr() as *mut _,
197                c"notify::timeshift".as_ptr() as *const _,
198                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
199                    notify_timeshift_trampoline::<Self, F> as *const (),
200                )),
201                Box_::into_raw(f),
202            )
203        }
204    }
205
206    #[doc(alias = "waveform")]
207    fn connect_waveform_notify<F: Fn(&Self) + Send + Sync + 'static>(
208        &self,
209        f: F,
210    ) -> SignalHandlerId {
211        unsafe extern "C" fn notify_waveform_trampoline<
212            P: IsA<LFOControlSource>,
213            F: Fn(&P) + Send + Sync + 'static,
214        >(
215            this: *mut ffi::GstLFOControlSource,
216            _param_spec: glib::ffi::gpointer,
217            f: glib::ffi::gpointer,
218        ) {
219            unsafe {
220                let f: &F = &*(f as *const F);
221                f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
222            }
223        }
224        unsafe {
225            let f: Box_<F> = Box_::new(f);
226            connect_raw(
227                self.as_ptr() as *mut _,
228                c"notify::waveform".as_ptr() as *const _,
229                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
230                    notify_waveform_trampoline::<Self, F> as *const (),
231                )),
232                Box_::into_raw(f),
233            )
234        }
235    }
236}
237
238impl<O: IsA<LFOControlSource>> LFOControlSourceExt for O {}