mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 04:10:38 +00:00
Implement both ignoring all recognizers, but the ones specified and ignoring when app is not active.
This commit is contained in:
parent
efc901b79d
commit
4b1d3c679f
4 changed files with 107 additions and 2 deletions
|
@ -35,6 +35,7 @@
|
|||
@interface GSSpeechRecognitionServer : NSObject
|
||||
{
|
||||
GSSpeechRecognitionEngine *_engine;
|
||||
NSMutableArray *_blocking;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +43,13 @@
|
|||
*/
|
||||
+ (id)sharedServer;
|
||||
|
||||
// Start and stop processing....
|
||||
- (void) startListening;
|
||||
- (void) stopListening;
|
||||
|
||||
// Add or remove from blocking list...
|
||||
- (void) addToBlockingRecognizers: (NSString *)s;
|
||||
- (void) removeFromBlockingRecognizers: (NSString *)s;
|
||||
- (BOOL) isBlocking: (NSString *)s;
|
||||
|
||||
@end
|
||||
|
|
|
@ -100,7 +100,6 @@ static int _clients = 0;
|
|||
}
|
||||
|
||||
_engine = [GSSpeechRecognitionEngine defaultSpeechRecognitionEngine];
|
||||
|
||||
if (nil == _engine)
|
||||
{
|
||||
[self release];
|
||||
|
@ -110,10 +109,19 @@ static int _clients = 0;
|
|||
{
|
||||
NSLog(@"Got engine %@", _engine);
|
||||
}
|
||||
|
||||
|
||||
_blocking = [[NSMutableArray alloc] initWithCapacity: 10]; // 10 seems reasonable...
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_engine);
|
||||
RELEASE(_blocking);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) startListening
|
||||
{
|
||||
[_engine startListening];
|
||||
|
@ -124,4 +132,19 @@ static int _clients = 0;
|
|||
[_engine stopListening];
|
||||
}
|
||||
|
||||
- (void) addToBlockingRecognizers: (NSString *)s
|
||||
{
|
||||
[_blocking addObject: s];
|
||||
}
|
||||
|
||||
- (void) removeFromBlockingRecognizers: (NSString *)s
|
||||
{
|
||||
[_blocking removeObject: s];
|
||||
}
|
||||
|
||||
- (BOOL) isBlocking: (NSString *)s
|
||||
{
|
||||
return [_blocking containsObject: s];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue