Fix: ElevenLabsTTSService, change voice and model
This commit is contained in:
@@ -108,6 +108,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed an issue with `ElevenLabsTTSService` where changing the model or voice
|
||||||
|
while the service is running wasn't working.
|
||||||
|
|
||||||
- Fixed an issue that would cause multiple instances of the same class to behave
|
- Fixed an issue that would cause multiple instances of the same class to behave
|
||||||
incorrectly if any of the given constructor arguments defaulted to a mutable
|
incorrectly if any of the given constructor arguments defaulted to a mutable
|
||||||
value (e.g. lists, dictionaries, objects).
|
value (e.g. lists, dictionaries, objects).
|
||||||
|
|||||||
@@ -254,14 +254,16 @@ class ElevenLabsTTSService(AudioContextWordTTSService):
|
|||||||
async def set_model(self, model: str):
|
async def set_model(self, model: str):
|
||||||
await super().set_model(model)
|
await super().set_model(model)
|
||||||
logger.info(f"Switching TTS model to: [{model}]")
|
logger.info(f"Switching TTS model to: [{model}]")
|
||||||
# No need to disconnect/reconnect for model changes with multi-context API
|
await self._disconnect()
|
||||||
|
await self._connect()
|
||||||
|
|
||||||
async def _update_settings(self, settings: Mapping[str, Any]):
|
async def _update_settings(self, settings: Mapping[str, Any]):
|
||||||
prev_voice = self._voice_id
|
prev_voice = self._voice_id
|
||||||
await super()._update_settings(settings)
|
await super()._update_settings(settings)
|
||||||
# If voice changes, we don't need to reconnect, just use a new context
|
|
||||||
if not prev_voice == self._voice_id:
|
if not prev_voice == self._voice_id:
|
||||||
logger.info(f"Switching TTS voice to: [{self._voice_id}]")
|
logger.info(f"Switching TTS voice to: [{self._voice_id}]")
|
||||||
|
await self._disconnect()
|
||||||
|
await self._connect()
|
||||||
|
|
||||||
async def start(self, frame: StartFrame):
|
async def start(self, frame: StartFrame):
|
||||||
await super().start(frame)
|
await super().start(frame)
|
||||||
|
|||||||
Reference in New Issue
Block a user