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::{ffi, LFOWaveform};
7use glib::{
8 prelude::*,
9 signal::{connect_raw, SignalHandlerId},
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 let f: &F = &*(f as *const F);
197 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
198 }
199 unsafe {
200 let f: Box_<F> = Box_::new(f);
201 connect_raw(
202 self.as_ptr() as *mut _,
203 c"notify::amplitude".as_ptr() as *const _,
204 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
205 notify_amplitude_trampoline::<Self, F> as *const (),
206 )),
207 Box_::into_raw(f),
208 )
209 }
210 }
211
212 #[doc(alias = "frequency")]
213 fn connect_frequency_notify<F: Fn(&Self) + Send + Sync + 'static>(
214 &self,
215 f: F,
216 ) -> SignalHandlerId {
217 unsafe extern "C" fn notify_frequency_trampoline<
218 P: IsA<LFOControlSource>,
219 F: Fn(&P) + Send + Sync + 'static,
220 >(
221 this: *mut ffi::GstLFOControlSource,
222 _param_spec: glib::ffi::gpointer,
223 f: glib::ffi::gpointer,
224 ) {
225 let f: &F = &*(f as *const F);
226 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
227 }
228 unsafe {
229 let f: Box_<F> = Box_::new(f);
230 connect_raw(
231 self.as_ptr() as *mut _,
232 c"notify::frequency".as_ptr() as *const _,
233 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
234 notify_frequency_trampoline::<Self, F> as *const (),
235 )),
236 Box_::into_raw(f),
237 )
238 }
239 }
240
241 #[doc(alias = "offset")]
242 fn connect_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
243 unsafe extern "C" fn notify_offset_trampoline<
244 P: IsA<LFOControlSource>,
245 F: Fn(&P) + Send + Sync + 'static,
246 >(
247 this: *mut ffi::GstLFOControlSource,
248 _param_spec: glib::ffi::gpointer,
249 f: glib::ffi::gpointer,
250 ) {
251 let f: &F = &*(f as *const F);
252 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
253 }
254 unsafe {
255 let f: Box_<F> = Box_::new(f);
256 connect_raw(
257 self.as_ptr() as *mut _,
258 c"notify::offset".as_ptr() as *const _,
259 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
260 notify_offset_trampoline::<Self, F> as *const (),
261 )),
262 Box_::into_raw(f),
263 )
264 }
265 }
266
267 #[doc(alias = "timeshift")]
268 fn connect_timeshift_notify<F: Fn(&Self) + Send + Sync + 'static>(
269 &self,
270 f: F,
271 ) -> SignalHandlerId {
272 unsafe extern "C" fn notify_timeshift_trampoline<
273 P: IsA<LFOControlSource>,
274 F: Fn(&P) + Send + Sync + 'static,
275 >(
276 this: *mut ffi::GstLFOControlSource,
277 _param_spec: glib::ffi::gpointer,
278 f: glib::ffi::gpointer,
279 ) {
280 let f: &F = &*(f as *const F);
281 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
282 }
283 unsafe {
284 let f: Box_<F> = Box_::new(f);
285 connect_raw(
286 self.as_ptr() as *mut _,
287 c"notify::timeshift".as_ptr() as *const _,
288 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
289 notify_timeshift_trampoline::<Self, F> as *const (),
290 )),
291 Box_::into_raw(f),
292 )
293 }
294 }
295
296 #[doc(alias = "waveform")]
297 fn connect_waveform_notify<F: Fn(&Self) + Send + Sync + 'static>(
298 &self,
299 f: F,
300 ) -> SignalHandlerId {
301 unsafe extern "C" fn notify_waveform_trampoline<
302 P: IsA<LFOControlSource>,
303 F: Fn(&P) + Send + Sync + 'static,
304 >(
305 this: *mut ffi::GstLFOControlSource,
306 _param_spec: glib::ffi::gpointer,
307 f: glib::ffi::gpointer,
308 ) {
309 let f: &F = &*(f as *const F);
310 f(LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
311 }
312 unsafe {
313 let f: Box_<F> = Box_::new(f);
314 connect_raw(
315 self.as_ptr() as *mut _,
316 c"notify::waveform".as_ptr() as *const _,
317 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
318 notify_waveform_trampoline::<Self, F> as *const (),
319 )),
320 Box_::into_raw(f),
321 )
322 }
323 }
324}
325
326impl<O: IsA<LFOControlSource>> LFOControlSourceExt for O {}