mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 14:20:54 +00:00
73 lines
1.3 KiB
Mathematica
73 lines
1.3 KiB
Mathematica
|
#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
|