示例#1
0
 private VoiceBackend CreateBackendFor(TTSBackend backendKind)
 {
     return(backendKind switch
     {
         TTSBackend.System => new SystemBackend(this.config),
         TTSBackend.Websocket => new WebsocketBackend(this.config, this.sharedState),
         TTSBackend.AmazonPolly => new AmazonPollyBackend(this.config),
         _ => throw new NotImplementedException(),
     });
示例#2
0
 public void SetBackend(TTSBackend backendKind)
 {
     _ = Task.Run(() =>
     {
         BackendLoading = true;
         var newBackend = CreateBackendFor(backendKind);
         var oldBackend = this.backend;
         this.backend   = newBackend;
         BackendLoading = false;
         oldBackend?.Dispose();
     });
 }