Changeset 364 for trunk/Cocoa/Pester/Source/PSSpeechAlert.m
- Timestamp:
- 11/28/07 01:29:26 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source/PSSpeechAlert.m
r102 r364 10 10 #import "PSAlarmAlertController.h" 11 11 #import "NSDictionary-NJRExtensions.h" 12 #import "SUSpeaker.h"13 12 14 13 // property list keys … … 52 51 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(_stopSpeaking:) name: PSAlarmAlertStopNotification object: nil]; 53 52 54 if ( (speaker = [[ SUSpeaker alloc] init]) == nil) return;53 if ( (speaker = [[NSSpeechSynthesizer alloc] initWithVoice: voice]) == nil) return; 55 54 alarm = anAlarm; 56 55 [speaker setDelegate: self]; 57 unsigned voiceIndex = [[SUSpeaker voiceNames] indexOfObject: voice]; 58 if (voiceIndex == NSNotFound) 59 voiceIndex = [[SUSpeaker voiceNames] indexOfObject: [SUSpeaker defaultVoice]]; 60 [speaker setVoice: voiceIndex + 1]; 61 [speaker speakText: [alarm message]]; 56 [speaker startSpeakingString: [alarm message]]; 62 57 } 63 58 … … 74 69 { 75 70 NSMutableDictionary *plAlert = [[super propertyListRepresentation] mutableCopy]; 71 if (voice == nil) 72 @throw [NSException exceptionWithName: NSInvalidArgumentException 73 reason: @"The selected voice is not available." userInfo: nil]; 76 74 [plAlert setObject: voice forKey: PLAlertVoice]; 77 75 return [plAlert autorelease]; … … 88 86 @end 89 87 90 @implementation PSSpeechAlert ( SUSpeakerDelegate)88 @implementation PSSpeechAlert (NSSpeechSynthesizerDelegate) 91 89 92 - (void) didFinishSpeaking:(SUSpeaker *)aSpeaker;90 - (void)speechSynthesizer:(NSSpeechSynthesizer *)sender didFinishSpeaking:(BOOL)finishedSpeaking; 93 91 { 94 92 [self completedForAlarm: alarm];
Note:
See TracChangeset
for help on using the changeset viewer.