private void AddPlayback(User user) { if (user.Id != connection.Protocol.LocalUser.Id) { SpeakerPlayback.AddPlayer(user.Id, user.Voice); } }
public Form1() { InitializeComponent(); protocol = new ConnectionMumbleProtocol(); protocol.channelMessageReceivedDelegate = ChannelMessageReceivedDelegate; protocol.personalMessageReceivedDelegate = PersonalMessageReceivedDelegate; protocol.encodedVoice = EncodedVoiceDelegate; protocol.userJoinedDelegate = UserJoinedDelegate; protocol.userLeftDelegate = UserLeftDelegate; protocol.channelJoinedDelegate = ChannelJoinedDelegate; protocol.channelLeftDelegate = ChannelLeftDelegate; protocol.serverConfigDelegate = ServerConfigDelegate; tvUsers.ExpandAll(); tvUsers.StartUpdating(); playback = new SpeakerPlayback(); int playbackDeviceCount = NAudio.Wave.WaveOut.DeviceCount; cbPlaybackDevices.Items.Add("Default Playback Device"); for (int i = 0; i < playbackDeviceCount; i++) { NAudio.Wave.WaveOutCapabilities deviceInfo = NAudio.Wave.WaveOut.GetCapabilities(i); string deviceText = string.Format("{0}, {1} channels", deviceInfo.ProductName, deviceInfo.Channels); cbPlaybackDevices.Items.Add(deviceText); } cbPlaybackDevices.SelectedIndex = 0; SpeakerPlayback.SelectedDevice = cbPlaybackDevices.SelectedIndex - 1; recorder = new MicrophoneRecorder(protocol); int recorderDeviceCount = NAudio.Wave.WaveIn.DeviceCount; for (int i = 0; i < recorderDeviceCount; i++) { NAudio.Wave.WaveInCapabilities deviceInfo = NAudio.Wave.WaveIn.GetCapabilities(i); string deviceText = string.Format("{0}, {1} channels", deviceInfo.ProductName, deviceInfo.Channels); cbRecordingDevices.Items.Add(deviceText); } if (recorderDeviceCount > 0) { MicrophoneRecorder.SelectedDevice = 0; cbRecordingDevices.SelectedIndex = 0; } numVoiceDetectorThreshold.Value = Convert.ToDecimal(recorder.VoiceDetectionThreshold) * 100; }
void UserLeftDelegate(BasicMumbleProtocol proto, User user) { DeleteUserNode(user.Id, tvUsers.Nodes[0]); SpeakerPlayback.RemovePlayer(user.Id); }