I have an assignment to make an audio conference chat room using sockets. Is this the right approach to mix audio?
s
is byte array which will be sent to clientcl
.cl.ar
is a byte array that contains PCM samples received fromcl
.ar
is a float array that contains sum of samples from all clients.
I subtract the sample of cl
from the total sum divide it by number of other logged in users and send it to cl
.
s[i] = (byte)((ar[i] - cl.ar[i]) / (activeClients.Count - 1));
Is this the correct way?