Skip to content

Commit

Permalink
追加: SynthesisEngine Core情報都度取得 (#803)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarepan authored Dec 4, 2023
1 parent 2160538 commit 8042b4b
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions voicevox_engine/synthesis_engine/synthesis_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,32 +228,32 @@ def calc_frame_phoneme(phonemes: List[OjtPhoneme], frame_per_phoneme: numpy.ndar


class SynthesisEngine(SynthesisEngineBase):
def __init__(
self,
core: CoreWrapper,
):
"""
speakers: coreから取得したspeakersに関するjsonデータの文字列
"""
"""音声合成器(core)の管理/実行/プロキシと音声合成フロー"""

def __init__(self, core: CoreWrapper):
super().__init__()
self.core = core
self._speakers = self.core.metas()
self.mutex = threading.Lock()
try:
self._supported_devices = self.core.supported_devices()
except OldCoreError:
self._supported_devices = None
self.default_sampling_rate = 24000

@property
def speakers(self) -> str:
return self._speakers
"""話者情報(json文字列)"""
# Coreプロキシ
return self.core.metas()

@property
def supported_devices(self) -> Optional[str]:
return self._supported_devices
def supported_devices(self) -> str | None:
"""デバイスサポート情報"""
# Coreプロキシ
try:
supported_devices = self.core.supported_devices()
except OldCoreError:
supported_devices = None
return supported_devices

def initialize_style_id_synthesis(self, style_id: int, skip_reinit: bool):
# Core管理
try:
with self.mutex:
# 以下の条件のいずれかを満たす場合, 初期化を実行する
Expand All @@ -265,6 +265,7 @@ def initialize_style_id_synthesis(self, style_id: int, skip_reinit: bool):
pass # コアが古い場合はどうしようもないので何もしない

def is_initialized_style_id_synthesis(self, style_id: int) -> bool:
# Coreプロキシ
try:
return self.core.is_model_loaded(style_id)
except OldCoreError:
Expand Down

0 comments on commit 8042b4b

Please sign in to comment.