Skip to main content

spice_client_glib/auto/
playback_channel.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::{ffi, Channel};
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{connect_raw, SignalHandlerId},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    #[doc(alias = "SpicePlaybackChannel")]
17    pub struct PlaybackChannel(Object<ffi::SpicePlaybackChannel, ffi::SpicePlaybackChannelClass>) @extends Channel;
18
19    match fn {
20        type_ => || ffi::spice_playback_channel_get_type(),
21    }
22}
23
24impl PlaybackChannel {
25    #[doc(alias = "spice_playback_channel_set_delay")]
26    pub fn set_delay(&self, delay_ms: u32) {
27        unsafe {
28            ffi::spice_playback_channel_set_delay(self.to_glib_none().0, delay_ms);
29        }
30    }
31
32    #[doc(alias = "min-latency")]
33    pub fn min_latency(&self) -> u32 {
34        ObjectExt::property(self, "min-latency")
35    }
36
37    #[doc(alias = "min-latency")]
38    pub fn set_min_latency(&self, min_latency: u32) {
39        ObjectExt::set_property(self, "min-latency", min_latency)
40    }
41
42    pub fn is_muted(&self) -> bool {
43        ObjectExt::property(self, "mute")
44    }
45
46    pub fn set_mute(&self, mute: bool) {
47        ObjectExt::set_property(self, "mute", mute)
48    }
49
50    pub fn nchannels(&self) -> u32 {
51        ObjectExt::property(self, "nchannels")
52    }
53
54    pub fn set_nchannels(&self, nchannels: u32) {
55        ObjectExt::set_property(self, "nchannels", nchannels)
56    }
57
58    //pub fn volume(&self) -> /*Unimplemented*/Basic: Pointer {
59    //    ObjectExt::property(self, "volume")
60    //}
61
62    //pub fn set_volume(&self, volume: /*Unimplemented*/Basic: Pointer) {
63    //    ObjectExt::set_property(self,"volume", volume)
64    //}
65
66    //#[doc(alias = "playback-data")]
67    //pub fn connect_playback_data<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
68    //    Unimplemented data: *.Pointer
69    //}
70
71    #[doc(alias = "playback-get-delay")]
72    pub fn connect_playback_get_delay<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
73        unsafe extern "C" fn playback_get_delay_trampoline<F: Fn(&PlaybackChannel) + 'static>(
74            this: *mut ffi::SpicePlaybackChannel,
75            f: glib::ffi::gpointer,
76        ) {
77            unsafe {
78                let f: &F = &*(f as *const F);
79                f(&from_glib_borrow(this))
80            }
81        }
82        unsafe {
83            let f: Box_<F> = Box_::new(f);
84            connect_raw(
85                self.as_ptr() as *mut _,
86                c"playback-get-delay".as_ptr(),
87                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
88                    playback_get_delay_trampoline::<F> as *const (),
89                )),
90                Box_::into_raw(f),
91            )
92        }
93    }
94
95    #[doc(alias = "playback-start")]
96    pub fn connect_playback_start<F: Fn(&Self, i32, i32, i32) + 'static>(
97        &self,
98        f: F,
99    ) -> SignalHandlerId {
100        unsafe extern "C" fn playback_start_trampoline<
101            F: Fn(&PlaybackChannel, i32, i32, i32) + 'static,
102        >(
103            this: *mut ffi::SpicePlaybackChannel,
104            format: std::ffi::c_int,
105            channels: std::ffi::c_int,
106            rate: std::ffi::c_int,
107            f: glib::ffi::gpointer,
108        ) {
109            unsafe {
110                let f: &F = &*(f as *const F);
111                f(&from_glib_borrow(this), format, channels, rate)
112            }
113        }
114        unsafe {
115            let f: Box_<F> = Box_::new(f);
116            connect_raw(
117                self.as_ptr() as *mut _,
118                c"playback-start".as_ptr(),
119                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
120                    playback_start_trampoline::<F> as *const (),
121                )),
122                Box_::into_raw(f),
123            )
124        }
125    }
126
127    #[doc(alias = "playback-stop")]
128    pub fn connect_playback_stop<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
129        unsafe extern "C" fn playback_stop_trampoline<F: Fn(&PlaybackChannel) + 'static>(
130            this: *mut ffi::SpicePlaybackChannel,
131            f: glib::ffi::gpointer,
132        ) {
133            unsafe {
134                let f: &F = &*(f as *const F);
135                f(&from_glib_borrow(this))
136            }
137        }
138        unsafe {
139            let f: Box_<F> = Box_::new(f);
140            connect_raw(
141                self.as_ptr() as *mut _,
142                c"playback-stop".as_ptr(),
143                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
144                    playback_stop_trampoline::<F> as *const (),
145                )),
146                Box_::into_raw(f),
147            )
148        }
149    }
150
151    #[doc(alias = "min-latency")]
152    pub fn connect_min_latency_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
153        unsafe extern "C" fn notify_min_latency_trampoline<F: Fn(&PlaybackChannel) + 'static>(
154            this: *mut ffi::SpicePlaybackChannel,
155            _param_spec: glib::ffi::gpointer,
156            f: glib::ffi::gpointer,
157        ) {
158            unsafe {
159                let f: &F = &*(f as *const F);
160                f(&from_glib_borrow(this))
161            }
162        }
163        unsafe {
164            let f: Box_<F> = Box_::new(f);
165            connect_raw(
166                self.as_ptr() as *mut _,
167                c"notify::min-latency".as_ptr(),
168                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
169                    notify_min_latency_trampoline::<F> as *const (),
170                )),
171                Box_::into_raw(f),
172            )
173        }
174    }
175
176    #[doc(alias = "mute")]
177    pub fn connect_mute_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
178        unsafe extern "C" fn notify_mute_trampoline<F: Fn(&PlaybackChannel) + 'static>(
179            this: *mut ffi::SpicePlaybackChannel,
180            _param_spec: glib::ffi::gpointer,
181            f: glib::ffi::gpointer,
182        ) {
183            unsafe {
184                let f: &F = &*(f as *const F);
185                f(&from_glib_borrow(this))
186            }
187        }
188        unsafe {
189            let f: Box_<F> = Box_::new(f);
190            connect_raw(
191                self.as_ptr() as *mut _,
192                c"notify::mute".as_ptr(),
193                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
194                    notify_mute_trampoline::<F> as *const (),
195                )),
196                Box_::into_raw(f),
197            )
198        }
199    }
200
201    #[doc(alias = "nchannels")]
202    pub fn connect_nchannels_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
203        unsafe extern "C" fn notify_nchannels_trampoline<F: Fn(&PlaybackChannel) + 'static>(
204            this: *mut ffi::SpicePlaybackChannel,
205            _param_spec: glib::ffi::gpointer,
206            f: glib::ffi::gpointer,
207        ) {
208            unsafe {
209                let f: &F = &*(f as *const F);
210                f(&from_glib_borrow(this))
211            }
212        }
213        unsafe {
214            let f: Box_<F> = Box_::new(f);
215            connect_raw(
216                self.as_ptr() as *mut _,
217                c"notify::nchannels".as_ptr(),
218                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
219                    notify_nchannels_trampoline::<F> as *const (),
220                )),
221                Box_::into_raw(f),
222            )
223        }
224    }
225
226    #[doc(alias = "volume")]
227    pub fn connect_volume_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
228        unsafe extern "C" fn notify_volume_trampoline<F: Fn(&PlaybackChannel) + 'static>(
229            this: *mut ffi::SpicePlaybackChannel,
230            _param_spec: glib::ffi::gpointer,
231            f: glib::ffi::gpointer,
232        ) {
233            unsafe {
234                let f: &F = &*(f as *const F);
235                f(&from_glib_borrow(this))
236            }
237        }
238        unsafe {
239            let f: Box_<F> = Box_::new(f);
240            connect_raw(
241                self.as_ptr() as *mut _,
242                c"notify::volume".as_ptr(),
243                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
244                    notify_volume_trampoline::<F> as *const (),
245                )),
246                Box_::into_raw(f),
247            )
248        }
249    }
250}