Changing the volume of a QTMovie playing an mp3
I'm using a QTMovie to play audio tracks. I've just started playing around with the volume controls and I'm changing the volume using setVolume:(float)newVolume. The problem I'm having is that the volume change seems very very miniscule. I have tried varying the volume between 0 and 10 and 0 and 128 (the maximum) and the difference in loudness is very hard to detect.
Is there anyone with any 开发者_Python百科experience of this that could point out something I'm doing wrong?
I'm using a QTMovie to play audio tracks. I've just started playing around with the volume controls and I'm changing the volume using setVolume:(float)newVolume. The problem I'm having is that the volume change seems very very miniscule. I have tried varying the volume between 0 and 10 and 0 and 128 (the maximum) and the difference in loudness is very hard to detect.
The difference is hard to detect because there isn't one.
setVolume:
takes a floating-point fraction, and you're treating it as an integer. The range is from 0.0 to 1.0, as documented in the documentation for the volume
method:
volume
Returns the movie’s volume as a scalar value of type
float
.Discussion- (float)volume
The valid range is 0.0 to 1.0.
The documentation doesn't specify what happens when you try to set an out-of-range value; my guess is that it currently clamps to 1.0, so all values greater than or equal to 1.0 end up as 1.0, for exactly no difference in loudness.
精彩评论