OS X Volume Management in Snow Leopard

This is a continuation of Managing application startup volumes on Mac OS X using Objective-C , which explains how to set up a volume for 10.5 or earlier. Functions AudioXXXXXGetPropertyand AudioXXXXXSetProperty(and related) are deprecated at 10.6, per Technical Note TN2223 .

I am not an expert in programming on OS X or CoreAudio, so I hope someone is confused about what is required in Snow Leopard and can help me (and others) here.

+3
source share
1 answer

Here is an example to set the volume to 50%:

Float32 volume = 0.5;
UInt32 size = sizeof(Float32);

AudioObjectPropertyAddress address = {
    kAudioDevicePropertyVolumeScalar,
    kAudioDevicePropertyScopeOutput,
    1 // use values 1 and 2 here, 0 (master) does not seem to work
};

OSStatus err;
err = AudioObjectSetPropertyData(device, &address, 0, NULL, size, &volume);
+2
source

All Articles