objc2_phase/generated/
PHASEAssetRegistry.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-avf-audio")]
6use objc2_avf_audio::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11extern_class!(
12    /// ***********************************************************************************************
13    ///
14    ///
15    ///
16    /// An object that represents a registered asset in the asset registry.
17    ///
18    /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phaseasset?language=objc)
19    #[unsafe(super(NSObject))]
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    pub struct PHASEAsset;
22);
23
24extern_conformance!(
25    unsafe impl NSObjectProtocol for PHASEAsset {}
26);
27
28impl PHASEAsset {
29    extern_methods!(
30        #[unsafe(method(init))]
31        #[unsafe(method_family = init)]
32        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
33
34        #[unsafe(method(new))]
35        #[unsafe(method_family = new)]
36        pub unsafe fn new() -> Retained<Self>;
37
38        /// The identifier that uniquely represents this asset.
39        #[unsafe(method(identifier))]
40        #[unsafe(method_family = none)]
41        pub unsafe fn identifier(&self) -> Retained<NSString>;
42    );
43}
44
45extern_class!(
46    /// *************************************************************************************************
47    ///
48    ///
49    ///
50    /// An object that represents a registered sound asset in the asset registry.
51    ///
52    /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasesoundasset?language=objc)
53    #[unsafe(super(PHASEAsset, NSObject))]
54    #[derive(Debug, PartialEq, Eq, Hash)]
55    pub struct PHASESoundAsset;
56);
57
58extern_conformance!(
59    unsafe impl NSObjectProtocol for PHASESoundAsset {}
60);
61
62impl PHASESoundAsset {
63    extern_methods!(
64        #[unsafe(method(init))]
65        #[unsafe(method_family = init)]
66        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
67
68        #[unsafe(method(new))]
69        #[unsafe(method_family = new)]
70        pub unsafe fn new() -> Retained<Self>;
71
72        /// The URL of the sound asset, if applicable.
73        #[unsafe(method(url))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn url(&self) -> Option<Retained<NSURL>>;
76
77        /// The buffer for the sound asset, if applicable.
78        #[unsafe(method(data))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn data(&self) -> Option<Retained<NSData>>;
81
82        #[cfg(feature = "PHASETypes")]
83        /// The sound asset type.
84        #[unsafe(method(type))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn r#type(&self) -> PHASEAssetType;
87    );
88}
89
90extern_class!(
91    /// *************************************************************************************************
92    ///
93    ///
94    ///
95    /// An object that represents a registered sound event asset in the asset registry.
96    ///
97    /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasesoundeventnodeasset?language=objc)
98    #[unsafe(super(PHASEAsset, NSObject))]
99    #[derive(Debug, PartialEq, Eq, Hash)]
100    pub struct PHASESoundEventNodeAsset;
101);
102
103extern_conformance!(
104    unsafe impl NSObjectProtocol for PHASESoundEventNodeAsset {}
105);
106
107impl PHASESoundEventNodeAsset {
108    extern_methods!(
109        #[unsafe(method(init))]
110        #[unsafe(method_family = init)]
111        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
112
113        #[unsafe(method(new))]
114        #[unsafe(method_family = new)]
115        pub unsafe fn new() -> Retained<Self>;
116    );
117}
118
119extern_class!(
120    /// *************************************************************************************************
121    ///
122    ///
123    ///
124    /// An object that represents a registered global metaparameter asset in the asset registry.
125    ///
126    /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phaseglobalmetaparameterasset?language=objc)
127    #[unsafe(super(PHASEAsset, NSObject))]
128    #[derive(Debug, PartialEq, Eq, Hash)]
129    pub struct PHASEGlobalMetaParameterAsset;
130);
131
132extern_conformance!(
133    unsafe impl NSObjectProtocol for PHASEGlobalMetaParameterAsset {}
134);
135
136impl PHASEGlobalMetaParameterAsset {
137    extern_methods!(
138        #[unsafe(method(init))]
139        #[unsafe(method_family = init)]
140        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
141
142        #[unsafe(method(new))]
143        #[unsafe(method_family = new)]
144        pub unsafe fn new() -> Retained<Self>;
145    );
146}
147
148extern_class!(
149    /// *************************************************************************************************
150    ///
151    ///
152    ///
153    /// Asset registry
154    ///
155    /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phaseassetregistry?language=objc)
156    #[unsafe(super(NSObject))]
157    #[derive(Debug, PartialEq, Eq, Hash)]
158    pub struct PHASEAssetRegistry;
159);
160
161extern_conformance!(
162    unsafe impl NSObjectProtocol for PHASEAssetRegistry {}
163);
164
165impl PHASEAssetRegistry {
166    extern_methods!(
167        #[unsafe(method(init))]
168        #[unsafe(method_family = init)]
169        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
170
171        #[unsafe(method(new))]
172        #[unsafe(method_family = new)]
173        pub unsafe fn new() -> Retained<Self>;
174
175        #[cfg(all(feature = "PHASEDefinition", feature = "PHASEMetaParameter"))]
176        /// Register a global metaparameter with the asset registry.
177        ///
178        /// Note: This function is synchronous and thread-safe.
179        /// Clients can safely run this function to register multiple global metaparameters from multiple threads, if required.
180        ///
181        /// Parameter `metaParameterDefinition`: The metaparameter object to register.
182        ///
183        /// Parameter `error`: The error object in case of an error.
184        ///
185        /// Returns: A PHASEGlobalMetaParameterAsset object.
186        #[unsafe(method(registerGlobalMetaParameter:error:_))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn registerGlobalMetaParameter_error(
189            &self,
190            meta_parameter_definition: &PHASEMetaParameterDefinition,
191        ) -> Result<Retained<PHASEGlobalMetaParameterAsset>, Retained<NSError>>;
192
193        #[cfg(all(feature = "PHASEDefinition", feature = "PHASESoundEventNodes"))]
194        /// Register a sound event asset with the asset registry.
195        ///
196        /// Note: This function is synchronous and thread-safe.
197        /// Clients can safely run this function to register multiple sound event assets from multiple threads, if required.
198        ///
199        /// Parameter `rootNode`: The root node of the sound event asset to register.
200        ///
201        /// Parameter `identifier`: An identifier that uniquely represents this sound event asset. Nil generates an automatic identifier.
202        ///
203        /// Parameter `error`: The error object in case of an error
204        ///
205        /// Returns: A PHASESoundEventNodeAsset object
206        #[unsafe(method(registerSoundEventAssetWithRootNode:identifier:error:_))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn registerSoundEventAssetWithRootNode_identifier_error(
209            &self,
210            root_node: &PHASESoundEventNodeDefinition,
211            identifier: Option<&NSString>,
212        ) -> Result<Retained<PHASESoundEventNodeAsset>, Retained<NSError>>;
213
214        #[cfg(all(feature = "PHASETypes", feature = "objc2-avf-audio"))]
215        /// Register an audio file as a sound asset in the system.
216        ///
217        /// Note: This function is synchronous and thread-safe.
218        /// Clients can safely run this function to register multiple sound assets from multiple threads, if required.
219        ///
220        /// Parameter `url`: The URL of the audio file.
221        ///
222        /// Parameter `identifier`: An identifier that uniquely represents this sound event asset. Nil generates an automatic identifier.
223        ///
224        /// Parameter `assetType`: The asset type for this sound asset.
225        ///
226        /// Parameter `channelLayout`: The audio channel layout for this sound asset.
227        /// If a valid channel layout definition is read from the file being registered, this will override it.
228        /// If nil is passed as a value for this property, the file must either be mono or stereo, or already contain a vaild channel layout definition.
229        /// This channel layout must have the same channel count as the audio file being loaded.
230        ///
231        /// Parameter `normalizationMode`: The normalization mode.
232        ///
233        /// Parameter `error`: The error object in case of an error
234        ///
235        /// Returns: A PHASESoundAsset object
236        #[unsafe(method(registerSoundAssetAtURL:identifier:assetType:channelLayout:normalizationMode:error:_))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn registerSoundAssetAtURL_identifier_assetType_channelLayout_normalizationMode_error(
239            &self,
240            url: &NSURL,
241            identifier: Option<&NSString>,
242            asset_type: PHASEAssetType,
243            channel_layout: Option<&AVAudioChannelLayout>,
244            normalization_mode: PHASENormalizationMode,
245        ) -> Result<Retained<PHASESoundAsset>, Retained<NSError>>;
246
247        #[cfg(all(feature = "PHASETypes", feature = "objc2-avf-audio"))]
248        /// Register audio data as a sound asset in the system.
249        ///
250        /// Note: This function is synchronous and thread-safe.
251        /// Clients can safely run this function to register multiple sound assets from multiple threads, if required.
252        ///
253        /// Parameter `data`: A buffer containing the audio data to register as a sound asset.
254        /// Audio data must either be a single PCM buffer of interleaved channels or multiple deinterleaved PCM buffers per channel packed back to back.
255        ///
256        /// Parameter `identifier`: The identifier to assign to this sound asset. Nil generates an automatic identifier.
257        ///
258        /// Parameter `format`: The AVAudioFormat object that describes the audio data in the buffer.
259        ///
260        /// Parameter `normalizationMode`: The normalization mode.
261        ///
262        /// Parameter `error`: The error object in case of an error.
263        ///
264        /// Returns: A PHASESoundAsset object.
265        #[unsafe(method(registerSoundAssetWithData:identifier:format:normalizationMode:error:_))]
266        #[unsafe(method_family = none)]
267        pub unsafe fn registerSoundAssetWithData_identifier_format_normalizationMode_error(
268            &self,
269            data: &NSData,
270            identifier: Option<&NSString>,
271            format: &AVAudioFormat,
272            normalization_mode: PHASENormalizationMode,
273        ) -> Result<Retained<PHASESoundAsset>, Retained<NSError>>;
274
275        /// Finds an asset in the asset registry, given an identifier.
276        ///
277        /// Parameter `identifier`: The identifier of this asset
278        ///
279        /// Returns: A PHASEAsset object, or nil if one could not be found.
280        #[unsafe(method(assetForIdentifier:))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn assetForIdentifier(
283            &self,
284            identifier: &NSString,
285        ) -> Option<Retained<PHASEAsset>>;
286
287        #[cfg(feature = "PHASEMetaParameter")]
288        /// A dictionary of global metaparameters
289        #[unsafe(method(globalMetaParameters))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn globalMetaParameters(
292            &self,
293        ) -> Retained<NSDictionary<NSString, PHASEMetaParameter>>;
294    );
295}