public static Word.Types.AudioCard ToAudioCard(Db.AudioClipsByWordId a) { var gender = a.SpeakerGender == Gender.MALE ? "男" : "女"; var hintPrimary = a.SpeakerAge.HasValue ? $"{a.SpeakerDisplayName} | {a.SpeakerAge} | {gender}" : $"{a.SpeakerDisplayName} | {gender}"; return(new Word.Types.AudioCard() { Pronunciation = a.Pronunciation, HintPrimary = hintPrimary, HintSecondary = a.SpeakerLocation ?? string.Empty, Audio = AudioResources.WithAudioClip(a.BlobLocation) }); }
public static ApiWord.Types.Pronunciation Create(string displayName, string yngping, AudioClip?audioClip = null) { var word = new ApiWord.Types.Pronunciation { DisplayName = displayName, Pronunciation_ = yngping, }; if (audioClip != null) { word.Audio = AudioResources.WithAudioClip(audioClip.BlobLocation); return(word); } if (YngpingTtsUtil.IsPronounceable(yngping)) { word.Audio = AudioResources.WithTtsUrls(yngping); } return(word); }