Re: Bug in iTunes?
Re: Bug in iTunes?
- Subject: Re: Bug in iTunes?
- From: Nigel Garvey <email@hidden>
- Date: Mon, 9 Jun 2003 12:13:16 +0100
Manfred Lippert wrote on Sat, 7 Jun 2003 16:33:25 +0200:
>
I've got the following script that sets and reads the volume adjustment
>
of the first selected track in iTunes:
>
>
tell application "iTunes"
>
set theTrack to first item of selection
>
set (volume adjustment of theTrack) to 42
>
display dialog (volume adjustment of theTrack) as integer
>
end tell
>
>
Result: The volume adjustment is 41 instead of the requested 42! This
>
is reproducable with every value: positive values are set one too low,
>
negative values are set one too high (e.g. -7 would result in -6).
>
Is this a bug in iTunes? Is this a known bug? Is this bug in every
>
version of iTunes, or is it a new one?
With iTunes 3.0.1 on my machine, I get the same effect - except that
settings that are multiples of 20 are not affected. As Kai says, it's
probably a rounding error.
>
Any ideas how to work around this bug?
The 'volume adjustment' is a percentage adjustment either side of iTunes'
current 'sound volume' setting. It's very sloppy that the value returned
is not the value set, but even with the sound volume at maximum, it's
unlikely that you'd notice a 1% difference. It's also not clear whether
it's the setting that goes wrong or the reading back.
To avoid cumulative errors, and assuming that multiples of 20 are OK on
everyone's machines, you could use a slight variation on Kai's *very*
nice method: :-)
set v to 42
if (v mod 20) is not 0 then set v to v + (v + 1) div v * 2 - 1
I'd similarly recommend Kai's alternative approach, in case the bug's
corrected at a later date. (I've shortened his "final adjustment" line a
little.)
set v to 42
tell application "iTunes"
set t to selection's item 1
set t's volume adjustment to v
set x to t's volume adjustment
set t's volume adjustment to v + v - x
end tell
The caveat in both cases is that where a compensatory setting is a value
not affected by the bug, there will still be an error, but in the other
direction. For instance, if you set the volume adjustment to 59, it'll be
read back as 58. If you compensate by setting the volume adjustment to 60
- a value not affected by the bug - it'll be read back as 60.
NG
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.