• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Setting volume levels?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting volume levels?


  • Subject: Re: Setting volume levels?
  • From: Howard Moon <email@hidden>
  • Date: Thu, 26 Jun 2003 13:14:58 -0700

Oh! well, that explains the LARGE difference. I assumed it was just normal rounding error, but the took a second look and saw how big that difference was. Simple rounding error would have resulted in something more like 0.5899956 (just picking a number out of a hat, not an experimental result there :-)) Of course, the same kind of theory applies, but the HAL is apparently even LESS able to give you exact results than the RAM on your computer.

-Howard


On Thursday, June 26, 2003, at 12:55 PM, Jeff Moore wrote:

The reason why is that the hardware provides a range of discreet values which the HAL normalizes out to be between 0 and 1. So if you set a value that is "between" a pair of hardware steps, the HAL floors it to the nearest hardware step.

On Thursday, June 26, 2003, at 12:08 PM, Jim Dolan wrote:

If I run the following code - why do I get different values in the last line?

It does not matter what value I feed in, I always get something less? I
thought maybe it was ramping but the value always seems to be less than, no
matter which direction I change the volume to.


// Set the new level
Float32 fVolume = 0.59;
Float32 fVolume2 = 0.0;
UInt32 dataSize = sizeof(Float32);

AudioDeviceSetProperty( iDeviceID, NULL, actualChannel, isInput,
kAudioDevicePropertyVolumeScalar, sizeof( Float32 ), &fVolume );

AudioDeviceGetProperty( iDeviceID, actualChannel, isInput,
kAudioDevicePropertyVolumeScalar, &dataSize, &fVolume2 );


printf( "Volume: %f %f\n", fVolume, fVolume2 );



Volume: 0.590000 0.586691
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.



--

Jeff Moore
Core Audio
Apple
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Setting volume levels? (From: Jeff Moore <email@hidden>)

  • Prev by Date: Re: Setting volume levels?
  • Next by Date: Re: Setting volume levels?
  • Previous by thread: Re: Setting volume levels?
  • Next by thread: Musicdevice Audiounit, quick and dirty
  • Index(es):
    • Date
    • Thread