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 note event.
    ///
    /// A [`EventDataNote`][crate::EventDataNote] is a boxed object to express data of note event. The instance of
    /// object is one of data properties in event.
    ///
    /// The object wraps `struct snd_seq_ev_note` in UAPI of Linux sound subsystem.
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct EventDataNote(Boxed<ffi::ALSASeqEventDataNote>);

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

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

    /// Get the value of duration in the note event.
    ///
    /// # Returns
    ///
    ///
    /// ## `duration`
    /// The value of duratino in the note event.
    #[doc(alias = "alsaseq_event_data_note_get_duration")]
    #[doc(alias = "get_duration")]
    pub fn duration(&self) -> u8 {
        unsafe {
            let mut duration = std::mem::MaybeUninit::uninit();
            ffi::alsaseq_event_data_note_get_duration(self.to_glib_none().0, duration.as_mut_ptr());
            duration.assume_init()
        }
    }

    /// Get the value of note in the note event.
    ///
    /// # Returns
    ///
    ///
    /// ## `note`
    /// The value of note in the note event.
    #[doc(alias = "alsaseq_event_data_note_get_note")]
    #[doc(alias = "get_note")]
    pub fn note(&self) -> u8 {
        unsafe {
            let mut note = std::mem::MaybeUninit::uninit();
            ffi::alsaseq_event_data_note_get_note(self.to_glib_none().0, note.as_mut_ptr());
            note.assume_init()
        }
    }

    /// Get the value of off-velocity in the note event.
    ///
    /// # Returns
    ///
    ///
    /// ## `off_velocity`
    /// The value of off-velocity in the note event.
    #[doc(alias = "alsaseq_event_data_note_get_off_velocity")]
    #[doc(alias = "get_off_velocity")]
    pub fn off_velocity(&self) -> u8 {
        unsafe {
            let mut off_velocity = std::mem::MaybeUninit::uninit();
            ffi::alsaseq_event_data_note_get_off_velocity(
                self.to_glib_none().0,
                off_velocity.as_mut_ptr(),
            );
            off_velocity.assume_init()
        }
    }

    /// Get the value of velocity in the note event.
    ///
    /// # Returns
    ///
    ///
    /// ## `velocity`
    /// The value of velocity in the note event.
    #[doc(alias = "alsaseq_event_data_note_get_velocity")]
    #[doc(alias = "get_velocity")]
    pub fn velocity(&self) -> u8 {
        unsafe {
            let mut velocity = std::mem::MaybeUninit::uninit();
            ffi::alsaseq_event_data_note_get_velocity(self.to_glib_none().0, velocity.as_mut_ptr());
            velocity.assume_init()
        }
    }

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

    /// Set the value of duration for the note event.
    /// ## `duration`
    /// The value of duration for the note event.
    #[doc(alias = "alsaseq_event_data_note_set_duration")]
    pub fn set_duration(&mut self, duration: u8) {
        unsafe {
            ffi::alsaseq_event_data_note_set_duration(self.to_glib_none_mut().0, duration);
        }
    }

    /// Set the value of note for the note event.
    /// ## `note`
    /// The value of note for the note event.
    #[doc(alias = "alsaseq_event_data_note_set_note")]
    pub fn set_note(&mut self, note: u8) {
        unsafe {
            ffi::alsaseq_event_data_note_set_note(self.to_glib_none_mut().0, note);
        }
    }

    /// Set the value of note for the off-velocity event.
    /// ## `off_velocity`
    /// The value of note for the off-velocity event.
    #[doc(alias = "alsaseq_event_data_note_set_off_velocity")]
    pub fn set_off_velocity(&mut self, off_velocity: u8) {
        unsafe {
            ffi::alsaseq_event_data_note_set_off_velocity(self.to_glib_none_mut().0, off_velocity);
        }
    }

    /// Set the value of note for the velocity event.
    /// ## `velocity`
    /// The value of note for the velocity event.
    #[doc(alias = "alsaseq_event_data_note_set_velocity")]
    pub fn set_velocity(&mut self, velocity: u8) {
        unsafe {
            ffi::alsaseq_event_data_note_set_velocity(self.to_glib_none_mut().0, velocity);
        }
    }
}

unsafe impl Send for EventDataNote {}