diff --git a/voicevox_engine/app/routers/morphing.py b/voicevox_engine/app/routers/morphing.py index f3d587ef4..8e4274401 100644 --- a/voicevox_engine/app/routers/morphing.py +++ b/voicevox_engine/app/routers/morphing.py @@ -54,7 +54,7 @@ def morphable_targets( core = core_manager.get_core(core_version) try: - speakers = metas_store.load_combined_metas(core=core) + speakers = metas_store.load_combined_metas(core.speakers) morphable_targets = get_morphable_targets( speakers=speakers, base_style_ids=base_style_ids ) @@ -96,7 +96,7 @@ def _synthesis_morphing( core = core_manager.get_core(core_version) try: - speakers = metas_store.load_combined_metas(core=core) + speakers = metas_store.load_combined_metas(core.speakers) speaker_lookup = construct_lookup(speakers=speakers) is_permitted = is_synthesis_morphing_permitted( speaker_lookup, base_style_id, target_style_id diff --git a/voicevox_engine/app/routers/speaker.py b/voicevox_engine/app/routers/speaker.py index 01b7d7e42..344b5aa49 100644 --- a/voicevox_engine/app/routers/speaker.py +++ b/voicevox_engine/app/routers/speaker.py @@ -27,7 +27,8 @@ def generate_speaker_router( @router.get("/speakers") def speakers(core_version: str | None = None) -> list[Speaker]: """話者情報の一覧を取得します。""" - speakers = metas_store.load_combined_metas(core_manager.get_core(core_version)) + core = core_manager.get_core(core_version) + speakers = metas_store.load_combined_metas(core.speakers) return filter_speakers_and_styles(speakers, "speaker") @router.get("/speaker_info") @@ -136,7 +137,8 @@ def _speaker_info( @router.get("/singers") def singers(core_version: str | None = None) -> list[Speaker]: """歌手情報の一覧を取得します""" - singers = metas_store.load_combined_metas(core_manager.get_core(core_version)) + core = core_manager.get_core(core_version) + singers = metas_store.load_combined_metas(core.speakers) return filter_speakers_and_styles(singers, "singer") @router.get("/singer_info") diff --git a/voicevox_engine/metas/MetasStore.py b/voicevox_engine/metas/MetasStore.py index da8860334..db9b05722 100644 --- a/voicevox_engine/metas/MetasStore.py +++ b/voicevox_engine/metas/MetasStore.py @@ -5,7 +5,7 @@ from pydantic import BaseModel, Field -from voicevox_engine.core.core_adapter import CoreAdapter, CoreSpeakerStyle +from voicevox_engine.core.core_adapter import CoreSpeaker, CoreSpeakerStyle from voicevox_engine.metas.Metas import ( Speaker, SpeakerStyle, @@ -53,23 +53,8 @@ def __init__(self, engine_speakers_path: Path) -> None: for folder in engine_speakers_path.iterdir() } - # FIXME: engineではなくlist[CoreSpeaker]を渡す形にすることで - # TTSEngineによる循環importを修正する - def load_combined_metas(self, core: CoreAdapter) -> list[Speaker]: - """ - コアに含まれる話者メタ情報とエンジンに含まれる話者メタ情報を統合 - Parameters - ---------- - core : CoreAdapter - 話者メタ情報をもったコア - Returns - ------- - ret : list[Speaker] - エンジンとコアに含まれる話者メタ情報 - """ - # コアに含まれる話者メタ情報の収集 - core_metas = core.speakers - # エンジンに含まれる話者メタ情報との統合 + def load_combined_metas(self, core_metas: list[CoreSpeaker]) -> list[Speaker]: + """コアとエンジンのメタ情報を統合する。""" return [ Speaker( supported_features=self._loaded_metas[