Dunfey · Hotel WWDC as data, est. 1983
Front desk everything
Years
Topics

2022 Audio & VideoSystem Services

WWDC22 · 18 min · Audio & Video / System Services

Bring your driver to iPad with DriverKit

Discover how you can easily connect Thunderbolt and USB accessories to iPad with DriverKit. We’ll show you how to convert your existing Mac drivers without any code changes, learn how to add real-time audio support with AudioDriverKit, and provide best practices and tips for developing drivers for iPad.

Watch at developer.apple.com ↗

Transcript all transcripts

Code shown on screen · 1 snippet

Register real-time callback in AudioDriverKit cpp · at 2:25 ↗
// Declare a IOOperationHandler block to set on the IOUserAudioDevice.
// The block will be called from a real time context when a i/o operation
// occurs on the IOUserAudioStream buffers for the device.
io_operation = ^kern_return_t(IOUserAudioObjectID in_device,
                              IOUserAudioIOOperation in_io_operation,
                              uint32_t in_io_buffer_frame_size,
                              uint64_t in_sample_time,
                              uint64_t in_host_time)
{
    // Add custom code to make modifications to the buffers as necessary
    if (in_io_operation == IOUserAudioIOOperationWriteEnd) {
        ...
    } else if (in_io_operation == IOUserAudioIOOperationBeginRead) {
        ...
    }
    return kIOReturnSuccess;
};
this->SetIOOperationHandler(io_operation);

Resources