Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit a365c57

Browse files
committed
Merge remote-tracking branch 'origin/bugfix-9941' into feature-revspeech_unicode
2 parents ba9249f + 3a7d349 commit a365c57

File tree

3 files changed

+16
-21
lines changed

3 files changed

+16
-21
lines changed

docs/notes/bugfix-9941.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Accented characters in string passed to revSpeak cause nothing to be spoken.

revspeech/src/osxspeech.cpp

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff 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

revspeech/src/osxspeech.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class OSXSpeechNarrator: public INarrator
5151
private:
5252
SpeechChannel spchannel;
5353
char speechvoice[255];
54-
char *speechbuffer;
54+
CFStringRef speechtext;
5555
Fixed speechspeed, speechpitch;
5656

5757
bool SpeechStart(bool StartInit);

0 commit comments

Comments
 (0)