objc2-core-midi 0.3.2

Bindings to the CoreMIDI framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-foundation")]
use objc2_foundation::*;

use crate::*;

#[cfg(feature = "objc2")]
extern_class!(
    /// An object representing a Function Block.
    ///
    ///
    /// A Function Block encapsulates one or more UMP groups with a single function, allowing
    /// agents communicating with that UMP Endpoint to route and process UMP traffic
    /// properly. Unless the owning MIDIUMPEndpoint has a static Function Block configuration,
    /// any Function Block metadata may change in response to a configuration change in the
    /// owning UMP endpoint.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpfunctionblock?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct MIDIUMPFunctionBlock;
);

#[cfg(feature = "objc2")]
extern_conformance!(
    unsafe impl NSObjectProtocol for MIDIUMPFunctionBlock {}
);

#[cfg(feature = "objc2")]
impl MIDIUMPFunctionBlock {
    extern_methods!(
        #[cfg(feature = "objc2-foundation")]
        /// A string containing the Function Block's name.
        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub unsafe fn name(&self) -> Retained<NSString>;

        #[cfg(all(feature = "MIDIMessages", feature = "MIDIUMPCI"))]
        /// The device-unique ID for this Function Block.
        #[unsafe(method(functionBlockID))]
        #[unsafe(method_family = none)]
        pub unsafe fn functionBlockID(&self) -> MIDIUMPFunctionBlockID;

        #[cfg(feature = "MIDIMessages")]
        /// The direction of the Function Block: input, output, or bidirectional.
        #[unsafe(method(direction))]
        #[unsafe(method_family = none)]
        pub unsafe fn direction(&self) -> MIDIUMPFunctionBlockDirection;

        #[cfg(feature = "MIDIMessages")]
        /// The first Group spanned by this Function Block.
        #[unsafe(method(firstGroup))]
        #[unsafe(method_family = none)]
        pub unsafe fn firstGroup(&self) -> MIDIUMPGroupNumber;

        #[cfg(feature = "MIDIMessages")]
        /// The total number of groups spanned by this Function Block.
        #[unsafe(method(totalGroupsSpanned))]
        #[unsafe(method_family = none)]
        pub unsafe fn totalGroupsSpanned(&self) -> MIDIUInteger7;

        /// The maximum number of simultaneous Sysex8 streams.
        #[unsafe(method(maxSysEx8Streams))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxSysEx8Streams(&self) -> u8;

        #[cfg(feature = "MIDIMessages")]
        /// MIDI 1.0 speed information.
        #[unsafe(method(MIDI1Info))]
        #[unsafe(method_family = none)]
        pub unsafe fn MIDI1Info(&self) -> MIDIUMPFunctionBlockMIDI1Info;

        #[cfg(feature = "MIDIMessages")]
        /// A hint for UI about the primary usage of this Function Block.
        #[unsafe(method(UIHint))]
        #[unsafe(method_family = none)]
        pub unsafe fn UIHint(&self) -> MIDIUMPFunctionBlockUIHint;

        #[cfg(feature = "MIDIUMPEndpoint")]
        /// The UMP Endpoint to which this Function Block is registered.
        ///
        ///
        /// If the function block does not belong to an endpoint this property will be nil.
        #[unsafe(method(UMPEndpoint))]
        #[unsafe(method_family = none)]
        pub unsafe fn UMPEndpoint(&self) -> Option<Retained<MIDIUMPEndpoint>>;

        #[cfg(feature = "MIDICIDevice")]
        /// Retrieve the MIDICIDevice class interface if the Function Block supports MIDI-CI.
        ///
        ///
        /// If a Function Block was created as a MIDICIDevice object, this property will
        /// provide an in-place MIDICIDevice interface that may be used with MIDI-CI API. If the
        /// device was not created as a MIDICIDevice, this method returns nil.
        #[unsafe(method(midiCIDevice))]
        #[unsafe(method_family = none)]
        pub unsafe fn midiCIDevice(&self) -> Option<Retained<MIDICIDevice>>;

        /// The enable state of this Function Block.
        #[unsafe(method(isEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isEnabled(&self) -> bool;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2")]
impl MIDIUMPFunctionBlock {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}