Exploration of Strongly-typed Units in C++: A Case Study from Digital Audio
Talkat CppCon 2023 · on Wednesday, 2023-10-04· at 14:00· Maple 3/4/5, 6700 North Gaylord Rockies Boulevard·
summary
Shows adopting the mp‑units (P1935) approach to get type‑safe units beyond std::chrono, with concrete wins and limits: catches Mars‑scale unit errors and stopped a local bug that produced 30 seconds instead of 35 ms in a reverb tail; encodes beats/quarter‑notes, maps tempo to seconds, and models sample counts (44,100 / 48,000 Hz) so 512 samples → 11.61 ms at 44.1 kHz; uses validated non‑negative types, reinterpret_cast wrappers for float** host APIs, demos mostly work but decibel/log conversions need more design and some examples don’t compile yet.
AI-written summary · about
chapters (6)
- 0:00Introduction
- 10:07Why units matter
- 20:39Digital audio units overview
- 36:56Nonlinear units and decibels
- 54:20Wrapping third-party APIs
- 59:57Q&A
related talks
01h 06mPhysical Units for Matrices. How Hard Can It Be?
01h 02mUnits Libraries and Autonomous Vehicles: Lessons from the Trenches
01h 02mEmbedded Friendly C++: Features That Make a Difference
01h 01mEmbracing PODs Safely Until They Die
55mThe Curiously Recurring Pattern of Coupled Types
23mFunctional Programming in C++ (Run time vs Compile time types)
01h 30mC++ in Constrained Environments
01h 02mC++20 - My Favorite Code Examples
