sound volume for mpeg ? how ? [ENH]

John M McIntosh johnmci at smalltalkconsulting.com
Thu Nov 9 19:50:34 UTC 2000


>I'v been peeking around for a way of adjusting the
>volume on a mp3 player. I can't find any way of doing that.
>Any suggestions ?
>
>Karl

Mmm good question.

See
MixedSound>>add: aSound pan: leftRightPan volume: volume

And in
MPEGPlayer>>createSoundFrom: aStream

I use add:pan: but this could be changed to add:pan:volume: and you 
could add a volume inst var and a getter and setter.


However I'm not sure this is the best solution since you rely on the 
OS sound volume too, I had a request for SqC earlier in the week 
about this very issue and make a change to the macintosh VM This 
won't happen til I ship 2.8.5 or 2.9.5 But I might as well release 
the change set.

SoundPlayer soundVolume "get the volume as an array of floats"

SoundPlayer setVolumeLeft: 1.0 volumeRight: 0.0


If a sound is not playing soundVolume & setVolume get/set the default 
volume for your output device, otherwise they only get/set the 
currently playing sound volume.

Levels are 0.0 to 1.0 but you can overdrive the channels so you can 
legally say 2.0 or 5.0.  Remember these won't work until 2.8.5 or 
2.9.5. Support for non-macintosh platforms might be spotty.


However someone needs to add support to the other VMs for this feature.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MacSoundVolumeSupport.1.cs.zip
Type: application/mac-binhex40
Size: 10282 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20001109/6d0c9186/MacSoundVolumeSupport.1.cs.hqx
-------------- next part --------------
-- 
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================
Custom Macintosh programming & various Smalltalk dialects
PGP Key: DSS/Diff/46FC3BE6
Fingerprint=B22F 7D67 92B7 5D52 72D7  E94A EE69 2D21 46FC 3BE6
===========================================================================


More information about the Squeak-dev mailing list