3

first of all, I'm just a hobbyist, so I'm sorry if this is dumb question or if I'm being too naive. (It also means that I can't buy expensive libraries)

This is the situation: I'm building a simple voice chat application in C#.NET (something like Ventrilo or TeamSpeak but only for about 15 or 20 people, and running on 100Mbps LAN). I have working server (spawning thread for each client) and client application using UDP for connection and DirectSound for capturing and playing the sound. I can make "1 on 1" calls but I can't figure out one of the most important things:

How do i have more than two people in the conversation?

Ken
  • 33
  • 3
  • 3
    You might want to rephrase your question. "what would be the best approach to make everyone hear what is everyone else saying" seems to broad. It doesn't cover cases where people aren't facing the microphone, or where mute has been pressed. Based on the rest of your question, are you really asking "how do i have more than two people in the conversation"? If that's the case, you might consider either a star or mesh topology. You might also consider using IP multicast. – atk Feb 05 '10 at 14:11
  • Thank you for your comment. I have rephrased the question as you suggested (because that's really the cas). I was considering using multicast but wasn't sure if that's a good idea in this case. – Ken Feb 06 '10 at 20:38

1 Answers1

2

You need some centralized place to send the packets back out via a multicast, or else you need a decentralized approach where every client is connected to every other client, and each client is hosting a multicast. What you want to avoid is making the machines forward out their data to every other machine, which would result in O(n) time to send a message to each machine (and I/O is slow!).

In either scenario, you end up with the same problem: how to combine the audio streams. One simple mechanism to accomplish this is to bitwise-or the signals together before you send them back out (either out the network port, or out to your speakers), but this assumes you have access to non-compressed and reasonably-synchronized streams.

San Jacinto
  • 8,774
  • 5
  • 43
  • 58