Pre-Amplify Audio OS X
There are two apps for OS X that allow you to pre-amplify audio before it gets played by the hardware: Audio Hijack (pre-amplifies output from particular applications) and Boom (pre-amplifies all system audio). These apps work by applying equalization to pre-existing audio streams - with开发者_JAVA技巧 a high pre-amp setting - before they are sent to the sound card.
My question is: how to hijack the system audio stream and then send it along to the sound card. Is this somewhere in an API, or would it require altering a system library ?
1) Create a standard sound device that shows up in audio system preferences. This has to be in the form of a kernel extension (kext). Difficult to create by just reading apple docs - try looking at an app called Soundflower.
2) Once you've loaded the kext and have the new audio device available, select it in preferences as the default output device for system audio.
3) Now you need to alter the audio and pipe it to the real system output. This can be done in an accompanying application that adds callback "IOProc" functions to a) the new device and b) your computer's built-in output device. You can then copy audio buffers from one device to the other, to pipe the audio to your speakers. To increase the volume, multiply all the bytes in the buffer by some factor. See Soundflower's accompanying app.
精彩评论