/// <summary>
        /// Audio Input is encoded and processed to generate the wave file header.
        /// </summary>
        /// <param name="session">Conversation session state.</param>
        /// <param name="properties">AudioEncodingProperties for writing of wave file header.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public async Task InitializeFromAgentAsync(IAgentSessionWrapper session, AudioEncodingProperties properties)
        {
            this.agentSession   = session;
            this.outputEncoding = properties;
            this.graphRunning   = false;
            this.debugAudioOutputFileSemaphore = new SemaphoreSlim(1, 1);

            await this.PerformAudioSetupAsync();
        }
        private void OnSessionSignalConfirmed(IAgentSessionWrapper session, DetectionOrigin origin)
        {
            this.StopFailsafeTimer();

            this.logger.Log($"Confirmed signal received, IsUserAuthenticated={session.IsUserAuthenticated.ToString(null)}");
            if (!session.IsUserAuthenticated)
            {
                // This is a launch over the lock screen. It may be prudent to serialize state
                // and relaunch to ensure a fresh and accurate windowing layout.
                // https://docs.microsoft.com/en-us/uwp/api/windows.applicationmodel.core.coreapplication.requestrestartasync
            }

            this.SignalConfirmed?.Invoke(origin);
        }
 /// <summary>
 /// Creates an Audio Graph with defaultEncoding property to generate a generic wave file header.
 /// </summary>
 /// <param name="session">Conversation session state.</param>
 /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
 public async Task InitializeFromAgentSessionAsync(IAgentSessionWrapper session)
 {
     await this.InitializeFromAgentAsync(session, DefaultEncoding);
 }
 public Task <IAgentSessionWrapper> GetSessionAsync()
 {
     this.session = this.session ?? new MockAgentSessionWrapper();
     return(Task.FromResult(this.session));
 }