use crate::{ffi, Addr, EventTstampMode, PortAttrFlag, PortCapFlag};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
#[doc(alias = "ALSASeqPortInfo")]
pub struct PortInfo(Object<ffi::ALSASeqPortInfo, ffi::ALSASeqPortInfoClass>);
match fn {
type_ => || ffi::alsaseq_port_info_get_type(),
}
}
impl PortInfo {
pub const NONE: Option<&'static PortInfo> = None;
#[doc(alias = "alsaseq_port_info_new")]
pub fn new() -> PortInfo {
unsafe { from_glib_full(ffi::alsaseq_port_info_new()) }
}
}
impl Default for PortInfo {
fn default() -> Self {
Self::new()
}
}
pub trait PortInfoExt: IsA<PortInfo> + 'static {
fn addr(&self) -> Option<Addr> {
ObjectExt::property(self.as_ref(), "addr")
}
fn attrs(&self) -> PortAttrFlag {
ObjectExt::property(self.as_ref(), "attrs")
}
fn set_attrs(&self, attrs: PortAttrFlag) {
ObjectExt::set_property(self.as_ref(), "attrs", attrs)
}
fn caps(&self) -> PortCapFlag {
ObjectExt::property(self.as_ref(), "caps")
}
fn set_caps(&self, caps: PortCapFlag) {
ObjectExt::set_property(self.as_ref(), "caps", caps)
}
#[doc(alias = "midi-channels")]
fn midi_channels(&self) -> i32 {
ObjectExt::property(self.as_ref(), "midi-channels")
}
#[doc(alias = "midi-channels")]
fn set_midi_channels(&self, midi_channels: i32) {
ObjectExt::set_property(self.as_ref(), "midi-channels", midi_channels)
}
#[doc(alias = "midi-voices")]
fn midi_voices(&self) -> i32 {
ObjectExt::property(self.as_ref(), "midi-voices")
}
#[doc(alias = "midi-voices")]
fn set_midi_voices(&self, midi_voices: i32) {
ObjectExt::set_property(self.as_ref(), "midi-voices", midi_voices)
}
fn name(&self) -> Option<glib::GString> {
ObjectExt::property(self.as_ref(), "name")
}
fn set_name(&self, name: Option<&str>) {
ObjectExt::set_property(self.as_ref(), "name", name)
}
#[doc(alias = "queue-id")]
fn queue_id(&self) -> u8 {
ObjectExt::property(self.as_ref(), "queue-id")
}
#[doc(alias = "queue-id")]
fn set_queue_id(&self, queue_id: u8) {
ObjectExt::set_property(self.as_ref(), "queue-id", queue_id)
}
#[doc(alias = "read-users")]
fn read_users(&self) -> i32 {
ObjectExt::property(self.as_ref(), "read-users")
}
#[doc(alias = "synth-voices")]
fn synth_voices(&self) -> i32 {
ObjectExt::property(self.as_ref(), "synth-voices")
}
#[doc(alias = "synth-voices")]
fn set_synth_voices(&self, synth_voices: i32) {
ObjectExt::set_property(self.as_ref(), "synth-voices", synth_voices)
}
#[doc(alias = "tstamp-mode")]
fn tstamp_mode(&self) -> EventTstampMode {
ObjectExt::property(self.as_ref(), "tstamp-mode")
}
#[doc(alias = "tstamp-mode")]
fn set_tstamp_mode(&self, tstamp_mode: EventTstampMode) {
ObjectExt::set_property(self.as_ref(), "tstamp-mode", tstamp_mode)
}
#[doc(alias = "tstamp-overwrite")]
fn is_tstamp_overwrite(&self) -> bool {
ObjectExt::property(self.as_ref(), "tstamp-overwrite")
}
#[doc(alias = "tstamp-overwrite")]
fn set_tstamp_overwrite(&self, tstamp_overwrite: bool) {
ObjectExt::set_property(self.as_ref(), "tstamp-overwrite", tstamp_overwrite)
}
#[doc(alias = "write-users")]
fn write_users(&self) -> i32 {
ObjectExt::property(self.as_ref(), "write-users")
}
#[doc(alias = "attrs")]
fn connect_attrs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_attrs_trampoline<P: IsA<PortInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSASeqPortInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(PortInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::attrs".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_attrs_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "caps")]
fn connect_caps_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_caps_trampoline<P: IsA<PortInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSASeqPortInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(PortInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::caps".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_caps_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "midi-channels")]
fn connect_midi_channels_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_midi_channels_trampoline<
P: IsA<PortInfo>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSASeqPortInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(PortInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::midi-channels".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_midi_channels_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "midi-voices")]
fn connect_midi_voices_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_midi_voices_trampoline<
P: IsA<PortInfo>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSASeqPortInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(PortInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::midi-voices".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_midi_voices_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "name")]
fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_name_trampoline<P: IsA<PortInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSASeqPortInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(PortInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::name".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_name_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "queue-id")]
fn connect_queue_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_queue_id_trampoline<P: IsA<PortInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSASeqPortInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(PortInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::queue-id".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_queue_id_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "read-users")]
fn connect_read_users_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_read_users_trampoline<P: IsA<PortInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSASeqPortInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(PortInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::read-users".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_read_users_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "synth-voices")]
fn connect_synth_voices_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_synth_voices_trampoline<
P: IsA<PortInfo>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSASeqPortInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(PortInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::synth-voices".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_synth_voices_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "tstamp-mode")]
fn connect_tstamp_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_tstamp_mode_trampoline<
P: IsA<PortInfo>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSASeqPortInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(PortInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::tstamp-mode".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_tstamp_mode_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "tstamp-overwrite")]
fn connect_tstamp_overwrite_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_tstamp_overwrite_trampoline<
P: IsA<PortInfo>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSASeqPortInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(PortInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::tstamp-overwrite".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_tstamp_overwrite_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "write-users")]
fn connect_write_users_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_write_users_trampoline<
P: IsA<PortInfo>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSASeqPortInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(PortInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::write-users".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_write_users_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl<O: IsA<PortInfo>> PortInfoExt for O {}