Setting server volume from doOnServerTree

[email protected] Sun, 31 May 2020 09:13:26 +0200
Newsgroups gmane.comp.audio.supercollider.devel
Message-ID <[email protected]>
Hi.

I accidentally stumbled over a "race" condition.
Calling s.volume.volume_ from doOnServerTree (if the method is
run before updateFunc from Volume.sendSynthDef) will result in "stacked"
attenuation.

Since the server is already running, volume_ will eventually create
an ampSynth.  Later Volumes own ServerTree function (updateFunc) is
run, which unconditionally sets ampSynth to nil and runs updateSynth.
updateSynth in turn will check if ampSynth is nil, and create a new
synth.  Now we have two ampSynths on the server and we can only control
the volume of one of these.

I am wondering why updateFunc sets ampSynth to nil unconditionally.
As far as I can see, just removing that line would fix this, since
updateSynth will call set on ampSynth if it already exists.

Anyone familiar with that code could shed light on why this rather harsh
ampSynth = nil
is there?

-- 
CYa,
  ⡍⠁⠗⠊⠕

_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-dev/
search: http://www.listarc.bham.ac.uk/lists/sc-dev/search/