mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
Make changes suggested by fred
This commit is contained in:
parent
e50bfcf35d
commit
92e00382c0
3 changed files with 13 additions and 11 deletions
|
@ -34,8 +34,7 @@
|
|||
|
||||
#import "AppKit/NSWorkspace.h"
|
||||
|
||||
id _speechRecognitionServer = nil;
|
||||
Class _speechRecognitionClass = nil;
|
||||
id _speechRecognitionServer = nil;
|
||||
BOOL _serverLaunchTested = NO;
|
||||
|
||||
#define SPEECH_RECOGNITION_SERVER @"GSSpeechRecognitionServer"
|
||||
|
@ -48,7 +47,6 @@ BOOL _serverLaunchTested = NO;
|
|||
|
||||
+ (void) initialize
|
||||
{
|
||||
_speechRecognitionClass = [NSSpeechRecognizer class];
|
||||
_speechRecognitionServer = [[NSConnection rootProxyForConnectionWithRegisteredName: SPEECH_RECOGNITION_SERVER
|
||||
host: nil] retain];
|
||||
if (nil == _speechRecognitionServer)
|
||||
|
@ -65,7 +63,7 @@ BOOL _serverLaunchTested = NO;
|
|||
NSString *word = (NSString *)[note object];
|
||||
NSEnumerator *en = [_commands objectEnumerator];
|
||||
id obj = nil;
|
||||
while((obj = [en nextObject]) != nil)
|
||||
while ((obj = [en nextObject]) != nil)
|
||||
{
|
||||
if ([[obj lowercaseString] isEqualToString: [word lowercaseString]])
|
||||
{
|
||||
|
@ -92,18 +90,19 @@ BOOL _serverLaunchTested = NO;
|
|||
|
||||
+ (id) allocWithZone: (NSZone *)aZone
|
||||
{
|
||||
if (self == _speechRecognitionClass)
|
||||
if (self == [NSSpeechRecognizer class])
|
||||
{
|
||||
if (nil == _speechRecognitionServer && !_serverLaunchTested)
|
||||
{
|
||||
unsigned int i=0;
|
||||
unsigned int i = 0;
|
||||
// Wait for up to five seconds for the server to launch, then give up.
|
||||
for (i=0 ; i<50 ; i++)
|
||||
for (i=0 ; i < 50 ; i++)
|
||||
{
|
||||
_speechRecognitionServer = [[NSConnection rootProxyForConnectionWithRegisteredName: SPEECH_RECOGNITION_SERVER
|
||||
host: nil] retain];
|
||||
if (nil != _speechRecognitionServer)
|
||||
{
|
||||
NSLog(@"No server!!!");
|
||||
break;
|
||||
}
|
||||
[NSThread sleepForTimeInterval: 0.1];
|
||||
|
|
|
@ -135,9 +135,9 @@ static Class NSSpeechSynthesizerClass;
|
|||
{
|
||||
if (nil == server && !serverLaunchTested)
|
||||
{
|
||||
unsigned int i=0;
|
||||
unsigned int i = 0;
|
||||
// Wait for up to five seconds for the server to launch, then give up.
|
||||
for (i=0 ; i<50 ; i++)
|
||||
for (i=0 ; i < 50 ; i++)
|
||||
{
|
||||
server = [NSConnection rootProxyForConnectionWithRegisteredName: @"GSSpeechServer"
|
||||
host: nil];
|
||||
|
|
|
@ -106,7 +106,8 @@ static const arg_t cont_args_def[] = {
|
|||
BOOL utt_started, in_speech;
|
||||
int32 k;
|
||||
char const *hyp;
|
||||
|
||||
|
||||
NSLog(@"************************* In recognize");
|
||||
if ((ad = ad_open_dev(cmd_ln_str_r(config, "-adcdev"),
|
||||
(int) cmd_ln_float32_r(config,
|
||||
"-samprate"))) == NULL)
|
||||
|
@ -174,10 +175,12 @@ static const arg_t cont_args_def[] = {
|
|||
|
||||
- (void) startListening
|
||||
{
|
||||
/*
|
||||
_listeningThread = [[NSThread alloc] initWithTarget: self
|
||||
selector: @selector(recognize)
|
||||
object: nil];
|
||||
[_listeningThread start];
|
||||
[_listeningThread start];*/
|
||||
[self recognize];
|
||||
}
|
||||
|
||||
- (void) stopListening
|
||||
|
|
Loading…
Reference in a new issue