Story Details

  • The Hunt for Error -22

    Posted: 2025-01-22 12:07:57

    The blog post "The Hunt for Error -22" details a frustrating debugging journey involving a macOS audio driver. The author encountered a cryptic "-22" error (kAudioServicesUnsupportedFormat) while trying to initialize an audio unit. After extensive investigation, involving code analysis, packet dumps, and comparisons with a working implementation, the root cause was discovered: a mismatch between the audio stream format's sample rate and the hardware's capabilities. Specifically, the author was requesting a 48kHz sample rate when the device only supported 44.1kHz. The post highlights the difficulty of debugging such low-level audio issues, emphasizing the lack of helpful error messages and the time required to pinpoint the exact problem.

    Summary of Comments ( 9 )
    https://news.ycombinator.com/item?id=42791874

    Hacker News users generally praised the article for its clear explanation of a frustrating debugging experience. Several commenters shared similar anecdotes of chasing obscure errors, highlighting the importance of understanding underlying systems. One commenter pointed out the value of learning assembly for low-level debugging. Another suggested the issue might stem from a memory alignment problem within the struct, a theory that resonated with other users. Some questioned the choice of the TMS320C55x DSP and its development tools, while others defended its use in specific applications. The overall sentiment reflects the shared experience of software developers grappling with elusive bugs and appreciating insightful debugging narratives.