gstreamer_controller/auto/
lfo_control_source.rs
1use 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")]
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 #[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
115mod sealed {
116 pub trait Sealed {}
117 impl<T: super::IsA<super::LFOControlSource>> Sealed for T {}
118}
119
120pub trait LFOControlSourceExt: IsA<LFOControlSource> + sealed::Sealed + 'static {
126 fn amplitude(&self) -> f64 {
128 ObjectExt::property(self.as_ref(), "amplitude")
129 }
130
131 fn set_amplitude(&self, amplitude: f64) {
133 ObjectExt::set_property(self.as_ref(), "amplitude", amplitude)
134 }
135
136 fn frequency(&self) -> f64 {
140 ObjectExt::property(self.as_ref(), "frequency")
141 }
142
143 fn set_frequency(&self, frequency: f64) {
147 ObjectExt::set_property(self.as_ref(), "frequency", frequency)
148 }
149
150 fn offset(&self) -> f64 {
152 ObjectExt::property(self.as_ref(), "offset")
153 }
154
155 fn set_offset(&self, offset: f64) {
157 ObjectExt::set_property(self.as_ref(), "offset", offset)
158 }
159
160 fn timeshift(&self) -> u64 {
166 ObjectExt::property(self.as_ref(), "timeshift")
167 }
168
169 fn set_timeshift(&self, timeshift: u64) {
175 ObjectExt::set_property(self.as_ref(), "timeshift", timeshift)
176 }
177
178 fn waveform(&self) -> LFOWaveform {
180 ObjectExt::property(self.as_ref(), "waveform")
181 }
182
183 fn set_waveform(&self, waveform: LFOWaveform) {
185 ObjectExt::set_property(self.as_ref(), "waveform", waveform)
186 }
187
188 #[doc(alias = "amplitude")]
189 fn connect_amplitude_notify<F: Fn(&Self) + Send + Sync + 'static>(
190 &self,
191 f: F,
192 ) -> SignalHandlerId {
193 unsafe extern "C" fn notify_amplitude_trampoline<
194 P: IsA<LFOControlSource>,
195 F: Fn(&P) + Send + Sync + 'static,
196 >(
197 this: *mut ffi::GstLFOControlSource,
198 _param_spec: glib::ffi::gpointer,
199 f: glib::ffi::gpointer,
200 ) {
201 let f: &F = &*(f as *const F);
202 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
203 }
204 unsafe {
205 let f: Box_<F> = Box_::new(f);
206 connect_raw(
207 self.as_ptr() as *mut _,
208 b"notify::amplitude\0".as_ptr() as *const _,
209 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
210 notify_amplitude_trampoline::<Self, F> as *const (),
211 )),
212 Box_::into_raw(f),
213 )
214 }
215 }
216
217 #[doc(alias = "frequency")]
218 fn connect_frequency_notify<F: Fn(&Self) + Send + Sync + 'static>(
219 &self,
220 f: F,
221 ) -> SignalHandlerId {
222 unsafe extern "C" fn notify_frequency_trampoline<
223 P: IsA<LFOControlSource>,
224 F: Fn(&P) + Send + Sync + 'static,
225 >(
226 this: *mut ffi::GstLFOControlSource,
227 _param_spec: glib::ffi::gpointer,
228 f: glib::ffi::gpointer,
229 ) {
230 let f: &F = &*(f as *const F);
231 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
232 }
233 unsafe {
234 let f: Box_<F> = Box_::new(f);
235 connect_raw(
236 self.as_ptr() as *mut _,
237 b"notify::frequency\0".as_ptr() as *const _,
238 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
239 notify_frequency_trampoline::<Self, F> as *const (),
240 )),
241 Box_::into_raw(f),
242 )
243 }
244 }
245
246 #[doc(alias = "offset")]
247 fn connect_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
248 unsafe extern "C" fn notify_offset_trampoline<
249 P: IsA<LFOControlSource>,
250 F: Fn(&P) + Send + Sync + 'static,
251 >(
252 this: *mut ffi::GstLFOControlSource,
253 _param_spec: glib::ffi::gpointer,
254 f: glib::ffi::gpointer,
255 ) {
256 let f: &F = &*(f as *const F);
257 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
258 }
259 unsafe {
260 let f: Box_<F> = Box_::new(f);
261 connect_raw(
262 self.as_ptr() as *mut _,
263 b"notify::offset\0".as_ptr() as *const _,
264 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
265 notify_offset_trampoline::<Self, F> as *const (),
266 )),
267 Box_::into_raw(f),
268 )
269 }
270 }
271
272 #[doc(alias = "timeshift")]
273 fn connect_timeshift_notify<F: Fn(&Self) + Send + Sync + 'static>(
274 &self,
275 f: F,
276 ) -> SignalHandlerId {
277 unsafe extern "C" fn notify_timeshift_trampoline<
278 P: IsA<LFOControlSource>,
279 F: Fn(&P) + Send + Sync + 'static,
280 >(
281 this: *mut ffi::GstLFOControlSource,
282 _param_spec: glib::ffi::gpointer,
283 f: glib::ffi::gpointer,
284 ) {
285 let f: &F = &*(f as *const F);
286 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
287 }
288 unsafe {
289 let f: Box_<F> = Box_::new(f);
290 connect_raw(
291 self.as_ptr() as *mut _,
292 b"notify::timeshift\0".as_ptr() as *const _,
293 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
294 notify_timeshift_trampoline::<Self, F> as *const (),
295 )),
296 Box_::into_raw(f),
297 )
298 }
299 }
300
301 #[doc(alias = "waveform")]
302 fn connect_waveform_notify<F: Fn(&Self) + Send + Sync + 'static>(
303 &self,
304 f: F,
305 ) -> SignalHandlerId {
306 unsafe extern "C" fn notify_waveform_trampoline<
307 P: IsA<LFOControlSource>,
308 F: Fn(&P) + Send + Sync + 'static,
309 >(
310 this: *mut ffi::GstLFOControlSource,
311 _param_spec: glib::ffi::gpointer,
312 f: glib::ffi::gpointer,
313 ) {
314 let f: &F = &*(f as *const F);
315 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
316 }
317 unsafe {
318 let f: Box_<F> = Box_::new(f);
319 connect_raw(
320 self.as_ptr() as *mut _,
321 b"notify::waveform\0".as_ptr() as *const _,
322 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
323 notify_waveform_trampoline::<Self, F> as *const (),
324 )),
325 Box_::into_raw(f),
326 )
327 }
328 }
329}
330
331impl<O: IsA<LFOControlSource>> LFOControlSourceExt for O {}