objc2_core_midi/generated/MIDIUMPMutableEndpoint.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7#[cfg(feature = "objc2-foundation")]
8use objc2_foundation::*;
9
10use crate::*;
11
12#[cfg(feature = "objc2")]
13extern_class!(
14 /// A mutable MIDIUMPEndpoint object.
15 ///
16 ///
17 /// It is not necessary to create a MIDIUMPEndpoint or other MIDI endpoint in order to
18 /// use UMP natively. Any standard MIDI endpoint created with a specified MIDIProtocolID
19 /// is assumed to use all 16 UMP groups for the same unspecified function and to neither
20 /// transmit nor receive jitter-reduction timestamps.
21 ///
22 /// This API is not realtime-safe, all interaction with the mutable endpoint should be done on the
23 /// main thread.
24 ///
25 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpmutableendpoint?language=objc)
26 #[unsafe(super(MIDIUMPEndpoint, NSObject))]
27 #[derive(Debug, PartialEq, Eq, Hash)]
28 #[cfg(all(feature = "MIDIUMPEndpoint", feature = "objc2"))]
29 pub struct MIDIUMPMutableEndpoint;
30);
31
32#[cfg(all(feature = "MIDIUMPEndpoint", feature = "objc2"))]
33extern_conformance!(
34 unsafe impl NSObjectProtocol for MIDIUMPMutableEndpoint {}
35);
36
37#[cfg(all(feature = "MIDIUMPEndpoint", feature = "objc2"))]
38impl MIDIUMPMutableEndpoint {
39 extern_methods!(
40 #[cfg(all(
41 feature = "MIDIUMPFunctionBlock",
42 feature = "MIDIUMPMutableFunctionBlock",
43 feature = "objc2-foundation"
44 ))]
45 /// The Function Blocks associated with the UMP endpoint, if any.
46 #[unsafe(method(mutableFunctionBlocks))]
47 #[unsafe(method_family = none)]
48 pub unsafe fn mutableFunctionBlocks(
49 &self,
50 ) -> Retained<NSArray<MIDIUMPMutableFunctionBlock>>;
51
52 #[cfg(all(
53 feature = "MIDIUMPFunctionBlock",
54 feature = "MIDIUMPMutableFunctionBlock",
55 feature = "objc2-foundation"
56 ))]
57 /// Setter for [`mutableFunctionBlocks`][Self::mutableFunctionBlocks].
58 ///
59 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
60 #[unsafe(method(setMutableFunctionBlocks:))]
61 #[unsafe(method_family = none)]
62 pub unsafe fn setMutableFunctionBlocks(
63 &self,
64 mutable_function_blocks: &NSArray<MIDIUMPMutableFunctionBlock>,
65 );
66
67 /// The enable state of the endpoint.
68 #[unsafe(method(isEnabled))]
69 #[unsafe(method_family = none)]
70 pub unsafe fn isEnabled(&self) -> bool;
71
72 #[cfg(all(
73 feature = "MIDIServices",
74 feature = "block2",
75 feature = "objc2-foundation"
76 ))]
77 /// Initializer for creating a new MIDIUMPEndpoint.
78 ///
79 ///
80 /// Parameter `name`: The UMP endpoint name.
81 ///
82 /// Parameter `deviceInfo`: The MIDI 2 device ID info for the UMP endpoint.
83 ///
84 /// Parameter `productInstanceID`: The product instance ID, up to 42 characters.
85 ///
86 /// Parameter `MIDIProtocol`: The MIDI protocol.
87 ///
88 /// Parameter `destinationCallback`: The receive callback used to create the UMP endpoint's MIDI
89 /// destination associated, which can be used to observe or process
90 /// incoming MIDI traffic.
91 ///
92 ///
93 /// This operation will fail if the device ID information is malformed or if virtual MIDI endpoint creation
94 /// is not allowed (for example, on iOS, if your app doesn't list 'audio' in UIBackgroundModes).
95 ///
96 /// # Safety
97 ///
98 /// `destination_callback` must be a valid pointer.
99 #[unsafe(method(initWithName:deviceInfo:productInstanceID:MIDIProtocol:destinationCallback:))]
100 #[unsafe(method_family = init)]
101 pub unsafe fn initWithName_deviceInfo_productInstanceID_MIDIProtocol_destinationCallback(
102 this: Allocated<Self>,
103 name: &NSString,
104 device_info: &MIDI2DeviceInfo,
105 product_instance_id: &NSString,
106 midi_protocol: MIDIProtocolID,
107 destination_callback: MIDIReceiveBlock,
108 ) -> Option<Retained<Self>>;
109
110 #[cfg(feature = "objc2-foundation")]
111 /// Set the endpoints name.
112 ///
113 ///
114 /// Parameter `name`: A string representing the name of the endpoint.
115 ///
116 /// Parameter `error`: The out-error used if an error occurs.
117 ///
118 ///
119 /// Returns: YES for success. NO in the event of a failure, in which case the error is returned in error.
120 ///
121 ///
122 /// This operation will fail if the name could not be set.
123 #[unsafe(method(setName:error:_))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn setName_error(&self, name: &NSString) -> Result<(), Retained<NSError>>;
126
127 #[cfg(all(
128 feature = "MIDIUMPFunctionBlock",
129 feature = "MIDIUMPMutableFunctionBlock",
130 feature = "objc2-foundation"
131 ))]
132 /// Register or replace Function Blocks for a disabled client-created MIDIUMPEndpoint.
133 ///
134 ///
135 /// Parameter `functionBlocks`: A list of client-created Function Blocks to register.
136 ///
137 /// Parameter `markAsStatic`: Whether the Function Block configuration may be updated.
138 ///
139 /// Parameter `error`: The out-error used if an error occurs.
140 ///
141 ///
142 /// Returns: YES for success. NO in the event of a failure, in which case the error is returned in error.
143 ///
144 ///
145 /// This operation will fail if the array contains any disabled Function Blocks but the
146 /// MIDIUMPEndpoint Function Block configuration is static.
147 /// Returns YES if the Function Block configuration was set successfully.
148 #[unsafe(method(registerFunctionBlocks:markAsStatic:error:_))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn registerFunctionBlocks_markAsStatic_error(
151 &self,
152 function_blocks: &NSArray<MIDIUMPMutableFunctionBlock>,
153 mark_as_static: bool,
154 ) -> Result<(), Retained<NSError>>;
155
156 #[cfg(feature = "objc2-foundation")]
157 /// Enable a mutable UMP endpoint in the system-wide UMP endpoint cache.
158 ///
159 ///
160 /// Parameter `isEnabled`: The enable state of the UMP endpoint.
161 ///
162 /// Parameter `error`: The out-error used if an error occurred.
163 ///
164 ///
165 /// Returns: YES for success. NO in the event of a failure, in which case the error is returned in error.
166 ///
167 ///
168 /// A MIDIUMPMutableEndpoint must be cache enabled before it is visible via API.
169 /// Note that Function Blocks may only be registered to uncached MIDIUMPMutableEndpoint
170 /// objects.
171 #[unsafe(method(setEnabled:error:_))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn setEnabled_error(&self, is_enabled: bool) -> Result<(), Retained<NSError>>;
174 );
175}
176
177/// Methods declared on superclass `MIDIUMPEndpoint`.
178#[cfg(all(feature = "MIDIUMPEndpoint", feature = "objc2"))]
179impl MIDIUMPMutableEndpoint {
180 extern_methods!(
181 #[unsafe(method(init))]
182 #[unsafe(method_family = init)]
183 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
184 );
185}
186
187/// Methods declared on superclass `NSObject`.
188#[cfg(all(feature = "MIDIUMPEndpoint", feature = "objc2"))]
189impl MIDIUMPMutableEndpoint {
190 extern_methods!(
191 #[unsafe(method(new))]
192 #[unsafe(method_family = new)]
193 pub unsafe fn new() -> Retained<Self>;
194 );
195}