As others have noted, this is trivial for most macOS and iOS apps to opt in to.
Frankly, I imagine its also available at the system level on Windows (and maybe Android and Linux) but probably only among applications that happen to be using certain audio frameworks/engines.