gstreamer_controller/auto/
lfo_control_source.rs1use crate::{ffi, LFOWaveform};
7use glib::{
8 prelude::*,
9 signal::{connect_raw, SignalHandlerId},
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
44mod sealed {
45 pub trait Sealed {}
46 impl<T: super::IsA<super::LFOControlSource>> Sealed for T {}
47}
48
49pub trait LFOControlSourceExt: IsA<LFOControlSource> + sealed::Sealed + 'static {
50 fn amplitude(&self) -> f64 {
51 ObjectExt::property(self.as_ref(), "amplitude")
52 }
53
54 fn set_amplitude(&self, amplitude: f64) {
55 ObjectExt::set_property(self.as_ref(), "amplitude", amplitude)
56 }
57
58 fn frequency(&self) -> f64 {
59 ObjectExt::property(self.as_ref(), "frequency")
60 }
61
62 fn set_frequency(&self, frequency: f64) {
63 ObjectExt::set_property(self.as_ref(), "frequency", frequency)
64 }
65
66 fn offset(&self) -> f64 {
67 ObjectExt::property(self.as_ref(), "offset")
68 }
69
70 fn set_offset(&self, offset: f64) {
71 ObjectExt::set_property(self.as_ref(), "offset", offset)
72 }
73
74 fn timeshift(&self) -> u64 {
75 ObjectExt::property(self.as_ref(), "timeshift")
76 }
77
78 fn set_timeshift(&self, timeshift: u64) {
79 ObjectExt::set_property(self.as_ref(), "timeshift", timeshift)
80 }
81
82 fn waveform(&self) -> LFOWaveform {
83 ObjectExt::property(self.as_ref(), "waveform")
84 }
85
86 fn set_waveform(&self, waveform: LFOWaveform) {
87 ObjectExt::set_property(self.as_ref(), "waveform", waveform)
88 }
89
90 #[doc(alias = "amplitude")]
91 fn connect_amplitude_notify<F: Fn(&Self) + Send + Sync + 'static>(
92 &self,
93 f: F,
94 ) -> SignalHandlerId {
95 unsafe extern "C" fn notify_amplitude_trampoline<
96 P: IsA<LFOControlSource>,
97 F: Fn(&P) + Send + Sync + 'static,
98 >(
99 this: *mut ffi::GstLFOControlSource,
100 _param_spec: glib::ffi::gpointer,
101 f: glib::ffi::gpointer,
102 ) {
103 let f: &F = &*(f as *const F);
104 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
105 }
106 unsafe {
107 let f: Box_<F> = Box_::new(f);
108 connect_raw(
109 self.as_ptr() as *mut _,
110 b"notify::amplitude\0".as_ptr() as *const _,
111 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
112 notify_amplitude_trampoline::<Self, F> as *const (),
113 )),
114 Box_::into_raw(f),
115 )
116 }
117 }
118
119 #[doc(alias = "frequency")]
120 fn connect_frequency_notify<F: Fn(&Self) + Send + Sync + 'static>(
121 &self,
122 f: F,
123 ) -> SignalHandlerId {
124 unsafe extern "C" fn notify_frequency_trampoline<
125 P: IsA<LFOControlSource>,
126 F: Fn(&P) + Send + Sync + 'static,
127 >(
128 this: *mut ffi::GstLFOControlSource,
129 _param_spec: glib::ffi::gpointer,
130 f: glib::ffi::gpointer,
131 ) {
132 let f: &F = &*(f as *const F);
133 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
134 }
135 unsafe {
136 let f: Box_<F> = Box_::new(f);
137 connect_raw(
138 self.as_ptr() as *mut _,
139 b"notify::frequency\0".as_ptr() as *const _,
140 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
141 notify_frequency_trampoline::<Self, F> as *const (),
142 )),
143 Box_::into_raw(f),
144 )
145 }
146 }
147
148 #[doc(alias = "offset")]
149 fn connect_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
150 unsafe extern "C" fn notify_offset_trampoline<
151 P: IsA<LFOControlSource>,
152 F: Fn(&P) + Send + Sync + 'static,
153 >(
154 this: *mut ffi::GstLFOControlSource,
155 _param_spec: glib::ffi::gpointer,
156 f: glib::ffi::gpointer,
157 ) {
158 let f: &F = &*(f as *const F);
159 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
160 }
161 unsafe {
162 let f: Box_<F> = Box_::new(f);
163 connect_raw(
164 self.as_ptr() as *mut _,
165 b"notify::offset\0".as_ptr() as *const _,
166 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
167 notify_offset_trampoline::<Self, F> as *const (),
168 )),
169 Box_::into_raw(f),
170 )
171 }
172 }
173
174 #[doc(alias = "timeshift")]
175 fn connect_timeshift_notify<F: Fn(&Self) + Send + Sync + 'static>(
176 &self,
177 f: F,
178 ) -> SignalHandlerId {
179 unsafe extern "C" fn notify_timeshift_trampoline<
180 P: IsA<LFOControlSource>,
181 F: Fn(&P) + Send + Sync + 'static,
182 >(
183 this: *mut ffi::GstLFOControlSource,
184 _param_spec: glib::ffi::gpointer,
185 f: glib::ffi::gpointer,
186 ) {
187 let f: &F = &*(f as *const F);
188 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
189 }
190 unsafe {
191 let f: Box_<F> = Box_::new(f);
192 connect_raw(
193 self.as_ptr() as *mut _,
194 b"notify::timeshift\0".as_ptr() as *const _,
195 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
196 notify_timeshift_trampoline::<Self, F> as *const (),
197 )),
198 Box_::into_raw(f),
199 )
200 }
201 }
202
203 #[doc(alias = "waveform")]
204 fn connect_waveform_notify<F: Fn(&Self) + Send + Sync + 'static>(
205 &self,
206 f: F,
207 ) -> SignalHandlerId {
208 unsafe extern "C" fn notify_waveform_trampoline<
209 P: IsA<LFOControlSource>,
210 F: Fn(&P) + Send + Sync + 'static,
211 >(
212 this: *mut ffi::GstLFOControlSource,
213 _param_spec: glib::ffi::gpointer,
214 f: glib::ffi::gpointer,
215 ) {
216 let f: &F = &*(f as *const F);
217 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
218 }
219 unsafe {
220 let f: Box_<F> = Box_::new(f);
221 connect_raw(
222 self.as_ptr() as *mut _,
223 b"notify::waveform\0".as_ptr() as *const _,
224 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
225 notify_waveform_trampoline::<Self, F> as *const (),
226 )),
227 Box_::into_raw(f),
228 )
229 }
230 }
231}
232
233impl<O: IsA<LFOControlSource>> LFOControlSourceExt for O {}