objc2_core_midi/generated/
MIDIUMPMutableFunctionBlock.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4#[cfg(feature = "objc2")]
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-foundation")]
7use objc2_foundation::*;
8
9use crate::*;
10
11#[cfg(feature = "objc2")]
12extern_class!(
13    /// A mutable Function Block object created by the client process.
14    ///
15    ///
16    /// A Function Block created with this API may be used in the Function Block configuration
17    /// of a client-created MIDIUMPMutableEndpoint.
18    ///
19    /// This API is not realtime-safe, all interaction with the function block should be done on the
20    /// main thread.
21    ///
22    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpmutablefunctionblock?language=objc)
23    #[unsafe(super(MIDIUMPFunctionBlock, NSObject))]
24    #[derive(Debug, PartialEq, Eq, Hash)]
25    #[cfg(all(feature = "MIDIUMPFunctionBlock", feature = "objc2"))]
26    pub struct MIDIUMPMutableFunctionBlock;
27);
28
29#[cfg(all(feature = "MIDIUMPFunctionBlock", feature = "objc2"))]
30extern_conformance!(
31    unsafe impl NSObjectProtocol for MIDIUMPMutableFunctionBlock {}
32);
33
34#[cfg(all(feature = "MIDIUMPFunctionBlock", feature = "objc2"))]
35impl MIDIUMPMutableFunctionBlock {
36    extern_methods!(
37        #[cfg(all(feature = "MIDIUMPEndpoint", feature = "MIDIUMPMutableEndpoint"))]
38        /// The UMP Endpoint to which this Function Block is registered.
39        #[unsafe(method(UMPEndpoint))]
40        #[unsafe(method_family = none)]
41        pub unsafe fn UMPEndpoint(&self) -> Option<Retained<MIDIUMPMutableEndpoint>>;
42
43        #[unsafe(method(init))]
44        #[unsafe(method_family = init)]
45        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
46
47        #[cfg(all(feature = "MIDIMessages", feature = "objc2-foundation"))]
48        /// The initializer for constructing a Function Block.
49        ///
50        ///
51        /// Parameter `name`: The Function Block name.
52        ///
53        /// Parameter `direction`: The directionality of the Function Block.
54        ///
55        /// Parameter `firstGroup`: The first UMP Group supported by the Function Block.
56        ///
57        /// Parameter `totalGroupsSpanned`: The number of UMP groups spanned by the Function Block.
58        ///
59        /// Parameter `maxSysEx8Streams`: The maximum number of simultaneous Sysex8 streams.
60        ///
61        /// Parameter `MIDI1Info`: The MIDI 1.0 speed information for the Function Block.
62        ///
63        /// Parameter `UIHint`: A UI hint for the Function Block.
64        ///
65        /// Parameter `isEnabled`: The enable state of the Function Block.
66        ///
67        ///
68        /// This operation will fail if virtual MIDI endpoint creation is not allowed
69        /// (for example, on iOS, if your app doesn't list 'audio' in UIBackgroundModes).
70        #[unsafe(method(initWithName:direction:firstGroup:totalGroupsSpanned:maxSysEx8Streams:MIDI1Info:UIHint:isEnabled:))]
71        #[unsafe(method_family = init)]
72        pub unsafe fn initWithName_direction_firstGroup_totalGroupsSpanned_maxSysEx8Streams_MIDI1Info_UIHint_isEnabled(
73            this: Allocated<Self>,
74            name: &NSString,
75            direction: MIDIUMPFunctionBlockDirection,
76            first_group: MIDIUMPGroupNumber,
77            total_groups_spanned: MIDIUInteger7,
78            max_sys_ex8_streams: MIDIUInteger7,
79            midi1_info: MIDIUMPFunctionBlockMIDI1Info,
80            ui_hint: MIDIUMPFunctionBlockUIHint,
81            is_enabled: bool,
82        ) -> Option<Retained<Self>>;
83
84        #[cfg(feature = "objc2-foundation")]
85        /// Set whether this Function Block is enabled or disabled.
86        ///
87        ///
88        /// Parameter `isEnabled`: The new state of the Function Block.
89        ///
90        /// Parameter `error`: The out-error used if an error occurred.
91        ///
92        ///
93        /// Returns: YES for success. NO in the event of a failure, in which case the error is returned in error.
94        ///
95        ///
96        /// If a Function Block is registered to UMP Endpoint as part of a static configuration,
97        /// the state must always be enabled and may not change. If registered to a UMP Endpoint,
98        /// changes to the Function Block state are propagated to the system-wide cache.
99        #[unsafe(method(setEnabled:error:_))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn setEnabled_error(&self, is_enabled: bool) -> Result<(), Retained<NSError>>;
102
103        #[cfg(feature = "objc2-foundation")]
104        /// Set the function block name.
105        ///
106        ///
107        /// Parameter `name`: A string representing the name of the function block.
108        ///
109        /// Parameter `error`: The out-error used if an error occurs.
110        ///
111        ///
112        /// Returns: YES for success. NO in the event of a failure, in which case the error is returned in error.
113        ///
114        ///
115        /// The Function Block name string. Updating the name of a Function Block will cause the
116        /// updated name to be propagated to all local copies of the system-wide cache.
117        #[unsafe(method(setName:error:_))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn setName_error(&self, name: &NSString) -> Result<(), Retained<NSError>>;
120
121        #[cfg(all(feature = "MIDIMessages", feature = "objc2-foundation"))]
122        /// Reconfigure a Function Block.
123        ///
124        ///
125        /// Parameter `firstGroup`: The new first Group to use for the Function Block..
126        ///
127        /// Parameter `direction`: The direction of the Function Block: input, output, or bidirectional.
128        ///
129        /// Parameter `MIDI1Info`: MIDI 1.0 speed information.
130        ///
131        /// Parameter `UIHint`: A hint for UI about the primary usage of this Function Block.
132        ///
133        ///
134        /// If a mutable Function Block has not been registered to a CI device or was registered in
135        /// a non-static Function Block configuration, the first Group can be changed if the final
136        /// Group spanned by the Function Block is valid after the Function Block has been
137        /// relocated.
138        /// Returns YES if the first Group of the Function Block was changed.
139        #[unsafe(method(reconfigureWithFirstGroup:direction:MIDI1Info:UIHint:error:_))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn reconfigureWithFirstGroup_direction_MIDI1Info_UIHint_error(
142            &self,
143            first_group: MIDIUMPGroupNumber,
144            direction: MIDIUMPFunctionBlockDirection,
145            midi1_info: MIDIUMPFunctionBlockMIDI1Info,
146            ui_hint: MIDIUMPFunctionBlockUIHint,
147        ) -> Result<(), Retained<NSError>>;
148    );
149}
150
151/// Methods declared on superclass `NSObject`.
152#[cfg(all(feature = "MIDIUMPFunctionBlock", feature = "objc2"))]
153impl MIDIUMPMutableFunctionBlock {
154    extern_methods!(
155        #[unsafe(method(new))]
156        #[unsafe(method_family = new)]
157        pub unsafe fn new() -> Retained<Self>;
158    );
159}