private static string AudioToSayString(IAudio audio, string json) { string s = "Error converting prompt VoiceModel"; Type audioType = audio.GetType(); if (audioType == typeof(TtsMessage)) { s = ((TtsMessage)audio).message; } else if (audioType == typeof(TtsVariable)) { char[] delims = { '.' }; string varName = ((TtsVariable)audio).varName.Split(delims)[1]; var values = JsonConvert.DeserializeObject <Dictionary <string, string> >(json); try { s = values[varName]; } catch { s = "Could not find variable " + varName; }; } else if (audioType == typeof(Audio)) { s = "<?xml version='1.0'?><speak><audio src='" + ((Audio)audio).src + "'>" + ((Audio)audio).message + "</audio></speak>"; } else if (audioType == typeof(Silence)) { s = "<?xml version='1.0'?><speak><break time='" + ((Silence)audio).msPause.ToString() + "ms' /></speak>"; } return(s); }
private static Say AudioToSay(IAudio audio) { Say s = new Say("Error converting prompt VoiceModel"); switch (audio.GetType().ToString()) { case "VoiceModel.TtsMessage": s = new Say(((TtsMessage)audio).message); break; } return(s); }