objc2-avf-audio 0.3.2

Bindings to the AVFAudio framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use objc2::__framework_prelude::*;

use crate::*;

/// A position in an audio file or stream.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudioframeposition?language=objc)
pub type AVAudioFramePosition = i64;

/// A number of audio sample frames.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudioframecount?language=objc)
pub type AVAudioFrameCount = u32;

/// A number of packets of compressed audio data.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiopacketcount?language=objc)
pub type AVAudioPacketCount = u32;

/// A number of audio channels.
///
///
/// Rationale: making this a potentially larger-than-32-bit type like NSUInteger would open the
/// door to a large set of runtime failures due to underlying implementations' use of UInt32.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiochannelcount?language=objc)
pub type AVAudioChannelCount = u32;

/// Generic callback handler.
///
/// Various AVAudioEngine objects issue callbacks to generic blocks of this type. In general
/// the callback arrives on a non-main thread and it is the client's responsibility to handle it
/// in a thread-safe manner.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudionodecompletionhandler?language=objc)
#[cfg(feature = "block2")]
pub type AVAudioNodeCompletionHandler = *mut block2::DynBlock<dyn Fn()>;

/// The index of a bus on an AVAudioNode.
///
/// AVAudioNode objects potentially have multiple input and/or output busses.
/// AVAudioNodeBus represents a bus as a zero-based index.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudionodebus?language=objc)
pub type AVAudioNodeBus = NSUInteger;

/// The time position in beats of playback and events in the AVAudioSequencer and its components.
///
/// AVMusicTimeStamp allows the position and duration of events and actions in the AVAudioSequencer to
/// function independently from the tempo of the sequence being played.  At the default tempo of 120.0,
/// a time stamp of 1.0 represents 0.5 seconds of time.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avmusictimestamp?language=objc)
pub type AVMusicTimeStamp = c_double;

/// Struct representing a point in 3D space
///
/// This struct is used by classes dealing with 3D audio such as `AVAudioMixing`
/// and `AVAudioEnvironmentNode` and represents a point in 3D space.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudio3dpoint?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AVAudio3DPoint {
    pub x: c_float,
    pub y: c_float,
    pub z: c_float,
}

unsafe impl Encode for AVAudio3DPoint {
    const ENCODING: Encoding = Encoding::Struct(
        "AVAudio3DPoint",
        &[
            <c_float>::ENCODING,
            <c_float>::ENCODING,
            <c_float>::ENCODING,
        ],
    );
}

unsafe impl RefEncode for AVAudio3DPoint {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// TODO: pub fn AVAudioMake3DPoint(x: c_float,y: c_float,z: c_float,) -> AVAudio3DPoint;

/// Struct representing a vector in 3D space
///
/// This struct is used by classes dealing with 3D audio such as `AVAudioMixing`
/// and `AVAudioEnvironmentNode`.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudio3dvector?language=objc)
pub type AVAudio3DVector = AVAudio3DPoint;

// TODO: pub fn AVAudioMake3DVector(x: c_float,y: c_float,z: c_float,) -> AVAudio3DVector;

/// Struct representing the orientation of the listener in 3D space
///
/// Two orthogonal vectors describe the orientation of the listener. The forward
/// vector points in the direction that the listener is facing. The up vector is orthogonal
/// to the forward vector and points upwards from the listener's head.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudio3dvectororientation?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AVAudio3DVectorOrientation {
    pub forward: AVAudio3DVector,
    pub up: AVAudio3DVector,
}

unsafe impl Encode for AVAudio3DVectorOrientation {
    const ENCODING: Encoding = Encoding::Struct(
        "AVAudio3DVectorOrientation",
        &[<AVAudio3DVector>::ENCODING, <AVAudio3DVector>::ENCODING],
    );
}

unsafe impl RefEncode for AVAudio3DVectorOrientation {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// TODO: pub fn AVAudioMake3DVectorOrientation(forward: AVAudio3DVector,up: AVAudio3DVector,) -> AVAudio3DVectorOrientation;

/// Struct representing the orientation of the listener in 3D space
///
/// Three angles describe the orientation of a listener's head - yaw, pitch and roll.
///
/// Yaw describes the side to side movement of the listener's head.
/// The yaw axis is perpendicular to the plane of the listener's ears with its origin at the
/// center of the listener's head and directed towards the bottom of the listener's head. A
/// positive yaw is in the clockwise direction going from 0 to 180 degrees. A negative yaw is in
/// the counter-clockwise direction going from 0 to -180 degrees.
///
/// Pitch describes the up-down movement of the listener's head.
/// The pitch axis is perpendicular to the yaw axis and is parallel to the plane of the
/// listener's ears with its origin at the center of the listener's head and directed towards
/// the right ear. A positive pitch is the upwards direction going from 0 to 180 degrees. A
/// negative pitch is in the downwards direction going from 0 to -180 degrees.
///
/// Roll describes the tilt of the listener's head.
/// The roll axis is perpendicular to the other two axes with its origin at the center of the
/// listener's head and is directed towards the listener's nose. A positive roll is to the right
/// going from 0 to 180 degrees. A negative roll is to the left going from 0 to -180 degrees.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudio3dangularorientation?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AVAudio3DAngularOrientation {
    pub yaw: c_float,
    pub pitch: c_float,
    pub roll: c_float,
}

unsafe impl Encode for AVAudio3DAngularOrientation {
    const ENCODING: Encoding = Encoding::Struct(
        "AVAudio3DAngularOrientation",
        &[
            <c_float>::ENCODING,
            <c_float>::ENCODING,
            <c_float>::ENCODING,
        ],
    );
}

unsafe impl RefEncode for AVAudio3DAngularOrientation {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// TODO: pub fn AVAudioMake3DAngularOrientation(yaw: c_float,pitch: c_float,roll: c_float,) -> AVAudio3DAngularOrientation;