This repository was archived by the owner on Aug 31, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +16
-21
lines changed
Expand file tree Collapse file tree 3 files changed +16
-21
lines changed Original file line number Diff line number Diff line change 1+ # Accented characters in string passed to revSpeak cause nothing to be spoken.
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ OSXSpeechNarrator::OSXSpeechNarrator(void)
3939{
4040 spchannel = NULL ;
4141 strcpy (speechvoice, " empty" );
42- speechbuffer = NULL ;
42+ speechtext = NULL ;
4343 speechspeed = 0 ;
4444 speechpitch = 0 ;
4545}
@@ -70,18 +70,11 @@ bool OSXSpeechNarrator::Start(const char* p_string)
7070 {
7171 return false ;
7272 }
73-
74- if (speechbuffer != nil)
75- {
76- if (spchannel != nil)
77- StopSpeech (spchannel);
78-
79- free (speechbuffer);
80- speechbuffer = nil;
81- }
82-
83- speechbuffer = strdup (p_string);
84- SpeakText (spchannel, speechbuffer, strlen (speechbuffer) + 1 );
73+
74+ if (speechtext != nil)
75+ CFRelease (speechtext);
76+ speechtext = CFStringCreateWithCString (kCFAllocatorDefault , p_string, kCFStringEncodingMacRoman );
77+ SpeakCFString (spchannel, speechtext, nil);
8578 return true ;
8679}
8780
@@ -268,13 +261,14 @@ bool OSXSpeechNarrator::SpeechStop(bool ReleaseInit)
268261 }
269262 while (SpeechBusy () > 0 );
270263
271- DisposeSpeechChannel (spchannel);
272- spchannel = nil;
273- if (speechbuffer != nil)
274- {
275- free (speechbuffer);
276- speechbuffer = nil;
277- }
264+ DisposeSpeechChannel (spchannel);
265+ spchannel = nil;
266+ if (speechtext != nil)
267+ {
268+ CFRelease (speechtext);
269+ speechtext = nil;
270+ }
271+
278272 return true ;
279273}
280274
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class OSXSpeechNarrator: public INarrator
5151private:
5252 SpeechChannel spchannel;
5353 char speechvoice[255 ];
54- char *speechbuffer ;
54+ CFStringRef speechtext ;
5555 Fixed speechspeed, speechpitch;
5656
5757 bool SpeechStart (bool StartInit);
You can’t perform that action at this time.
0 commit comments