void spd_CharacteristicReached(object sender, SpeechDataPlayer.SpeechCharacteristicReachedEventArgs e) { Console.WriteLine("Characteristic reached! " + e.characteristic); switch (e.characteristic.type) { case SpeechSoundDataStructures.SpeechData.SpeechCharacteristic.Types.Bookmark: SpeechSoundDataStructures.SpeechData.SpeechBookmark b = (SpeechSoundDataStructures.SpeechData.SpeechBookmark)e.characteristic; ThalamusPublisher.Bookmark(b.name); break; case SpeechSoundDataStructures.SpeechData.SpeechCharacteristic.Types.Viseme: SpeechSoundDataStructures.SpeechData.SpeechViseme v = (SpeechSoundDataStructures.SpeechData.SpeechViseme)e.characteristic; ThalamusPublisher.Viseme(v.value, v.nextViseme, v.percent, v.nextPercent); break; } }
//TODO May be better if asyncronous public void SpeakWaveFile(string speechData_serialized) { Console.WriteLine("SpeakWaveFile()"); SpeechDataPlayer spd = new SpeechDataPlayer(speechData_serialized); spd.Started += spd_started; spd.Finished += spd_finished; spd.CharacteristicReached += spd_CharacteristicReached; spd.Play(); }