Re: Getting output device volume level
Re: Getting output device volume level
- Subject: Re: Getting output device volume level
- From: Jeff Moore <email@hidden>
- Date: Tue, 4 Apr 2006 12:29:03 -0700
In addition to what Bill said, I would only add that you have to be
careful about the arguments you pass to AudioDeviceGetProperty(). If
you want to ask about the output volume, you need to be sure to pass
false as the isInput argument.
On Mar 31, 2006, at 1:04 PM, William Stewart wrote:
Which device is this failing for?
If you have a look in HAL Lab you can see that some devices don't
have input, some don't have output, and some don't have this
control implemented on the device (for instance, for builtin
hardware this is implemented for each of its two channels)
On 31/03/2006, at 6:22 AM, Bernery Philippe wrote:
Hi,
I am trying volume info from devices. The following code works for
input devices but does not work for output devices (the returned
satus id bad). Obviously I replaced TRUE by FALSE to get output
information.
Is the device not the same for input and output device ? Or...
what's wrong ?
===============
OSStatus status = noErr;
UInt32 size = 0;
Float32 volume = 0.0;
char deviceName[1024];
size = sizeof(deviceName);
status = AudioDeviceGetProperty(deviceList->list[i], 0, TRUE,
kAudioDevicePropertyDeviceName, &size, deviceName);
You should use this:
kAudioDevicePropertyDeviceNameCFString
if (status) {
fprintf(stderr, "Can't get device property:
kAudioDevicePropertyDeviceName");
}
size = sizeof(volume);
status = AudioDeviceGetProperty(deviceList->list[i], 0, TRUE,
kAudioDevicePropertyVolumeScalar, &size, &volume);
if (status) {
fprintf(stderr, "Can't get device property:
kAudioDevicePropertyVolumeScalar");
}
printf("Current volume: %f", volume);
===============
--
Jeff Moore
Core Audio
Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden