/// <summary> /// キューの処理 /// </summary> protected void Consume() { while (true) { string text = ""; lock (queue) { // キューが空の場合、タスク終了 if (queue.Count == 0) { task = null; return; } // キューの取り出し text = queue.Dequeue(); if (string.IsNullOrWhiteSpace(text)) { continue; } } // 音声再生 var state = TalkService.Speak(text); state.Wait(); } }
/// <summary> /// Dispose /// </summary> protected virtual void Dispose(bool disposing) { if (task != null) { if (disposing) { lock (queue) { queue.Clear(); task = null; } TalkService.Stop(); } } }