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::*;

extern "C" {
    /// A notification posted when a MIDI UMP Endpoint has been added to the subsystem.
    ///
    ///
    /// The MIDIUMPEndpoint sent in userInfo is the endpoint which was recently discovered.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpendpointwasaddednotification?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static MIDIUMPEndpointWasAddedNotification: &'static NSNotificationName;
}

extern "C" {
    /// A notification posted when a MIDI UMP Endpoint has been removed from the subsystem.
    ///
    ///
    /// Any MIDIUMPEndpoint sent with this notification is no longer available to the system. Any
    /// attempt to perform I/O with its source or destination may fail, as the MIDIEndpointRef
    /// associated with the UMP endpoint may no longer be valid. If this notification is posted,
    /// any resources related to communication with this UMP endpoint may be safely
    /// disposed.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpendpointwasremovednotification?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static MIDIUMPEndpointWasRemovedNotification: &'static NSNotificationName;
}

extern "C" {
    /// A notification posted when an UMP endpoint updates its stream configuration or changes the
    /// state of one of its Function Blocks.
    ///
    ///
    /// If this notification is posted, an Endpoint Info Notification was sent from the UMP endpoint in userInfo.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpendpointwasupdatednotification?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static MIDIUMPEndpointWasUpdatedNotification: &'static NSNotificationName;
}

extern "C" {
    /// A notification posted when a Function Block is updated.
    ///
    ///
    /// If this notification is posted, the supplied Function Block in userInfo has had a change to its
    /// enabled state, Group configuration, UI hint, MIDI 1.0 status, etc..
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpfunctionblockwasupdatednotification?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static MIDIUMPFunctionBlockWasUpdatedNotification: &'static NSNotificationName;
}

/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpendpointmanagerdictionarykey?language=objc)
// NS_TYPED_ENUM
#[cfg(feature = "objc2-foundation")]
pub type MIDIUMPEndpointManagerDictionaryKey = NSString;

extern "C" {
    /// Value is a MIDIUMPEndpoint
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpendpointobjectkey?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static MIDIUMPEndpointObjectKey: &'static MIDIUMPEndpointManagerDictionaryKey;
}

extern "C" {
    /// Value is a MIDIUMPFunctionBlock
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpfunctionblockobjectkey?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static MIDIUMPFunctionBlockObjectKey: &'static MIDIUMPEndpointManagerDictionaryKey;
}

#[cfg(feature = "objc2")]
extern_class!(
    /// A singleton object that performs system-wide UMP Endpoint bookkeeping.
    ///
    ///
    /// MIDIUMPEndpointManager is used to retrieve information about UMP Endpoint
    /// pairs detected by or explicitly declared to the MIDI UMP subsystem.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpendpointmanager?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct MIDIUMPEndpointManager;
);

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

#[cfg(feature = "objc2")]
impl MIDIUMPEndpointManager {
    extern_methods!(
        /// Retrieve the shared UMP Endpoint manager for the client process.
        ///
        ///
        /// After first access to this property, the client process may begin observing notifications
        /// which are posted when the system-wide cache changes.
        #[unsafe(method(sharedInstance))]
        #[unsafe(method_family = none)]
        pub unsafe fn sharedInstance() -> Retained<MIDIUMPEndpointManager>;

        #[cfg(all(feature = "MIDIUMPEndpoint", feature = "objc2-foundation"))]
        /// A  list of UMP endpoints discovered using UMP endpoint discovery.
        #[unsafe(method(UMPEndpoints))]
        #[unsafe(method_family = none)]
        pub unsafe fn UMPEndpoints(&self) -> Retained<NSArray<MIDIUMPEndpoint>>;
    );
}

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

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}