fixed / industriesalonfunk

0 stars 0 forks source link

mixer onTune value is global #9

Closed fde31 closed 11 years ago

fde31 commented 11 years ago

I just started to work on volume fade-out on the edge of channels and adding statics. Unfortunately the current architecture calls the onTune method of the mixer with a global onTune value of the entire "frequency"-spectrum, which doesn't reveal that much information as it doesn't tell anything about connected stations.

For the fade out I could also put the volume change into each station but how to proceed with statics?

One possible way could be the following: When a station is attached to the mixer the latter starts listening for 'tune' events on the station and stops this when it is unloaded. When a tune event is fired the mixer adjusts the gain of the single station when a fadeIn/fadeOut is necessary and adds its statics.

This would allow also allow a sort of station cross-fading...

Any opinions?

fixed commented 11 years ago

Hm, the thing is that you might want to know how many stations are currently active in order to tell the mixer how to set the volume/statics. Maybe do that in the receiver? (And have station return the distribution-based value in onTune)

fde31 commented 11 years ago

ok. As discussed each channel will take care of it's own volume and fade-out / fade-in on the edges of its distribution while the receiver sums up all tuning values and tells the mixer how much static noise should be added. I will take of implementing this tomorrow.

fde31 commented 11 years ago

ok. just pushed a couple of commits, including the three above, which should solve the problem. The cool thing about it is that the Mixer now takes care of adding a fadeIn/fadeOut when attachSource and detachSource are called by making use of the WebAudio Parameter automation.

To add the static noise I made the receiver sum up the tuning values of each station and handed this result to the mixer for his onTune function call. Based on that the statics are added to the main ouput.

I'll close the issue as I think this should be solved with this implementation.