// Message sent by PhotonVoiceRecorder
        void PhotonVoiceCreated(Recorder.PhotonVoiceCreatedParams p)
        {
            var localVoice = p.Voice;

            if (localVoice.Info.Channels != 1)
            {
                throw new Exception("WebRTCAudioProcessor: only mono audio signals supported.");
            }
            if (!(localVoice is Voice.LocalVoiceAudioShort))
            {
                throw new Exception("WebRTCAudioProcessor: only short audio voice supported (Set PhotonVoiceRecorder.TypeConvert option).");
            }
            var v = (Voice.LocalVoiceAudioShort)localVoice;

            // can't access the AudioSettings properties in InitAEC if it's called from not main thread
            this.reverseChannels = new Dictionary <AudioSpeakerMode, int>()
            {
                { AudioSpeakerMode.Raw, 0 },
                { AudioSpeakerMode.Mono, 1 },
                { AudioSpeakerMode.Stereo, 2 },
                { AudioSpeakerMode.Quad, 4 },
                { AudioSpeakerMode.Surround, 5 },
                { AudioSpeakerMode.Mode5point1, 6 },
                { AudioSpeakerMode.Mode7point1, 8 },
                { AudioSpeakerMode.Prologic, 0 },
            }[AudioSettings.speakerMode];
            int playBufSize;
            int playBufNum;

            AudioSettings.GetDSPBufferSize(out playBufSize, out playBufNum);
            proc = new Voice.WebRTCAudioProcessor(new Voice.Unity.Logger(), localVoice.Info.FrameSize, localVoice.Info.SamplingRate, localVoice.Info.Channels, AudioSettings.outputSampleRate, this.reverseChannels);
            v.AddPostProcessor(proc);
            Debug.Log("WebRTCAudioDSP initialized.");
        }
        // Message sent by Recorder
        private void PhotonVoiceCreated(Recorder.PhotonVoiceCreatedParams p)
        {
            this.localVoice = p.Voice;

            if (this.localVoice.Info.Channels != 1)
            {
                if (this.Logger.IsErrorEnabled)
                {
                    this.Logger.LogError("Only mono audio signals supported.");
                }
                this.enabled = false;
                return;
            }
            if (!(this.localVoice is LocalVoiceAudioShort))
            {
                if (this.Logger.IsErrorEnabled)
                {
                    this.Logger.LogError("Only short audio voice supported (Set Recorder.TypeConvert option).");
                }
                this.enabled = false;
                return;
            }

            // can't access the AudioSettings properties in InitAEC if it's called from not main thread
            this.reverseChannels  = this.channelsMap[AudioSettings.speakerMode];
            this.outputSampleRate = AudioSettings.outputSampleRate;
            this.Init();
            LocalVoiceAudioShort v = this.localVoice as LocalVoiceAudioShort;

            v.AddPostProcessor(this.proc);
            this.SetOutputListener();
            if (this.Logger.IsInfoEnabled)
            {
                this.Logger.LogInfo("Initialized");
            }
        }