Function AudioFileReadPacketData

Source
pub unsafe extern "C-unwind" fn AudioFileReadPacketData(
    in_audio_file: AudioFileID,
    in_use_cache: bool,
    io_num_bytes: NonNull<u32>,
    out_packet_descriptions: *mut AudioStreamPacketDescription,
    in_starting_packet: i64,
    io_num_packets: NonNull<u32>,
    out_buffer: *mut c_void,
) -> i32
Available on crate features AudioFile and objc2-core-audio-types only.
Expand description

Read packets of audio data from the audio file.

AudioFileReadPacketData reads as many of the requested number of packets as will fit in the buffer size given by ioNumPackets. Unlike the deprecated AudioFileReadPackets, ioNumPackets must be initialized. If the byte size of the number packets requested is less than the buffer size, ioNumBytes will be reduced. If the buffer is too small for the number of packets requested, ioNumPackets and ioNumBytes will be reduced to the number of packets that can be accommodated and their byte size. Returns kAudioFileEndOfFileError when read encounters end of file. For all uncompressed formats, packets == frames.

Parameter inAudioFile: an AudioFileID.

Parameter inUseCache: true if it is desired to cache the data upon read, else false

Parameter ioNumBytes: on input the size of outBuffer in bytes. on output, the number of bytes actually returned.

Parameter outPacketDescriptions: An array of packet descriptions describing the packets being returned. The size of the array must be greater or equal to the number of packets requested. On return the packet description will be filled out with the packet offsets and sizes. Packet descriptions are ignored for CBR data.

Parameter inStartingPacket: The packet index of the first packet desired to be returned

Parameter ioNumPackets: on input, the number of packets to read, on output, the number of packets actually read.

Parameter outBuffer: outBuffer should be a pointer to user allocated memory.

Returns: returns noErr if successful.