1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-audio-types")]
use objc2_core_audio_types::*;
use crate::*;
/// Block to receive audio data from AVAudioSinkNode
///
/// Parameter `timestamp`: The time at which the input data will be rendered.
///
/// Parameter `frameCount`: The number of sample frames of input provided.
///
/// Parameter `inputData`: The input audio data.
///
/// The engine will supply valid buffers in inputData's mBuffers' mData and mDataByteSize.
/// mDataByteSize will be consistent with frameCount.
///
/// The pointer to the AudioBufferList is only valid within the scope of this block.
///
/// Returns: An OSStatus result code. If an error is returned, the input data should be assumed to be
/// invalid.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosinknodereceiverblock?language=objc)
#[cfg(all(
feature = "AVAudioTypes",
feature = "block2",
feature = "objc2-core-audio-types"
))]
pub type AVAudioSinkNodeReceiverBlock = *mut block2::DynBlock<
dyn Fn(NonNull<AudioTimeStamp>, AVAudioFrameCount, NonNull<AudioBufferList>) -> OSStatus,
>;
extern_class!(
/// AVAudioSinkNode wraps a client provided block to receive input audio on the audio IO thread.
///
/// AVAudioSinkNode is restricted to be used in the input chain and does not support format
/// conversion. Hence when connecting to an AVAudioSinkNode node, the format for the connection
/// should be the output scope format of the input node (essentialy the format should match the input hardware
/// sample rate).
///
/// The voice processing IO unit is an exception to the above as it supports sample rate conversion.
/// The input scope format (HW format) and output scope format (client format) of the input node can differ
/// in that case.
///
/// This node is only supported when the engine is rendering to the audio device and not in
/// manual rendering mode.
///
/// AVAudioSinkNode does not have an output bus and therefore it does not support tapping.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiosinknode?language=objc)
#[unsafe(super(AVAudioNode, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "AVAudioNode")]
pub struct AVAudioSinkNode;
);
#[cfg(feature = "AVAudioNode")]
extern_conformance!(
unsafe impl NSObjectProtocol for AVAudioSinkNode {}
);
#[cfg(feature = "AVAudioNode")]
impl AVAudioSinkNode {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(
feature = "AVAudioTypes",
feature = "block2",
feature = "objc2-core-audio-types"
))]
/// Create a node with a receiver block.
///
/// Parameter `block`: The block that receives audio data from the input.
///
/// The receiver block is called when the input data is available.
///
/// The block will be called on the realtime thread and it is the client's responsibility to
/// handle it in a thread-safe manner and to not make any blocking calls.
///
/// The audio format for the input bus will be set from the connection format when connecting
/// to another node.
///
/// The audio format for the data received by the block will be set to the node's input format.
///
/// # Safety
///
/// `block` must be a valid pointer.
#[unsafe(method(initWithReceiverBlock:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithReceiverBlock(
this: Allocated<Self>,
block: AVAudioSinkNodeReceiverBlock,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "AVAudioNode")]
impl AVAudioSinkNode {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}