ScarletsFiction / SFMediaStream

HTML5 media streamer library for playing music, video, playlist, or even live streaming microphone & camera with node server
MIT License
101 stars 30 forks source link

Effect problem #19

Closed Tuner32 closed 3 years ago

Tuner32 commented 3 years ago

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); } }

StefansArya commented 3 years ago

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.

Tuner32 commented 3 years ago

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.

Tuner32 commented 3 years ago

It is kind of bug? or js hoisting

StefansArya commented 3 years ago

Have you check if both effect connect to destination node? Does the second node can works if the set() is not being called?

Tuner32 commented 3 years ago

yes It called it work, I checked. But it cannot update pannernode

StefansArya commented 3 years ago

I think there are no problem of using 2 effect if I set it up like this. chrome_BdhEebrNjS

Make sure that the packet is a number between -1 ~ 1.

Tuner32 commented 3 years ago

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);

Tuner32 commented 3 years ago

It is not problem from packet I think. It can't update..

StefansArya commented 3 years ago

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!

Tuner32 commented 3 years ago

Sorry I wrote that commant outside.