[etoys-dev] Sound volume control in navigator bar

karl ramberg karlramberg at gmail.com
Wed Feb 22 15:49:36 EST 2012


On Wed, Feb 22, 2012 at 7:02 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
>
> On 22.02.2012, at 18:46, karl ramberg wrote:
>
>> On Wed, Feb 22, 2012 at 3:47 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
>>> On 21.02.2012, at 21:21, karl ramberg wrote:
>>>
>>>> Hm, if I leave sound volume down in Etoys, there is no sound in flash
>>>> movies in my web browser :-(
>>>> The primitive is misbehaving.
>>>
>>>
>>> It changes the system volume, yes. That's one reason why we removed it from the nav bar (or rather, did not add it to the Sugar->style tool bar). Also, the XO and I guess most other laptops and Macs do have volume keys, so why would you need that in the >Etoys toolbar?
>>
>> The reason I want it in the toolbar is that I may want sound from the
>> machine like music playing, but I don't want the sounds from Etoys. Or
>> I want the sounds from Etoys, too, but they are way to loud compared
>> to the other sounds from my system.
>>
>> It's kind of like why all flash movie players have sound controls. You
>> could adjust the volume on the machine, but it's more convenient to
>> adjust the program making the sound than the whole machine.
>>
>> But I also would like to be able to set the volume of sounds by tiles
>> so one can do basic fade in and out and other adjustments.
>> I looked at Scratch and they use MixedSound and the volume control per
>> sound. It could be a better solution as the platform issue would
>> disappear I think/hope. But I have to take a closer look at the how
>> they use MixedSound...
>>
>> Anyway, to implement all sound interfaces on just Windows in a
>> primitive seem to be a total nightmare, so I hope it can be solved in
>> image.
>>
>> Karl
>
>
> Yes, modifying the volume in the image should do what you want.
>
> I think this could even work with zero overhead. Modify AbstractSound>>playSampleCount:into:startingAt: by initializing fullVol to something less than AbstractSound scaleFactor. E.g.
>
>        AbstractSound scaleFactor * SoundPlayer soundVolume // 100
>
> (assuming that soundVolume was changed to not use the primitive but just be a class var)

Cool.
I added a class variable to SoundPlayer called Volume and just changed
the SoundPlayer accessors.

This works really well on Windows XP.
Could someone try this on other platforms ?

http://source.squeak.org/etoysinbox/Sound-kfr.22.mcz
http://source.squeak.org/etoysinbox/Sugar-kfr.19.mcz

Karl


More information about the etoys-dev mailing list