Effect problem
Tuner32 opened this issue · 10 comments
I just tried put effect on object to multiple edit audio. with multiple ScarletsAudioStreamer edited version. It work well to send edited voice. But the first time audio node was work perfect, with real time update. But it work only one. Second one audio send work, but real time update is not work.
example:
First: Audioeditnode[firstid] = Scarlets Effect
second: Audioeditnode[secondid] = Scarlets Effect
Event update(data) {
foreach(audioeditnode)key => {
audioeditnode[key].update(packet);
}
}
I don't think MediaEffect or AudioStreamer has update(packet)
function, and I don't know what update
function is doing on your code.
Try to clone the packet
to new object, if the packet also has ArrayBuffer then you will also need to clone the ArrayBuffer. Maybe it was emptied or kind of destroyed by the browser or somewhere on your code, and the same packet couldn't be used for another, because it already destroyed.
It is like this
audioeditnode[firstid] = ScarletsMediaEffect.stereoPanner();
audioeditnode[secondid] = ScarletsMediaEffect.stereoPanner();
{both. node connect code}
socket.on('update', function(packet) {
Object.keys(audionode).forEach(key => {
audionode[key].set(packet);
});
});
And I jest used console log, objet keys foreach is work well. I think It can't update second audio edit node.
It is kind of bug? or js hoisting
Have you check if both effect connect to destination node?
Does the second node can works if the set()
is not being called?
yes It called it work, I checked. But it cannot update pannernode
No the first node is work,
I just used like this
recive is ScarletsAudioStreamers
audionode[key + ":" + socketid] = ScarletsMediaEffect.StereoPanner();
recive[socketid].connect(audionode[key + ":" + socketid].input, key + ":" + socketid)
audionode[key + ":" + socketid].output.connect(send[key].destination);
It is not problem from packet I think. It can't update..
This is not a problem from the library.
I have tested using 2 StereoPanner effect with Blackprint and all node was working with different set()
value.
Please re-check your own implementation and write code more efficiently, and please improve on how you explain your own problem or I will not help if you treat me like a very smart person who can read your mind with very unclear explanation.
And please don't use pseudo code since the beginning, but please use your real code implementation!
Sorry I wrote that commant outside.