private void Initialize() { if (this.initialized) { if (this.Logger.IsWarningEnabled) { this.Logger.LogWarning("Already initialized."); } return; } if (this.Logger.IsDebugEnabled) { this.Logger.LogDebug("Initializing."); } #if USE_ONAUDIOFILTERREAD this.outBuffer = new AudioSyncBuffer <float>(this.Logger, string.Empty, this.Logger.IsInfoEnabled); this.outputSampleRate = AudioSettings.outputSampleRate; Func <IAudioOut <float> > factory = () => this.outBuffer; #else Func <IAudioOut <float> > factory = () => new UnityAudioOut(this.GetComponent <AudioSource>(), this.Logger, string.Empty, this.Logger.IsInfoEnabled); #endif #if !UNITY_EDITOR && (UNITY_PS4 || UNITY_SHARLIN) this.audioOutput = new Photon.Voice.PlayStation.PlayStationAudioOut(this.PlayStationUserID, factory); #else this.audioOutput = factory(); #endif this.initialized = true; if (this.Logger.IsDebugEnabled) { this.Logger.LogDebug("Initialized."); } }
protected override void Awake() { base.Awake(); #if USE_ONAUDIOFILTERREAD this.outBuffer = new AudioSyncBuffer <float>(this.Logger, string.Empty, this.Logger.IsInfoEnabled); this.outputSampleRate = AudioSettings.outputSampleRate; Func <IAudioOut <float> > factory = () => this.outBuffer; #else Func <IAudioOut <float> > factory = () => new UnityAudioOut(this.GetComponent <AudioSource>(), this.Logger, string.Empty, this.Logger.IsInfoEnabled); #endif #if !UNITY_EDITOR && UNITY_PS4 this.audioOutput = new Photon.Voice.PS4.PS4AudioOut(PS4UserID, factory); #else this.audioOutput = factory(); #endif this.initialized = true; if (!this.PlaybackOnlyWhenEnabled && this.IsLinked) { this.StartPlaying(); } }