use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVAudioPlayerNodeBufferOptions(pub NSUInteger);
bitflags::bitflags! {
impl AVAudioPlayerNodeBufferOptions: NSUInteger {
#[doc(alias = "AVAudioPlayerNodeBufferLoops")]
const Loops = 1<<0;
#[doc(alias = "AVAudioPlayerNodeBufferInterrupts")]
const Interrupts = 1<<1;
#[doc(alias = "AVAudioPlayerNodeBufferInterruptsAtLoop")]
const InterruptsAtLoop = 1<<2;
}
}
unsafe impl Encode for AVAudioPlayerNodeBufferOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for AVAudioPlayerNodeBufferOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVAudioPlayerNodeCompletionCallbackType(pub NSInteger);
impl AVAudioPlayerNodeCompletionCallbackType {
#[doc(alias = "AVAudioPlayerNodeCompletionDataConsumed")]
pub const DataConsumed: Self = Self(0);
#[doc(alias = "AVAudioPlayerNodeCompletionDataRendered")]
pub const DataRendered: Self = Self(1);
#[doc(alias = "AVAudioPlayerNodeCompletionDataPlayedBack")]
pub const DataPlayedBack: Self = Self(2);
}
unsafe impl Encode for AVAudioPlayerNodeCompletionCallbackType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for AVAudioPlayerNodeCompletionCallbackType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "block2")]
pub type AVAudioPlayerNodeCompletionHandler =
*mut block2::DynBlock<dyn Fn(AVAudioPlayerNodeCompletionCallbackType)>;
extern_class!(
#[unsafe(super(AVAudioNode, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "AVAudioNode")]
pub struct AVAudioPlayerNode;
);
#[cfg(all(feature = "AVAudioMixing", feature = "AVAudioNode"))]
extern_conformance!(
unsafe impl AVAudio3DMixing for AVAudioPlayerNode {}
);
#[cfg(all(feature = "AVAudioMixing", feature = "AVAudioNode"))]
extern_conformance!(
unsafe impl AVAudioMixing for AVAudioPlayerNode {}
);
#[cfg(all(feature = "AVAudioMixing", feature = "AVAudioNode"))]
extern_conformance!(
unsafe impl AVAudioStereoMixing for AVAudioPlayerNode {}
);
#[cfg(feature = "AVAudioNode")]
extern_conformance!(
unsafe impl NSObjectProtocol for AVAudioPlayerNode {}
);
#[cfg(feature = "AVAudioNode")]
impl AVAudioPlayerNode {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(
feature = "AVAudioBuffer",
feature = "AVAudioTypes",
feature = "block2"
))]
#[unsafe(method(scheduleBuffer:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn scheduleBuffer_completionHandler(
&self,
buffer: &AVAudioPCMBuffer,
completion_handler: AVAudioNodeCompletionHandler,
);
#[cfg(all(feature = "AVAudioBuffer", feature = "block2"))]
#[unsafe(method(scheduleBuffer:completionCallbackType:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn scheduleBuffer_completionCallbackType_completionHandler(
&self,
buffer: &AVAudioPCMBuffer,
callback_type: AVAudioPlayerNodeCompletionCallbackType,
completion_handler: AVAudioPlayerNodeCompletionHandler,
);
#[cfg(all(
feature = "AVAudioBuffer",
feature = "AVAudioTime",
feature = "AVAudioTypes",
feature = "block2"
))]
#[unsafe(method(scheduleBuffer:atTime:options:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn scheduleBuffer_atTime_options_completionHandler(
&self,
buffer: &AVAudioPCMBuffer,
when: Option<&AVAudioTime>,
options: AVAudioPlayerNodeBufferOptions,
completion_handler: AVAudioNodeCompletionHandler,
);
#[cfg(all(feature = "AVAudioBuffer", feature = "AVAudioTime", feature = "block2"))]
#[unsafe(method(scheduleBuffer:atTime:options:completionCallbackType:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn scheduleBuffer_atTime_options_completionCallbackType_completionHandler(
&self,
buffer: &AVAudioPCMBuffer,
when: Option<&AVAudioTime>,
options: AVAudioPlayerNodeBufferOptions,
callback_type: AVAudioPlayerNodeCompletionCallbackType,
completion_handler: AVAudioPlayerNodeCompletionHandler,
);
#[cfg(all(
feature = "AVAudioFile",
feature = "AVAudioTime",
feature = "AVAudioTypes",
feature = "block2"
))]
#[unsafe(method(scheduleFile:atTime:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn scheduleFile_atTime_completionHandler(
&self,
file: &AVAudioFile,
when: Option<&AVAudioTime>,
completion_handler: AVAudioNodeCompletionHandler,
);
#[cfg(all(feature = "AVAudioFile", feature = "AVAudioTime", feature = "block2"))]
#[unsafe(method(scheduleFile:atTime:completionCallbackType:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn scheduleFile_atTime_completionCallbackType_completionHandler(
&self,
file: &AVAudioFile,
when: Option<&AVAudioTime>,
callback_type: AVAudioPlayerNodeCompletionCallbackType,
completion_handler: AVAudioPlayerNodeCompletionHandler,
);
#[cfg(all(
feature = "AVAudioFile",
feature = "AVAudioTime",
feature = "AVAudioTypes",
feature = "block2"
))]
#[unsafe(method(scheduleSegment:startingFrame:frameCount:atTime:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn scheduleSegment_startingFrame_frameCount_atTime_completionHandler(
&self,
file: &AVAudioFile,
start_frame: AVAudioFramePosition,
number_frames: AVAudioFrameCount,
when: Option<&AVAudioTime>,
completion_handler: AVAudioNodeCompletionHandler,
);
#[cfg(all(
feature = "AVAudioFile",
feature = "AVAudioTime",
feature = "AVAudioTypes",
feature = "block2"
))]
#[unsafe(method(scheduleSegment:startingFrame:frameCount:atTime:completionCallbackType:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn scheduleSegment_startingFrame_frameCount_atTime_completionCallbackType_completionHandler(
&self,
file: &AVAudioFile,
start_frame: AVAudioFramePosition,
number_frames: AVAudioFrameCount,
when: Option<&AVAudioTime>,
callback_type: AVAudioPlayerNodeCompletionCallbackType,
completion_handler: AVAudioPlayerNodeCompletionHandler,
);
#[unsafe(method(stop))]
#[unsafe(method_family = none)]
pub unsafe fn stop(&self);
#[cfg(feature = "AVAudioTypes")]
#[unsafe(method(prepareWithFrameCount:))]
#[unsafe(method_family = none)]
pub unsafe fn prepareWithFrameCount(&self, frame_count: AVAudioFrameCount);
#[unsafe(method(play))]
#[unsafe(method_family = none)]
pub unsafe fn play(&self);
#[cfg(feature = "AVAudioTime")]
#[unsafe(method(playAtTime:))]
#[unsafe(method_family = none)]
pub unsafe fn playAtTime(&self, when: Option<&AVAudioTime>);
#[unsafe(method(pause))]
#[unsafe(method_family = none)]
pub unsafe fn pause(&self);
#[cfg(feature = "AVAudioTime")]
#[unsafe(method(nodeTimeForPlayerTime:))]
#[unsafe(method_family = none)]
pub unsafe fn nodeTimeForPlayerTime(
&self,
player_time: &AVAudioTime,
) -> Option<Retained<AVAudioTime>>;
#[cfg(feature = "AVAudioTime")]
#[unsafe(method(playerTimeForNodeTime:))]
#[unsafe(method_family = none)]
pub unsafe fn playerTimeForNodeTime(
&self,
node_time: &AVAudioTime,
) -> Option<Retained<AVAudioTime>>;
#[unsafe(method(isPlaying))]
#[unsafe(method_family = none)]
pub unsafe fn isPlaying(&self) -> bool;
);
}
#[cfg(feature = "AVAudioNode")]
impl AVAudioPlayerNode {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}