Skip to main content

spice_client_glib/auto/
record_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 = "SpiceRecordChannel")]
17    pub struct RecordChannel(Object<ffi::SpiceRecordChannel, ffi::SpiceRecordChannelClass>) @extends Channel;
18
19    match fn {
20        type_ => || ffi::spice_record_channel_get_type(),
21    }
22}
23
24impl RecordChannel {
25    //#[doc(alias = "spice_record_channel_send_data")]
26    //pub fn send_data(&self, data: /*Unimplemented*/Option<Basic: Pointer>, bytes: usize, time: u32) {
27    //    unsafe { TODO: call ffi:spice_record_channel_send_data() }
28    //}
29
30    pub fn is_muted(&self) -> bool {
31        ObjectExt::property(self, "mute")
32    }
33
34    pub fn set_mute(&self, mute: bool) {
35        ObjectExt::set_property(self, "mute", mute)
36    }
37
38    pub fn nchannels(&self) -> u32 {
39        ObjectExt::property(self, "nchannels")
40    }
41
42    pub fn set_nchannels(&self, nchannels: u32) {
43        ObjectExt::set_property(self, "nchannels", nchannels)
44    }
45
46    //pub fn volume(&self) -> /*Unimplemented*/Basic: Pointer {
47    //    ObjectExt::property(self, "volume")
48    //}
49
50    //pub fn set_volume(&self, volume: /*Unimplemented*/Basic: Pointer) {
51    //    ObjectExt::set_property(self,"volume", volume)
52    //}
53
54    #[doc(alias = "record-start")]
55    pub fn connect_record_start<F: Fn(&Self, i32, i32, i32) + 'static>(
56        &self,
57        f: F,
58    ) -> SignalHandlerId {
59        unsafe extern "C" fn record_start_trampoline<
60            F: Fn(&RecordChannel, i32, i32, i32) + 'static,
61        >(
62            this: *mut ffi::SpiceRecordChannel,
63            format: std::ffi::c_int,
64            channels: std::ffi::c_int,
65            rate: std::ffi::c_int,
66            f: glib::ffi::gpointer,
67        ) {
68            unsafe {
69                let f: &F = &*(f as *const F);
70                f(&from_glib_borrow(this), format, channels, rate)
71            }
72        }
73        unsafe {
74            let f: Box_<F> = Box_::new(f);
75            connect_raw(
76                self.as_ptr() as *mut _,
77                c"record-start".as_ptr(),
78                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
79                    record_start_trampoline::<F> as *const (),
80                )),
81                Box_::into_raw(f),
82            )
83        }
84    }
85
86    #[doc(alias = "record-stop")]
87    pub fn connect_record_stop<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
88        unsafe extern "C" fn record_stop_trampoline<F: Fn(&RecordChannel) + 'static>(
89            this: *mut ffi::SpiceRecordChannel,
90            f: glib::ffi::gpointer,
91        ) {
92            unsafe {
93                let f: &F = &*(f as *const F);
94                f(&from_glib_borrow(this))
95            }
96        }
97        unsafe {
98            let f: Box_<F> = Box_::new(f);
99            connect_raw(
100                self.as_ptr() as *mut _,
101                c"record-stop".as_ptr(),
102                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
103                    record_stop_trampoline::<F> as *const (),
104                )),
105                Box_::into_raw(f),
106            )
107        }
108    }
109
110    #[doc(alias = "mute")]
111    pub fn connect_mute_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
112        unsafe extern "C" fn notify_mute_trampoline<F: Fn(&RecordChannel) + 'static>(
113            this: *mut ffi::SpiceRecordChannel,
114            _param_spec: glib::ffi::gpointer,
115            f: glib::ffi::gpointer,
116        ) {
117            unsafe {
118                let f: &F = &*(f as *const F);
119                f(&from_glib_borrow(this))
120            }
121        }
122        unsafe {
123            let f: Box_<F> = Box_::new(f);
124            connect_raw(
125                self.as_ptr() as *mut _,
126                c"notify::mute".as_ptr(),
127                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
128                    notify_mute_trampoline::<F> as *const (),
129                )),
130                Box_::into_raw(f),
131            )
132        }
133    }
134
135    #[doc(alias = "nchannels")]
136    pub fn connect_nchannels_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
137        unsafe extern "C" fn notify_nchannels_trampoline<F: Fn(&RecordChannel) + 'static>(
138            this: *mut ffi::SpiceRecordChannel,
139            _param_spec: glib::ffi::gpointer,
140            f: glib::ffi::gpointer,
141        ) {
142            unsafe {
143                let f: &F = &*(f as *const F);
144                f(&from_glib_borrow(this))
145            }
146        }
147        unsafe {
148            let f: Box_<F> = Box_::new(f);
149            connect_raw(
150                self.as_ptr() as *mut _,
151                c"notify::nchannels".as_ptr(),
152                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
153                    notify_nchannels_trampoline::<F> as *const (),
154                )),
155                Box_::into_raw(f),
156            )
157        }
158    }
159
160    #[doc(alias = "volume")]
161    pub fn connect_volume_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
162        unsafe extern "C" fn notify_volume_trampoline<F: Fn(&RecordChannel) + 'static>(
163            this: *mut ffi::SpiceRecordChannel,
164            _param_spec: glib::ffi::gpointer,
165            f: glib::ffi::gpointer,
166        ) {
167            unsafe {
168                let f: &F = &*(f as *const F);
169                f(&from_glib_borrow(this))
170            }
171        }
172        unsafe {
173            let f: Box_<F> = Box_::new(f);
174            connect_raw(
175                self.as_ptr() as *mut _,
176                c"notify::volume".as_ptr(),
177                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
178                    notify_volume_trampoline::<F> as *const (),
179                )),
180                Box_::into_raw(f),
181            )
182        }
183    }
184}