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
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 let f: &F = &*(f as *const F);
99 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
100 }
101 unsafe {
102 let f: Box_<F> = Box_::new(f);
103 connect_raw(
104 self.as_ptr() as *mut _,
105 c"notify::amplitude".as_ptr() as *const _,
106 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
107 notify_amplitude_trampoline::<Self, F> as *const (),
108 )),
109 Box_::into_raw(f),
110 )
111 }
112 }
113
114 #[doc(alias = "frequency")]
115 fn connect_frequency_notify<F: Fn(&Self) + Send + Sync + 'static>(
116 &self,
117 f: F,
118 ) -> SignalHandlerId {
119 unsafe extern "C" fn notify_frequency_trampoline<
120 P: IsA<LFOControlSource>,
121 F: Fn(&P) + Send + Sync + 'static,
122 >(
123 this: *mut ffi::GstLFOControlSource,
124 _param_spec: glib::ffi::gpointer,
125 f: glib::ffi::gpointer,
126 ) {
127 let f: &F = &*(f as *const F);
128 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
129 }
130 unsafe {
131 let f: Box_<F> = Box_::new(f);
132 connect_raw(
133 self.as_ptr() as *mut _,
134 c"notify::frequency".as_ptr() as *const _,
135 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
136 notify_frequency_trampoline::<Self, F> as *const (),
137 )),
138 Box_::into_raw(f),
139 )
140 }
141 }
142
143 #[doc(alias = "offset")]
144 fn connect_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
145 unsafe extern "C" fn notify_offset_trampoline<
146 P: IsA<LFOControlSource>,
147 F: Fn(&P) + Send + Sync + 'static,
148 >(
149 this: *mut ffi::GstLFOControlSource,
150 _param_spec: glib::ffi::gpointer,
151 f: glib::ffi::gpointer,
152 ) {
153 let f: &F = &*(f as *const F);
154 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
155 }
156 unsafe {
157 let f: Box_<F> = Box_::new(f);
158 connect_raw(
159 self.as_ptr() as *mut _,
160 c"notify::offset".as_ptr() as *const _,
161 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
162 notify_offset_trampoline::<Self, F> as *const (),
163 )),
164 Box_::into_raw(f),
165 )
166 }
167 }
168
169 #[doc(alias = "timeshift")]
170 fn connect_timeshift_notify<F: Fn(&Self) + Send + Sync + 'static>(
171 &self,
172 f: F,
173 ) -> SignalHandlerId {
174 unsafe extern "C" fn notify_timeshift_trampoline<
175 P: IsA<LFOControlSource>,
176 F: Fn(&P) + Send + Sync + 'static,
177 >(
178 this: *mut ffi::GstLFOControlSource,
179 _param_spec: glib::ffi::gpointer,
180 f: glib::ffi::gpointer,
181 ) {
182 let f: &F = &*(f as *const F);
183 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
184 }
185 unsafe {
186 let f: Box_<F> = Box_::new(f);
187 connect_raw(
188 self.as_ptr() as *mut _,
189 c"notify::timeshift".as_ptr() as *const _,
190 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
191 notify_timeshift_trampoline::<Self, F> as *const (),
192 )),
193 Box_::into_raw(f),
194 )
195 }
196 }
197
198 #[doc(alias = "waveform")]
199 fn connect_waveform_notify<F: Fn(&Self) + Send + Sync + 'static>(
200 &self,
201 f: F,
202 ) -> SignalHandlerId {
203 unsafe extern "C" fn notify_waveform_trampoline<
204 P: IsA<LFOControlSource>,
205 F: Fn(&P) + Send + Sync + 'static,
206 >(
207 this: *mut ffi::GstLFOControlSource,
208 _param_spec: glib::ffi::gpointer,
209 f: glib::ffi::gpointer,
210 ) {
211 let f: &F = &*(f as *const F);
212 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
213 }
214 unsafe {
215 let f: Box_<F> = Box_::new(f);
216 connect_raw(
217 self.as_ptr() as *mut _,
218 c"notify::waveform".as_ptr() as *const _,
219 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
220 notify_waveform_trampoline::<Self, F> as *const (),
221 )),
222 Box_::into_raw(f),
223 )
224 }
225 }
226}
227
228impl<O: IsA<LFOControlSource>> LFOControlSourceExt for O {}