///<summary>
 ///    The constructor creates the channels, and the null
 ///    sound, but doesn't make any of the channels active.
 ///
 ///    It should take name/value pair command-line args in an
 ///    string[] container, like main args
 ///</summary>
 private VoiceManager(FMOD.System fmod, Object[] parmArray, ConnectToServerEvent connectEvent, LoginStatusEvent loginStatusEvent, bool runningVoiceBot, string[] playbackFiles)
 {
     log.Info(null, "VoiceManager constructor: " + StringifyParms(parmArray));
     if (connectEvent != null)
         onConnectedToServer += connectEvent;
     if (loginStatusEvent != null)
         onLoginStatusReceived += loginStatusEvent;
     this.parameters = parmArray;
     this.runningVoiceBot = runningVoiceBot;
     this.playbackFiles = playbackFiles;
     currentVoiceParms = new VoiceParmSet(parmArray);
     string MyDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
     string ClientAppDataFolder = Path.Combine(MyDocumentsFolder, "Multiverse World Browser");
     logFolder = Path.Combine(ClientAppDataFolder, "Logs");
     log.Debug(null, "VoiceManager constructor: Applying parms");
     playerListenerProperties = new ListenerProperties();
     playerListenerProperties.Init();
     ApplyConstructorParms(currentVoiceParms);
     ApplyPlaybackSettings(currentVoiceParms, false);
     log.Debug(this, "VoiceManager constructor: Encaching sound sources");
     voiceChannels = new Dictionary<Byte, VoiceChannel>();
     micChannels = new MicrophoneChannel[1];
     if (!runningVoiceBot) {
         if (fmod != null) {
             log.Debug(this, "VoiceManager constructor: Using fmod instance passed in: " + fmod);
             this.fmod = fmod;
         }
         else {
             log.Debug(this, "VoiceManager constructor: Creating new fmod instance");
             InitFmod();
         }
     }
     log.Debug(this, "VoiceManager constructor: Creating mic channel");
     micChannels[0] = new MicrophoneChannel(this, playerOid, micDeviceNumber, micRecordWAV, micRecordSpeex);
     recentSpeakers = new List<VoiceChannel>();
     noSoundShorts = new short[defaultSamplesPerFrame * 8];
     MaybeDeleteRecordedFile(micRecordWAV, LogFolderPath("RecordMic.wav"));
     MaybeDeleteRecordedFile(micRecordSpeex, LogFolderPath("RecordMic.speex"));
     ApplyGroupParms(currentVoiceParms, false);
     if (runningVoiceBot)
         log.DebugFormat(this, "VoiceManager constructor: Running voice bot oid {0}", playerOid);
     if (connectToServer) {
         log.Debug(this, "VoiceManager constructor: Initializing connection to server at " +
             voiceServerHost + ", port " + voiceServerPort);
         receiveBuffer = new byte[receiveBufferSize];
         connectedToServer = true;
         InitializeVoiceServerConnection();
     }
     else
         micChannels[0].InitMicrophone(currentVoiceParms, false);
 }
 public DataFrameAggregator(VoiceManager voiceMgr, int deviceNumber, MicrophoneChannel micChannel)
 {
     this.voiceMgr = voiceMgr;
     this.deviceNumber = deviceNumber;
     this.micChannel = micChannel;
     this.pendingDataFrames = new List<byte[]>();
 }