mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 19:01:15 +00:00
More fixes to the recognizer
This commit is contained in:
parent
8320300fdd
commit
d3c1fd9724
6 changed files with 22 additions and 18 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
- (void) startListening;
|
||||
- (void) stopListening;
|
||||
- (void) recognize;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -18,4 +18,8 @@
|
|||
{
|
||||
}
|
||||
|
||||
- (void) recognize
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
@interface GSSpeechRecognitionServer : NSObject
|
||||
{
|
||||
GSSpeechRecognitionEngine *_engine;
|
||||
id<NSSpeechRecognizerDelegate> _delegate;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,7 +18,7 @@
|
|||
*/
|
||||
+ (id)sharedServer;
|
||||
|
||||
- (void) setDelegate: (id<NSSpeechRecognizerDelegate>) delegate;
|
||||
- (void) startListening;
|
||||
- (void) stopListening;
|
||||
|
||||
- (id<NSSpeechRecognizerDelegate>) delegate;
|
||||
@end
|
||||
|
|
|
@ -37,35 +37,28 @@ static GSSpeechRecognitionServer *sharedInstance;
|
|||
[self release];
|
||||
return nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Got engine %@", _engine);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)newRecognizer
|
||||
{
|
||||
return [[GSSpeechRecognizer new] autorelease];
|
||||
GSSpeechRecognizer *r = [[GSSpeechRecognizer alloc] init];
|
||||
RETAIN(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
- (void) startListening
|
||||
{
|
||||
// abstract nothing to do...
|
||||
[_engine startListening];
|
||||
}
|
||||
|
||||
- (void) stopListening
|
||||
{
|
||||
// abstract nothing to do...
|
||||
[_engine stopListening];
|
||||
}
|
||||
|
||||
- (void) setDelegate: (id<NSSpeechRecognizerDelegate>)delegate
|
||||
{
|
||||
_delegate = delegate;
|
||||
}
|
||||
|
||||
- (id<NSSpeechRecognizerDelegate>) delegate
|
||||
{
|
||||
return _delegate;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
@ -10,8 +10,9 @@ static int clients;
|
|||
@implementation GSSpeechRecognizer
|
||||
+ (void)initialize
|
||||
{
|
||||
server = [[GSSpeechRecognitionServer sharedServer] retain];
|
||||
server = [GSSpeechRecognitionServer sharedServer];
|
||||
|
||||
RETAIN(server);
|
||||
if (server != nil)
|
||||
{
|
||||
clients++;
|
||||
|
@ -58,12 +59,15 @@ static int clients;
|
|||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
NSLog(@"self = %@",self);
|
||||
RETAIN(server);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
NSLog(@"Deallocating recognizer....");
|
||||
clients--;
|
||||
if (clients == 0)
|
||||
{
|
||||
|
@ -78,6 +82,7 @@ static int clients;
|
|||
|
||||
- (void) startListening
|
||||
{
|
||||
NSLog(@"Start Listening");
|
||||
if (server != nil)
|
||||
{
|
||||
[server startListening];
|
||||
|
@ -86,6 +91,7 @@ static int clients;
|
|||
|
||||
- (void) stopListening
|
||||
{
|
||||
NSLog(@"Stop Listening");
|
||||
if (server != nil)
|
||||
{
|
||||
[server stopListening];
|
||||
|
|
|
@ -174,6 +174,7 @@ static const arg_t cont_args_def[] = {
|
|||
[[NSThread alloc] initWithTarget: self
|
||||
selector: @selector(recognize)
|
||||
object: nil];
|
||||
NSLog(@"Thread info for speech reconigtion server %@", _listeningThread);
|
||||
[_listeningThread start];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue