Beispiel #1
0
        // Toggle cache
        public void ToggleCache()
        {
            // Toggle to next option
            TTSDiskCacheLocation cacheLocation = GetCurrentCacheLocation();

            switch (cacheLocation)
            {
            case TTSDiskCacheLocation.Stream:
                cacheLocation = TTSDiskCacheLocation.Temporary;
                break;

            case TTSDiskCacheLocation.Temporary:
                cacheLocation = TTSDiskCacheLocation.Persistent;
                break;

            case TTSDiskCacheLocation.Persistent:
                cacheLocation = TTSDiskCacheLocation.Preload;
                break;

            default:
                cacheLocation = TTSDiskCacheLocation.Stream;
                break;
            }

            // Set next option
            _diskCache.DiskCacheDefaultSettings.DiskCacheLocation = cacheLocation;
            // Clear runtime cache
            TTSService.Instance.UnloadAll();

            // Refresh location
            RefreshLocation();
        }
Beispiel #2
0
        /// <summary>
        /// Logs for TTSService
        /// </summary>
        protected virtual void LogClip(string logMessage, TTSClipData clipData, TTSLogType logType = TTSLogType.Info)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendLine(logMessage);
            if (clipData != null)
            {
                builder.AppendLine($"Voice: {(clipData.voiceSettings == null ? "Default" : clipData.voiceSettings.settingsID)}");
                builder.AppendLine($"Text: {clipData.textToSpeak}");
                builder.AppendLine($"ID: {clipData.clipID}");
                TTSDiskCacheLocation cacheLocation = TTSDiskCacheLocation.Stream;
                if (DiskCacheHandler != null)
                {
                    TTSDiskCacheSettings settings = clipData.diskCacheSettings;
                    if (settings == null)
                    {
                        settings = DiskCacheHandler.DiskCacheDefaultSettings;
                    }
                    if (settings != null)
                    {
                        cacheLocation = settings.DiskCacheLocation;
                    }
                }
                builder.AppendLine($"Cache: {cacheLocation}");
            }
            Log(builder.ToString(), logType);
        }
Beispiel #3
0
 // Refresh location & button text
 private void RefreshLocation()
 {
     _cacheLocation   = GetCurrentCacheLocation();
     _cacheLabel.text = $"Disk Cache: {_cacheLocation}";
 }