alsaseq/auto/
event_data_ctl.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)
4// DO NOT EDIT
5
6use crate::ffi;
7use glib::translate::*;
8
9glib::wrapper! {
10    /// A boxed object to express data of control event.
11    ///
12    /// A [`EventDataCtl`][crate::EventDataCtl] is a boxed object to express data of control event. The instance of
13    /// object is one of data properties in event.
14    ///
15    /// The object wraps `struct snd_seq_ev_ctrl` in UAPI of Linux sound subsystem.
16    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
17    pub struct EventDataCtl(Boxed<ffi::ALSASeqEventDataCtl>);
18
19    match fn {
20        copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::alsaseq_event_data_ctl_get_type(), ptr as *mut _) as *mut ffi::ALSASeqEventDataCtl,
21        free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::alsaseq_event_data_ctl_get_type(), ptr as *mut _),
22        type_ => || ffi::alsaseq_event_data_ctl_get_type(),
23    }
24}
25
26impl EventDataCtl {
27    /// Get the value of channel for the control event.
28    ///
29    /// # Returns
30    ///
31    ///
32    /// ## `channel`
33    /// The value of channel for the control event.
34    #[doc(alias = "alsaseq_event_data_ctl_get_channel")]
35    #[doc(alias = "get_channel")]
36    pub fn channel(&self) -> u8 {
37        unsafe {
38            let mut channel = std::mem::MaybeUninit::uninit();
39            ffi::alsaseq_event_data_ctl_get_channel(self.to_glib_none().0, channel.as_mut_ptr());
40            channel.assume_init()
41        }
42    }
43
44    /// Get the parameter for the control event.
45    ///
46    /// # Returns
47    ///
48    ///
49    /// ## `param`
50    /// The parameter for the control event.
51    #[doc(alias = "alsaseq_event_data_ctl_get_param")]
52    #[doc(alias = "get_param")]
53    pub fn param(&self) -> u32 {
54        unsafe {
55            let mut param = std::mem::MaybeUninit::uninit();
56            ffi::alsaseq_event_data_ctl_get_param(self.to_glib_none().0, param.as_mut_ptr());
57            param.assume_init()
58        }
59    }
60
61    /// Get the value for the control event.
62    ///
63    /// # Returns
64    ///
65    ///
66    /// ## `value`
67    /// The value for the control event.
68    #[doc(alias = "alsaseq_event_data_ctl_get_value")]
69    #[doc(alias = "get_value")]
70    pub fn value(&self) -> i32 {
71        unsafe {
72            let mut value = std::mem::MaybeUninit::uninit();
73            ffi::alsaseq_event_data_ctl_get_value(self.to_glib_none().0, value.as_mut_ptr());
74            value.assume_init()
75        }
76    }
77
78    /// Set the channel for the control event.
79    /// ## `channel`
80    /// The channel for the control event.
81    #[doc(alias = "alsaseq_event_data_ctl_set_channel")]
82    pub fn set_channel(&mut self, channel: u8) {
83        unsafe {
84            ffi::alsaseq_event_data_ctl_set_channel(self.to_glib_none_mut().0, channel);
85        }
86    }
87
88    /// Set the parameter for the control event.
89    /// ## `param`
90    /// The parameter for the control event.
91    #[doc(alias = "alsaseq_event_data_ctl_set_param")]
92    pub fn set_param(&mut self, param: u32) {
93        unsafe {
94            ffi::alsaseq_event_data_ctl_set_param(self.to_glib_none_mut().0, param);
95        }
96    }
97
98    /// Set the value for the control event.
99    /// ## `value`
100    /// The value for the control event.
101    #[doc(alias = "alsaseq_event_data_ctl_set_value")]
102    pub fn set_value(&mut self, value: i32) {
103        unsafe {
104            ffi::alsaseq_event_data_ctl_set_value(self.to_glib_none_mut().0, value);
105        }
106    }
107}
108
109unsafe impl Send for EventDataCtl {}