mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 04:50:47 +00:00
Fix speech recognizer compilation
This commit is contained in:
parent
75122ac78e
commit
b1f9f1fd78
9 changed files with 1 additions and 2 deletions
72
Tools/speech_recognizer/GSSpeechRecognitionServer.m
Normal file
72
Tools/speech_recognizer/GSSpeechRecognitionServer.m
Normal file
|
@ -0,0 +1,72 @@
|
|||
#import "GSSpeechServer.h"
|
||||
#import "GSSpeechEngine.h"
|
||||
#import "GSSpeechSynthesizer.h"
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
static GSSpeechServer *sharedInstance;
|
||||
|
||||
@implementation GSSpeechServer
|
||||
+ (void)initialize
|
||||
{
|
||||
sharedInstance = [self new];
|
||||
}
|
||||
+ (void)start
|
||||
{
|
||||
NSConnection *connection = [NSConnection defaultConnection];
|
||||
[connection setRootObject: sharedInstance];
|
||||
if (NO == [connection registerName: @"GSSpeechServer"])
|
||||
{
|
||||
return;
|
||||
}
|
||||
[[NSRunLoop currentRunLoop] run];
|
||||
}
|
||||
+ (id)sharedServer
|
||||
{
|
||||
return sharedInstance;
|
||||
}
|
||||
- (id)init
|
||||
{
|
||||
if (nil == (self = [super init])) { return nil; }
|
||||
engine = [GSSpeechEngine defaultSpeechEngine];
|
||||
if (nil == engine)
|
||||
{
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (id)newSynthesizer
|
||||
{
|
||||
return [[GSSpeechSynthesizer new] autorelease];
|
||||
}
|
||||
- (BOOL)startSpeakingString: (NSString*)aString notifyWhenDone: (id)client
|
||||
{
|
||||
[engine stopSpeaking];
|
||||
[engine startSpeaking: aString notifyWhenDone: client];
|
||||
return YES;
|
||||
}
|
||||
- (void)stopSpeaking
|
||||
{
|
||||
[engine stopSpeaking];
|
||||
}
|
||||
- (BOOL)isSpeaking
|
||||
{
|
||||
return [engine isSpeaking];
|
||||
}
|
||||
- (NSArray*)voices
|
||||
{
|
||||
return [engine voices];
|
||||
}
|
||||
- (oneway void)setVoice: (NSString*)aVoice
|
||||
{
|
||||
[engine setVoice: aVoice];
|
||||
}
|
||||
- (NSString*)voice
|
||||
{
|
||||
return [engine voice];
|
||||
}
|
||||
- (NSString*)defaultVoice
|
||||
{
|
||||
return [engine defaultVoice];
|
||||
}
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue