Re: Setting the device volume
Re: Setting the device volume
- Subject: Re: Setting the device volume
- From: patrick machielse <email@hidden>
- Date: Thu, 11 Nov 2004 23:57:05 +0100
Op 11-nov-04 om 21:03 heeft Michael Thornburgh het volgende geschreven:
in the code you included, you are asking the device for the master
volume (channel 0) of the input direction (isInput = true) of the
audio device. your device may not have an input side, or may not have
a master volume control.
OK. It seems I was playing through a device that has neither the
kAudioDevicePropertyVolumeDecibels nor the
kAudioDevicePropertyVolumeScalar property. (tried both on channel 0
(master) and channel 1, for both directions). This is a usb Yamaha
AP-U70 'personal amplifier'. When I use the build-in audio on my
powerbook I am able to get both properties. In the 'Sound' system
preference pane I also cannot adjust the volume of the device, so maybe
that is related to this issue.
Is there an alternative route I can take to adjust the playback volume
of any device, regardless of whether it supports these properties? Or
is the only reliable way to adjust the playback volume through direct
manipulation of the audio data?
also, kAudioDevicePropertyVolumeScalar is a number between 0.0 and
1.0, but it isn't necessarily the scaling factor by which your samples
are multiplied. the values 0..1 are mapped onto the full range of
volume levels supported by the device, but in a potentially
non-uniform, non-continuous, non-linear fashion.
Thanks for this info (I'm a sound newby, and CoreAudio isn't very
friendly to newbies.) I'll try to think 'decibels' in future...
On Nov 11, 2004, at 7:20 AM, patrick machielse wrote:
Another beginner's question:
I'm trying to manipulate the volume of the audio I'm playing. As a
first step I want to know the current device volume. I use the
following code to find out the volume setting:
Float32 the_volume;
UInt32 the_size = sizeof the_volume;
OSStatus err;
err = AudioDeviceGetProperty(device,
0,
true,
kAudioDevicePropertyVolumeScalar,
&the_size,
&the_volume);
if ( err != kAudioHardwareNoError ) {
NSString *errStr = [NSString stringWithCString:(const char *)&err
length:4];
NSLog(@"get kAudioDevicePropertyVolumeScalar error \'%@\'", errStr);
}
_______________________________________________
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