public string GetAudioFilename(LetterDataSoundType soundType = LetterDataSoundType.Phoneme) { // Debug.Log("GetAudioFilename " + Id + " " + Kind + " " + Type); switch (soundType) { case LetterDataSoundType.Phoneme: if (PhonemeSound != "") { return(PhonemeSound); } else { Debug.LogWarning("LetterData(): Requested Phone Sound is missing " + Id); return(""); } case LetterDataSoundType.Name: if (NameSound != "") { return(NameSound);; } else { Debug.LogWarning("LetterData(): Requested Name Sound is missing " + Id); return(""); } default: return(""); } }
public IAudioSource PlayVocabularyData(ILivingLetterData data, bool exclusive = false, bool isKeeper = true, bool autoClose = true, Action _callback = null, KeeperMode keeperMode = KeeperMode.Default, LetterDataSoundType soundType = LetterDataSoundType.Phoneme) { //Debug.LogWarning("Keeper playing Vocabulary " + data.Id); if (keeperMode == KeeperMode.Default) { keeperMode = AppManager.I.ParentEdition.DefaultKeeperMode; } bool withSubtitles = keeperMode == KeeperMode.LearningThenNativeAndSubtitles || keeperMode == KeeperMode.LearningAndSubtitles || keeperMode == KeeperMode.NativeAndSubtitles || keeperMode == KeeperMode.SubtitlesOnly; if (withSubtitles) { WidgetSubtitles.I.DisplayVocabularyData(data, 2, isKeeper); } if (!withSubtitles) { autoClose = false; } IAudioSource playingSource = null; switch (keeperMode) { case KeeperMode.LearningAndSubtitles: case KeeperMode.LearningNoSubtitles: playingSource = AudioManager.I.PlayVocabularyDataAudio(data, exclusive, soundType, LanguageUse.Learning, () => OnEndSpeaking(_callback, autoClose), true); break; case KeeperMode.NativeAndSubtitles: case KeeperMode.NativeNoSubtitles: playingSource = AudioManager.I.PlayVocabularyDataAudio(data, exclusive, soundType, LanguageUse.Native, () => OnEndSpeaking(_callback, autoClose), true); break; case KeeperMode.LearningThenNativeAndSubtitles: case KeeperMode.LearningThenNativeNoSubtitles: playingSource = AudioManager.I.PlayVocabularyDataAudio(data, exclusive, soundType, LanguageUse.Learning, () => { AudioManager.I.PlayVocabularyDataAudio(data, exclusive, soundType, LanguageUse.Native, () => OnEndSpeaking(_callback, autoClose), true); } , true); break; case KeeperMode.SubtitlesOnly: // Nothing, we must close manually break; default: throw new ArgumentOutOfRangeException(nameof(keeperMode), keeperMode, null); } return(playingSource); }
/// <summary> /// default values play Letter Phoneme /// </summary> /// <returns>The letter AudioClip</returns> /// <param name="data">Letter Data</param> /// <param name="exclusive">stops other letters?</param> /// <param name="soundType">Phoneme or Name?</param> public IAudioSource PlayLetter(LetterData data, bool exclusive = true, LetterDataSoundType soundType = LetterDataSoundType.Phoneme) { if (exclusive) { StopVocabularyGroup(); } AudioClip clip = GetAudioClip(data, soundType); return(new AudioSourceWrapper(vocabularyGroup.Play(clip), vocabularyGroup, this)); }
public AudioClip GetAudioClip(LetterData data, LetterDataSoundType soundType = LetterDataSoundType.Phoneme) { AudioClip res; var audiofile = data.GetAudioFilename(soundType); res = GetCachedResource("AudioArabic/Letters/" + audiofile); if (res == null) { Debug.LogWarning("Warning: cannot find audio clip for letter:" + data + " filename:" + audiofile); } return(res); }
public string GetAudioFilename(LetterDataSoundType soundType = LetterDataSoundType.Phoneme) { // Debug.Log("GetAudioFilename " + Id + " " + Kind + " " + Type); if (IsAccentedLetter()) { if (string.IsNullOrEmpty(PhonemeSound)) { PhonemeSound = AppManager.I.DB.GetLetterDataById(BaseLetter).PhonemeSound; } if (string.IsNullOrEmpty(NameSound)) { NameSound = AppManager.I.DB.GetLetterDataById(BaseLetter).NameSound; } if (string.IsNullOrEmpty(Sound)) { Sound = AppManager.I.DB.GetLetterDataById(BaseLetter).Sound; } if (string.IsNullOrEmpty(SoundZone)) { Sound = AppManager.I.DB.GetLetterDataById(BaseLetter).SoundZone; } } switch (soundType) { case LetterDataSoundType.Phoneme: if (PhonemeSound != "") { return(PhonemeSound); } else { Debug.LogWarning("LetterData(): Requested Phone Sound is missing " + Id); return(""); } case LetterDataSoundType.Name: if (NameSound != "") { return(NameSound);; } else { Debug.LogWarning("LetterData(): Requested Name Sound is missing " + Id); return(""); } default: return(""); } }
private void ShowLetter(LetterInfo letterInfo, LetterDataSoundType soundType = LetterDataSoundType.Name) { myLetterInfo = letterInfo; myLetterData = letterInfo.data; if (ApplicationConfig.I.VerboseBook) { Debug.Log("[ShowLetter]" + myLetterData.Number + " " + myLetterData.Id); } string positionsString = ""; foreach (var p in letterInfo.data.GetAvailableForms()) { positionsString = positionsString + " " + p; } MainLetterDisplay.Init(myLetterData); //LetterScoreText.text = "Score: " + myLetterInfo.score; HighlightDiacriticItem(myLetterData.Id); playSound(soundType); // Debug.Log(myLetterData.GetDebugDiacriticFix()); }
public IAudioSource PlayVocabularyData(ILivingLetterData data, bool exclusive = true, LetterDataSoundType soundType = LetterDataSoundType.Phoneme) { if (data.DataType == LivingLetterDataType.Letter) { return(AudioManager.I.PlayLetter((data as LL_LetterData).Data, exclusive, soundType)); } else if (data.DataType == LivingLetterDataType.Word) { return(AudioManager.I.PlayWord((data as LL_WordData).Data, exclusive)); } else if (data.DataType == LivingLetterDataType.Image) { return(AudioManager.I.PlayWord((data as LL_ImageData).Data, exclusive)); } else if (data.DataType == LivingLetterDataType.Phrase) { return(AudioManager.I.PlayPhrase((data as LL_PhraseData).Data, exclusive)); } return(null); }
private void playSound(LetterDataSoundType soundType) { AudioManager.I.PlayLetter(myLetterData, true, soundType); }
public IAudioSource PlayVocabularyData(ILivingLetterData data, bool exclusive = true, LetterDataSoundType soundType = LetterDataSoundType.Phoneme, System.Action callback = null, KeeperMode keeperMode = KeeperMode.LearningNoSubtitles, bool autoClose = true, bool isKeeper = false) { return(KeeperManager.I.PlayVocabularyData(data, exclusive, isKeeper: isKeeper, _callback: callback, autoClose: autoClose, keeperMode: keeperMode, soundType: soundType)); }