FMX Change and mute master volume in OS X


I wrote an FMX (FireMonkey) application and I want to change (increase / decrease) and mute / unmute the master volume output in OS X. Either in Delphi or C++Builder. Alternatively I would do it by simulating key presses of the specific keys of the keyboard.

For Windows, it is fairly easily by simulating key presses with SendInput() or even easier with keybd_event().

This is how it works on windows for me:

// vkVolumeUp / vkVolumeDown / vkVolumeMute
keybd_event(vkVolumeUp, 1, 0, 0);
keybd_event(vkVolumeUp, 1, KEYEVENTF_KEYUP, 0);

But I can’t manage to compile it for OS X, since the IDE tells me that it doesn’t know this functions. A direct way to change the volume would be even better if it is possible.

Comments are closed.