TTMSFNCWXSpeechSynthesis Component Free extra-time and deployment requirements

Hello,
I'm using the TTMSFNCWXSpeechSynthesis component.
I have two questions:

  1. I create dynamically the component, it works as expected.
    (Speech := TTMSFNCWXSpeechSynthesis.create(Form1); Speech.Parent := Form1;)
    When I free the component, there is an extra-time of 5-6 seconds.
    (Speech.Free;)
    Even, if I don't use the component...
    This does not happen with the demo.
  2. When I deploy my application with this component, what should I include in my distribution?
    I have seen "WebView2Loader_x64.dll" & "WebView2Loader_x86.dll", is there anything else?
    Thanks for your help and best regards!

Hi,

I've not been able to reproduce this issue on our side. Would it be possible to share more details about the application and when you use the TTMSFNCWXSpeechSynthesis component.

Regarding your second question, you should indeed include both these DLL's.

Regarding the speech issue, write the simple program below.
I sent it by mail but received no answer...

With the codeSite trace, there is always 5s response time:

unit UnitSpeech;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, VCL.TMSFNCTypes, VCL.TMSFNCUtils,
VCL.TMSFNCGraphics, VCL.TMSFNCGraphicsTypes, Vcl.StdCtrls,
VCL.TMSFNCCustomControl, VCL.TMSFNCWebBrowser, VCL.TMSFNCCustomWEBControl,
VCL.TMSFNCCustomWEBComponent, VCL.TMSFNCWXSpeechSynthesis,
codesitelogging;

type
TForm4 = class(TForm)
Free: TButton;
Create: TButton;
Close: TButton;
procedure FreeClick(Sender: TObject);
procedure TMSFNCWXSpeechSynthesis1VoiceReady(Sender: TObject);
procedure TMSFNCWXSpeechSynthesis1Start(Sender: TObject);
procedure TMSFNCWXSpeechSynthesis1End(Sender: TObject);
procedure CreateClick(Sender: TObject);
procedure CloseClick(Sender: TObject);
end;

var
Form4: TForm4;
voiceready, started: boolean;
TMSFNCWXSpeechSynthesis1: TTMSFNCWXSpeechSynthesis = nil;

implementation

{$R *.dfm}

procedure TForm4.FreeClick(Sender: TObject);
begin
if TMSFNCWXSpeechSynthesis1 = nil then exit;
codesite.AddSeparator;

codesite.send('Free start');
TMSFNCWXSpeechSynthesis1.Free;
TMSFNCWXSpeechSynthesis1 := nil;

codesite.send('Free end');
end;

procedure TForm4.CloseClick(Sender: TObject);
begin
freeclick(sender);
end;

procedure TForm4.CreateClick(Sender: TObject);
begin

  if TMSFNCWXSpeechSynthesis1 <> nil then exit;

  TMSFNCWXSpeechSynthesis1 := TTMSFNCWXSpeechSynthesis.Create(form4);
  with  TMSFNCWXSpeechSynthesis1 do begin
          visible := false;
          parent := form4;
          onEnd  := TMSFNCWXSpeechSynthesis1End;
          onVoiceready := TMSFNCWXSpeechSynthesis1VoiceReady;
          onStart := TMSFNCWXSpeechSynthesis1Start;
  end;

end;

procedure TForm4.TMSFNCWXSpeechSynthesis1End(Sender: TObject);
begin
started := false;
end;

procedure TForm4.TMSFNCWXSpeechSynthesis1Start(Sender: TObject);
begin
started := true;
end;

procedure TForm4.TMSFNCWXSpeechSynthesis1VoiceReady(Sender: TObject);
begin
voiceready := true;
end;

end.

Hi, We have tried this without the use of CodeSite, and we didn't have this issue on our end. Can you check this in your application without the use of CodeSite?

I have found the problem, it comes from the unit VCL.TMSFNCWebBrowser.Win

I'm not very satisfied with the TMS support, I have sent a lot of messages with code, video and comments without any answer...

There is (~line 2235) a loop (50 times) to delete a EDGE web cache.

cnt := 1;
  while DirectoryExists(FFullCacheFolderName) do
  begin
    if cnt > 50 then
      Break;

    {$IFDEF LCLLIB}
    DeleteDirectory(FFullCacheFolderName, True);
    {$ELSE}
    TDirectory.Delete(FFullCacheFolderName, True);
    {$ENDIF}
    Inc(cnt);
    Sleep(1);
  end;

... and after 50 loops, the file still remains. But it takes more than 5 seconds to achieve.
Sometimes, after 3 loops, it success.

I presume that the Edge browser is not closed and inhibits the directory delete?

I see all messages here are answered. Where did you send other messages and maybe these included attachments that blocked delivery?

Can you check to manually delete this cache folder as maybe it holds files that are locked?
If you manually delete it first and then start, does it start as expected?

Sometimes, under certain circumstances, the directory is deleted...
The startup is always fine, the problem is when the component is released.
I changed the count to 3 max instead of 50. Temporary files are not deleted but I don't have this delay to close my form.
Anyway, if the directory is not deleted after 3-4 loops, it is not useful to continue the while...

Could other applications be locking files in this folder?

We'll look into this. For now disable to cache with

type
  TTMSFNCWXSpeechSynthesisOpen = class(TTMSFNCWXSpeechSynthesis);

procedure TForm23.FormCreate(Sender: TObject);
begin
  TTMSFNCWXSpeechSynthesisOpen(TMSFNCWXSpeechSynthesis1).AutoClearCache := False;
end;