Hello all.
I am trying to control mixer volumes through custom callbacks but that doesn't seem to work. I think the only thing that works is when I setup the server (which is Flask) and declare the values, when I try to change an amp value with a socket after the server starts, it takes no effect. I have a setup like this:
audio_server = pyo.Server(sr=44100, nchnls=2, buffersize=512)
audio_server.boot()
audio_server.start()
background_audio_table = pyo.SndTable("background.wav")
background_freq = background_audio_table.getRate()
background_sound = pyo.Osc(table=background_audio_table, freq=background_freq, mul=1)
audio_mixer = pyo.Mixer(outs=2, chnls=2) # this is the end of the chain
audio_mixer.addInput(0, background_sound)
# i will then add 0->n based on the nr of sounds I'll add and set the amp nr respectively
audio_mixer.setAmp(0,0,1)
audio_mixer.setAmp(0,1,1)
audio_mixer.out()
I then have some callbacks on the keyboard that will call functions in the server file, with methods like:
@socketio.on('loremipsum')
def _loremipsum(data):
audio_mixer.setAmp(0, 0, 0)
audio_mixer.setAmp(0, 1, 0)
This should put the volume of the background track to 0 right? Anyhow the audio doesn't stop, and to be honest doesn't seem to change at all (qualitative opinion). Any idea how to solve this?
Thanks