alsaseq 0.8.0

API binding for alsaseq library
Documentation
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::ffi;
use glib::translate::*;

glib::wrapper! {
    /// A boxed object to express data of control event.
    ///
    /// A [`EventDataCtl`][crate::EventDataCtl] is a boxed object to express data of control event. The instance of
    /// object is one of data properties in event.
    ///
    /// The object wraps `struct snd_seq_ev_ctrl` in UAPI of Linux sound subsystem.
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct EventDataCtl(Boxed<ffi::ALSASeqEventDataCtl>);

    match fn {
        copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::alsaseq_event_data_ctl_get_type(), ptr as *mut _) as *mut ffi::ALSASeqEventDataCtl,
        free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::alsaseq_event_data_ctl_get_type(), ptr as *mut _),
        type_ => || ffi::alsaseq_event_data_ctl_get_type(),
    }
}

impl EventDataCtl {
    /// Get the value of channel for the control event.
    ///
    /// # Returns
    ///
    ///
    /// ## `channel`
    /// The value of channel for the control event.
    #[doc(alias = "alsaseq_event_data_ctl_get_channel")]
    #[doc(alias = "get_channel")]
    pub fn channel(&self) -> u8 {
        unsafe {
            let mut channel = std::mem::MaybeUninit::uninit();
            ffi::alsaseq_event_data_ctl_get_channel(self.to_glib_none().0, channel.as_mut_ptr());
            channel.assume_init()
        }
    }

    /// Get the parameter for the control event.
    ///
    /// # Returns
    ///
    ///
    /// ## `param`
    /// The parameter for the control event.
    #[doc(alias = "alsaseq_event_data_ctl_get_param")]
    #[doc(alias = "get_param")]
    pub fn param(&self) -> u32 {
        unsafe {
            let mut param = std::mem::MaybeUninit::uninit();
            ffi::alsaseq_event_data_ctl_get_param(self.to_glib_none().0, param.as_mut_ptr());
            param.assume_init()
        }
    }

    /// Get the value for the control event.
    ///
    /// # Returns
    ///
    ///
    /// ## `value`
    /// The value for the control event.
    #[doc(alias = "alsaseq_event_data_ctl_get_value")]
    #[doc(alias = "get_value")]
    pub fn value(&self) -> i32 {
        unsafe {
            let mut value = std::mem::MaybeUninit::uninit();
            ffi::alsaseq_event_data_ctl_get_value(self.to_glib_none().0, value.as_mut_ptr());
            value.assume_init()
        }
    }

    /// Set the channel for the control event.
    /// ## `channel`
    /// The channel for the control event.
    #[doc(alias = "alsaseq_event_data_ctl_set_channel")]
    pub fn set_channel(&mut self, channel: u8) {
        unsafe {
            ffi::alsaseq_event_data_ctl_set_channel(self.to_glib_none_mut().0, channel);
        }
    }

    /// Set the parameter for the control event.
    /// ## `param`
    /// The parameter for the control event.
    #[doc(alias = "alsaseq_event_data_ctl_set_param")]
    pub fn set_param(&mut self, param: u32) {
        unsafe {
            ffi::alsaseq_event_data_ctl_set_param(self.to_glib_none_mut().0, param);
        }
    }

    /// Set the value for the control event.
    /// ## `value`
    /// The value for the control event.
    #[doc(alias = "alsaseq_event_data_ctl_set_value")]
    pub fn set_value(&mut self, value: i32) {
        unsafe {
            ffi::alsaseq_event_data_ctl_set_value(self.to_glib_none_mut().0, value);
        }
    }
}

unsafe impl Send for EventDataCtl {}