public Dictionary <string, Voice> GetVoices() { if (voices.IsNullOrEmpty()) { voices = VoicesBuilder.ParseFile(Directory + Path.DirectorySeparatorChar + Filename, Encoding, voiceNames.Keys); } return(voices); }
public static Dictionary <string, Voice> GetVoices(SongMeta songMeta) { string path = songMeta.Directory + Path.DirectorySeparatorChar + songMeta.Filename; if (!voicesCache.TryGetValue(path, out CachedVoices cachedVoices)) { using (new DisposableStopwatch($"Loading voices of {path} took <millis> ms")) { Dictionary <string, Voice> voiceIdentifierToVoiceMap = VoicesBuilder.ParseFile(path, songMeta.Encoding, new List <string>()); cachedVoices = new CachedVoices(path, voiceIdentifierToVoiceMap); voicesCache.Add(path, cachedVoices); } } return(cachedVoices.VoiceIdentifierToVoiceMap); }
private Voice LoadVoice(SongMeta songMeta, string voiceIdentifier) { string filePath = songMeta.Directory + Path.DirectorySeparatorChar + songMeta.Filename; Debug.Log($"Loading voice of {filePath}"); Dictionary <string, Voice> voices = VoicesBuilder.ParseFile(filePath, songMeta.Encoding, new List <string>()); if (string.IsNullOrEmpty(voiceIdentifier)) { return(voices.Values.First()); } else { if (voices.TryGetValue(voiceIdentifier, out Voice loadedVoice)) { return(loadedVoice); } else { throw new Exception($"The song does not contain a voice for {voiceIdentifier}"); } } }
public Dictionary <string, Voice> GetVoices() { return(VoicesBuilder.ParseFile(Directory + Path.DirectorySeparatorChar + Filename, Encoding, VoiceNames.Keys)); }