mirror of
https://github.com/denizsafak/abogen.git
synced 2026-09-20 19:50:59 +02:00
unify voice caching: VoiceCache class used by both WebUI and PyQt
- domain/voice_loader.py: VoiceCache class now used by both UIs; resolve_voice() and load_voice_cached() accept VoiceCache or plain dict; added hasattr(pipeline, 'load_single_voice') safety check from WebUI - conversion_runner.py: replaced local _resolve_voice() with domain's resolve_voice(); voice_cache changed from Dict to VoiceCache instance; all cache access uses VoiceCache.get()/set() API - pyqt/conversion.py: self.voice_cache changed from Dict to VoiceCache - debug_tts_runner.py: imports resolve_voice from domain instead of removed _resolve_voice from conversion_runner
This commit is contained in:
@@ -44,7 +44,7 @@ from abogen.domain.audio_buffer import (
|
||||
SAMPLE_RATE,
|
||||
)
|
||||
from abogen.domain.subtitle_generation import process_subtitle_tokens
|
||||
from abogen.domain.voice_loader import load_voice_cached, resolve_voice
|
||||
from abogen.domain.voice_loader import VoiceCache, load_voice_cached, resolve_voice
|
||||
from abogen.domain.progress import calc_etr_str
|
||||
from abogen.domain.normalization import prepare_text_for_tts
|
||||
from abogen.domain.pronunciation import (
|
||||
@@ -295,7 +295,7 @@ class ConversionThread(QThread):
|
||||
self.use_spacy_segmentation = True # Default, will be overridden from GUI
|
||||
# Set split pattern based on language and subtitle mode
|
||||
self.split_pattern = get_split_pattern(lang_code, subtitle_mode)
|
||||
self.voice_cache = {} # Cache for loaded voices
|
||||
self.voice_cache = VoiceCache() # Cache for loaded voices
|
||||
|
||||
def load_voice_cached(self, voice_name, tts):
|
||||
"""Load voice with caching to avoid reloading same voice.
|
||||
|
||||
Reference in New Issue
Block a user