[Adium-commits] adium 2033:896a4607f62f: Remove SUSpeaker, since it's no longer ...
adium-commits at adiumx.com
adium-commits at adiumx.com
Wed Apr 29 07:52:42 UTC 2009
details: http://hg.adiumx.com/adium/rev/896a4607f62f
revision: 2033:896a4607f62f
author: David Smith <catfish.man at gmail.com>
date: Wed Apr 29 00:20:45 2009 -0700
Remove SUSpeaker, since it's no longer useful as of 10.5
Subject: adium 2034:cad730aa0401: As a Cocoa app, we don't need to do this. The Info.plist keys are enough. See http://developer.apple.com/documentation/Carbon/Conceptual/ProvidingUserAssitAppleHelp/registering_help/registering_help.html#//apple_ref/doc/uid/TP30000903-CH207-CHDGHHDF
details: http://hg.adiumx.com/adium/rev/cad730aa0401
revision: 2034:cad730aa0401
author: David Smith <catfish.man at gmail.com>
date: Wed Apr 29 00:29:57 2009 -0700
As a Cocoa app, we don't need to do this. The Info.plist keys are enough. See http://developer.apple.com/documentation/Carbon/Conceptual/ProvidingUserAssitAppleHelp/registering_help/registering_help.html#//apple_ref/doc/uid/TP30000903-CH207-CHDGHHDF
Subject: adium 2035:269b47dc0d33: Remove redundant imports and 10.1 compatibility code
details: http://hg.adiumx.com/adium/rev/269b47dc0d33
revision: 2035:269b47dc0d33
author: David Smith <catfish.man at gmail.com>
date: Wed Apr 29 00:49:14 2009 -0700
Remove redundant imports and 10.1 compatibility code
Subject: adium 2036:0db8c654ce7f: Log if this ever happens... I doubt it will
details: http://hg.adiumx.com/adium/rev/0db8c654ce7f
revision: 2036:0db8c654ce7f
author: David Smith <catfish.man at gmail.com>
date: Wed Apr 29 00:52:22 2009 -0700
Log if this ever happens... I doubt it will
diffstat:
Adium.xcodeproj/project.pbxproj | 8 -
Frameworks/Adium Framework/Source/AISoundControllerProtocol.h | 9 +-
Frameworks/Adium Framework/Source/SUSpeaker.h | 59 --
Frameworks/Adium Framework/Source/SUSpeaker.m | 366 -------------
Frameworks/ShortcutRecorder/Source/SRKeyCodeTransformer.m | 2 -
Source/AIAdium.m | 22 -
Source/AISoundController.m | 13 +-
Source/AdiumSpeech.h | 27 +-
Source/AdiumSpeech.m | 149 +---
Source/ESAnnouncerAbstractDetailPane.m | 71 +-
Source/ESAnnouncerPlugin.m | 4 +-
Source/PTHotKeyCenter.h | 4 -
Source/PTHotKeyCenter.m | 47 +-
Source/PTKeyCodeTranslator.h | 2 -
Source/PTKeyCombo.m | 3 -
15 files changed, 101 insertions(+), 685 deletions(-)
diffs (truncated from 1223 to 1000 lines):
diff -r 2d9a0ce2e3db -r 0db8c654ce7f Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj Tue Apr 28 22:31:43 2009 -0700
+++ b/Adium.xcodeproj/project.pbxproj Wed Apr 29 00:52:22 2009 -0700
@@ -946,8 +946,6 @@
34DC8B040A7EEEF7003E1636 /* ESFileWrapperExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 34F2E83807C2CDBD007EAAAB /* ESFileWrapperExtension.m */; };
34DC8B090A7EEEF7003E1636 /* JVFontPreviewField.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D8344C07CBE6E2006466F2 /* JVFontPreviewField.m */; };
34DC8B0A0A7EEEF7003E1636 /* JVFontPreviewField.h in Headers */ = {isa = PBXBuildFile; fileRef = 34D8344D07CBE6E2006466F2 /* JVFontPreviewField.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 34DC8B130A7EEEF7003E1636 /* SUSpeaker.h in Headers */ = {isa = PBXBuildFile; fileRef = 34D8346C07CBE6F4006466F2 /* SUSpeaker.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 34DC8B140A7EEEF7003E1636 /* SUSpeaker.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D8346B07CBE6F4006466F2 /* SUSpeaker.m */; };
34DFF5FD07A63DB400B92233 /* ESSecureMessagingPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 34DFF46107A5EABF00B92233 /* ESSecureMessagingPlugin.m */; };
34E036720A75AA4F00394F11 /* CBOscarService.h in Headers */ = {isa = PBXBuildFile; fileRef = 34B919C9062DEF15004F1223 /* CBOscarService.h */; };
34E036730A75AA4F00394F11 /* CBOscarService.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B919CA062DEF15004F1223 /* CBOscarService.m */; };
@@ -3617,8 +3615,6 @@
34D8336E07CBD807006466F2 /* pref-advanced.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "pref-advanced.png"; path = "Resources/pref-advanced.png"; sourceTree = "<group>"; };
34D8344C07CBE6E2006466F2 /* JVFontPreviewField.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = JVFontPreviewField.m; path = "Frameworks/Adium Framework/Source/JVFontPreviewField.m"; sourceTree = "<group>"; };
34D8344D07CBE6E2006466F2 /* JVFontPreviewField.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JVFontPreviewField.h; path = "Frameworks/Adium Framework/Source/JVFontPreviewField.h"; sourceTree = "<group>"; };
- 34D8346B07CBE6F4006466F2 /* SUSpeaker.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = SUSpeaker.m; path = "Frameworks/Adium Framework/Source/SUSpeaker.m"; sourceTree = "<group>"; };
- 34D8346C07CBE6F4006466F2 /* SUSpeaker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SUSpeaker.h; path = "Frameworks/Adium Framework/Source/SUSpeaker.h"; sourceTree = "<group>"; };
34D8B3D60D15A40C0066F013 /* fr_CA */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = fr_CA; path = Resources/fr_CA.lproj/Statuses.strings; sourceTree = "<group>"; };
34DC84280A7EA012003E1636 /* nl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = nl; path = Resources/nl.lproj/ESFileTransferProgressView.nib; sourceTree = "<group>"; };
34DFF46007A5EABF00B92233 /* ESSecureMessagingPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ESSecureMessagingPlugin.h; path = "Plugins/Secure Messaging/ESSecureMessagingPlugin.h"; sourceTree = "<group>"; };
@@ -6126,8 +6122,6 @@
children = (
34D834CD07CBE7A3006466F2 /* Text field for previewing font preferences */,
34A6FE8007D7E07300972830 /* Type Select Table View */,
- 34D8346C07CBE6F4006466F2 /* SUSpeaker.h */,
- 34D8346B07CBE6F4006466F2 /* SUSpeaker.m */,
348B25C70A50FBF300B2B972 /* KNShelfSplitView.h */,
348B25C60A50FBF300B2B972 /* KNShelfSplitView.m */,
340670790A55A044004E22AC /* sourceListBackground.png */,
@@ -8981,7 +8975,6 @@
34DC8B010A7EEEF7003E1636 /* ESFileTransfer.h in Headers */,
34DC8B030A7EEEF7003E1636 /* ESFileWrapperExtension.h in Headers */,
34DC8B0A0A7EEEF7003E1636 /* JVFontPreviewField.h in Headers */,
- 34DC8B130A7EEEF7003E1636 /* SUSpeaker.h in Headers */,
343700A70A9C1E170028604E /* AIAdvancedPreferencePane.h in Headers */,
3482E0F50AB5064E00471992 /* AIAdiumProtocol.h in Headers */,
34F312930ADC3FE800A4310E /* KNShelfSplitView.h in Headers */,
@@ -10481,7 +10474,6 @@
34DC8B020A7EEEF7003E1636 /* ESFileTransfer.m in Sources */,
34DC8B040A7EEEF7003E1636 /* ESFileWrapperExtension.m in Sources */,
34DC8B090A7EEEF7003E1636 /* JVFontPreviewField.m in Sources */,
- 34DC8B140A7EEEF7003E1636 /* SUSpeaker.m in Sources */,
343700A80A9C1E170028604E /* AIAdvancedPreferencePane.m in Sources */,
34F312F00ADC476300A4310E /* KNShelfSplitView.m in Sources */,
3470BF610BC6F18500388232 /* AIMessageHistoryPreferencesWindowController.m in Sources */,
diff -r 2d9a0ce2e3db -r 0db8c654ce7f Frameworks/Adium Framework/Source/AISoundControllerProtocol.h
--- a/Frameworks/Adium Framework/Source/AISoundControllerProtocol.h Tue Apr 28 22:31:43 2009 -0700
+++ b/Frameworks/Adium Framework/Source/AISoundControllerProtocol.h Wed Apr 29 00:52:22 2009 -0700
@@ -17,12 +17,11 @@
- (void)stopPlayingSoundAtPath:(NSString *)inPath;
//Speech
- at property (nonatomic, readonly) NSArray *voices;
-- (void)speakDemoTextForVoice:(NSString *)voiceString withPitch:(CGFloat)pitch andRate:(CGFloat)rate;
- at property (nonatomic, readonly) CGFloat defaultRate;
- at property (nonatomic, readonly) CGFloat defaultPitch;
+- (void)speakDemoTextForVoice:(NSString *)voiceString withPitch:(float)pitch andRate:(float)rate;
+ at property (nonatomic, readonly) float defaultRate;
+ at property (nonatomic, readonly) float defaultPitch;
- (void)speakText:(NSString *)text;
-- (void)speakText:(NSString *)text withVoice:(NSString *)voiceString pitch:(CGFloat)pitch rate:(CGFloat)rate;
+- (void)speakText:(NSString *)text withVoice:(NSString *)voiceString pitch:(float)pitch rate:(float)rate;
//Soundsets
@property (nonatomic, readonly) NSArray *soundSets;
diff -r 2d9a0ce2e3db -r 0db8c654ce7f Frameworks/Adium Framework/Source/SUSpeaker.h
--- a/Frameworks/Adium Framework/Source/SUSpeaker.h Tue Apr 28 22:31:43 2009 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-//
-// SUSpeaker.h
-//
-// Created by raf on Sun Jan 28 2001.
-// Based on SpeechUtilities framework by Raphael Sebbe.
-// Revised by Evan Schoenberg on Tue Sep 30 2003.
-// Optimized and expanded by Evan Schoenberg.
-
-#import <Foundation/Foundation.h>
-#import <Carbon/Carbon.h>
-
-/*!
- * @class SUSpeaker
- * @brief Cocoa wrapper for the Carbon Speech Synthesis Manager
- */
- at interface SUSpeaker : NSObject
-{
- SpeechChannel _speechChannel;
- id _delegate;
- NSPort *_port;
-
- BOOL _usePort;
- unsigned int _reserved1;
- unsigned int _reserved2;
-}
-
-+ (NSArray *)voiceNames;
-//+(NSString*) defaultVoiceName;
-
-//pitch is in Hertz.
-- (void) setPitch:(float)pitch;
-- (float) pitch;
-//rate is in words per minute.
-- (void) setRate:(float)rate;
-- (float) rate;
-
--(void)setVolume:(float)vol;
-
-//voice is an index into +voiceNames. pass -1 for the default voice.
-- (void) setVoiceUsingIndex:(int)index;
-
-- (void) speakText:(NSString*)text;
-- (void) stopSpeaking;
-- (BOOL) isSpeaking;
-
-- (void) resetToDefaults;
-
-//e.g., for Bad News: 'The light you see at the end of the tunnel is the headlamp of a fast approaching train.' (remember that Bad News is a singing voice...)
-- (NSString *)demoTextForVoiceAtIndex:(int)voiceIndex;
-
--(void) setDelegate:(id)delegate;
--(id) delegate;
-
- at end
-
- at interface NSObject (SUSpeakerDelegate)
--(void) didFinishSpeaking:(SUSpeaker*)speaker;
--(void) willSpeakWord:(SUSpeaker*)speaker at:(int)where length:(int)length;
- at end
diff -r 2d9a0ce2e3db -r 0db8c654ce7f Frameworks/Adium Framework/Source/SUSpeaker.m
--- a/Frameworks/Adium Framework/Source/SUSpeaker.m Tue Apr 28 22:31:43 2009 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,366 +0,0 @@
-//
-// SUSpeaker.m
-//
-// Created by raf on Sun Jan 28 2001.
-// Based on SpeechUtilities framework by Raphael Sebbe.
-// Optimized and expanded by Evan Schoenberg.
-
-#import <Adium/SUSpeaker.h>
-#include <unistd.h>
-#include <pthread.h>
-
-void MySpeechDoneCallback(SpeechChannel chan,SRefCon refCon);
-void MySpeechWordCallback (SpeechChannel chan, SRefCon refCon, UInt32 wordPos,
- UInt16 wordLen);
-
- at interface SUSpeaker ()
--(void)createNewSpeechChannelForVoice:(VoiceSpec *)voice;
--(NSPort*) port;
--(void)setReserved1:(unsigned int)r;
--(void)setReserved2:(unsigned int)r;
--(BOOL) usesPort;
--(void)handleMessage:(unsigned)msgid;
- at end
-
- at implementation SUSpeaker
-
--init
-{
- if ((self = [super init])) {
- // we have 2 options here : we use a port or we don't.
- // using a port means delegate message are invoked from the main
- // thread (runloop in which this object is created), otherwise, those message
- // are asynchronous.
- NSRunLoop *loop = [NSRunLoop currentRunLoop];
- if (loop != nil) {
- _port = [[NSPort port] retain];
- // we use a port so that the speech manager callbacks can talk to the main thread.
- // That way, we can safely access interface elements from the delegate methods
-
- [_port setDelegate:self];
- [loop addPort:_port forMode:NSDefaultRunLoopMode];
- _usePort = YES;
- } else {
- _usePort = NO;
- }
-
- _speechChannel = NULL;
-
- // NULL voice is default voice
- [self createNewSpeechChannelForVoice:NULL];
- }
-
- return self;
-}
-
--(void)dealloc
-{
- [_port release];
- if (_speechChannel != NULL) {
- [self stopSpeaking];
- DisposeSpeechChannel(_speechChannel);
- }
-
- [super dealloc];
-}
-
--(void)resetToDefaults
-{
- if (_speechChannel != NULL) {
- StopSpeech(_speechChannel);
- SetSpeechInfo(_speechChannel, soReset, NULL);
- }
-}
-
-//---Pitch
-/* "Sets the pitch. Pitch is given in Hertz and should be comprised between 80 and 500, depending on the voice.
-Note that extreme value can make your app crash..." */
--(void)setPitch:(float)pitch
-{
- pitch = (pitch-90.0)/(300.0-90.0)*(65.0 - 30.0) + 30.0; //conversion from hertz
- /* I don't know what Apple means with pitch between 30 and 65, so I convert that range to [90, 300].
- I did not test frequencies correspond, though. */
-
- if (_speechChannel) SetSpeechPitch (_speechChannel, FloatToFixed(pitch));
-}
--(float)pitch
-{
- Fixed fixedPitch = 0;
- if (_speechChannel) GetSpeechInfo(_speechChannel, soPitchBase, &fixedPitch);
-
- //perform needed conversion to reasonable numbers
- return (FixedToFloat(fixedPitch) - 30.0)*(210.0/35.0) + 90.0;
-}
-
-//---Rate
-//normal is 150 to 220
--(void)setRate:(float)rate
-{
- if (_speechChannel) SetSpeechRate(_speechChannel, FloatToFixed(rate));
-}
--(float)rate
-{
- Fixed fixedRate = 0;
- if (_speechChannel) GetSpeechInfo(_speechChannel, soRate, &fixedRate);
-
- return FixedToFloat(fixedRate);
-}
-
-//---Volume
--(void)setVolume:(float)vol
-{
- Fixed fixedVolume = FloatToFixed(vol);
- if(_speechChannel != NULL)
- SetSpeechInfo(_speechChannel, soVolume, &fixedVolume);
-}
-
-//---Voice
-//set index=-1 for default voice
--(void)setVoiceUsingIndex:(int)index
-{
- VoiceSpec voice;
- OSErr error = noErr;
-
- if (index >= 0) {
- error = GetIndVoice(index+1, &voice);
- if (error == noErr) {
- if (_speechChannel) {
- if ([self isSpeaking]) {
- [self stopSpeaking];
- }
-
- error = SetSpeechInfo(_speechChannel, soCurrentVoice, &voice);
- /* If SetSpeechInfo() returns incompatibleVoice, we need to use a new speech channel, as the
- * synthesizer must have changed
- */
- if (error == incompatibleVoice) {
- [self createNewSpeechChannelForVoice:&voice];
- }
-
- } else {
- [self createNewSpeechChannelForVoice:&voice];
- }
- }
- }
-}
-
-/*"Returns the voice names in the same order as expected by setVoice:."*/
-+(NSArray*)voiceNames
-{
- NSMutableArray *voices = nil;
- short voiceCount;
- OSErr error = noErr;
- int voiceIndex;
-
- error = CountVoices(&voiceCount);
- if (error != noErr) return voices;
-
- voices = [NSMutableArray arrayWithCapacity:voiceCount];
- for (voiceIndex=0; voiceIndex<voiceCount; voiceIndex++) {
- VoiceSpec voiceSpec;
- VoiceDescription voiceDescription;
-
- error = GetIndVoice(voiceIndex+1, &voiceSpec);
- if (error != noErr) return voices;
- error = GetVoiceDescription( &voiceSpec, &voiceDescription, sizeof(voiceDescription));
- if (error == noErr) {
- NSString *voiceName = [[NSString alloc] initWithBytes:(const char *)&(voiceDescription.name[1]) length:voiceDescription.name[0] encoding:NSMacOSRomanStringEncoding];
- [voices addObject:voiceName];
- [voiceName release];
- } else {
- return voices;
- }
- }
- return voices;
-}
-/*
-+(NSString*)defaultVoiceName
-{
- VoiceSpec voiceSpec;
- VoiceDescription voiceDescription;
-
- GetIndVoice(0, &voiceSpec);
- GetVoiceDescription( &voiceSpec, &voiceDescription, sizeof(voiceDescription));
- return [[[NSString alloc] initWithBytes:(const char *)&(voiceDescription.name[1]) length:voiceDescription.name[0] encoding:NSMacOSRomanStringEncoding] autorelease];
-}*/
-
-
-//setVolume: SetSpeechInfo(_speechChannel, soCurrentVoice, ????);
-
-//---Speech
--(void)speakText:(NSString*)text
-{
- if (_speechChannel && text) {
- if ([self isSpeaking]) {
- [self stopSpeaking];
- }
-
- NSData *data = [text dataUsingEncoding:NSMacOSRomanStringEncoding allowLossyConversion:YES];
- SpeakText(_speechChannel, [data bytes], [data length]);
- }
-}
--(void)stopSpeaking
-{
- if (_speechChannel) {
- StopSpeech(_speechChannel);
- if ([_delegate respondsToSelector:@selector(didFinishSpeaking:)]) {
- [_delegate didFinishSpeaking:self];
- }
- }
-}
--(BOOL)isSpeaking {
- if (!_speechChannel) return NO;
-
- struct SpeechStatusInfo status;
- OSStatus err = GetSpeechInfo(_speechChannel, soStatus, &status);
- if (err != noErr) {
- NSLog(@"in -isSpeaking, GetSpeechInfo returned %li", (long)err);
- return NO;
- } else {
- return status.outputBusy;
- }
-}
-
--(NSString *)demoTextForVoiceAtIndex:(int)voiceIndex
-{
- NSString *demoText = nil;
- OSErr error = noErr;
-
- VoiceSpec voiceSpec;
- VoiceDescription voiceDescription;
-
- if (voiceIndex >= 0) {
- error = GetIndVoice(voiceIndex+1, &voiceSpec);
- if (error == noErr) {
- error = GetVoiceDescription( &voiceSpec, &voiceDescription, sizeof(voiceDescription));
- }
- } else {
- error = GetVoiceDescription( NULL, &voiceDescription, sizeof(voiceDescription));
- }
-
-
- if (error == noErr) {
- demoText = [[[NSString alloc] initWithBytes:(const char *)&(voiceDescription.comment[1])
- length:voiceDescription.comment[0]
- encoding:NSMacOSRomanStringEncoding] autorelease];
- }
-
- return demoText;
-}
-
-//---Delegate
--(void)setDelegate:(id)delegate
-{
- _delegate = delegate;
-}
--(id) delegate
-{
- return _delegate;
-}
-
-
-//--- Private ---
--(void)createNewSpeechChannelForVoice:(VoiceSpec *)voice
-{
- OSErr error;
-
- if (_speechChannel) {
- if ([self isSpeaking]) {
- [self stopSpeaking];
- }
- DisposeSpeechChannel(_speechChannel);
- _speechChannel = NULL;
- }
-
- error = NewSpeechChannel(voice, &_speechChannel);
-
- if (error == noErr) {
- SetSpeechInfo(_speechChannel, soSpeechDoneCallBack, &MySpeechDoneCallback);
- SetSpeechInfo(_speechChannel, soWordCallBack, &MySpeechWordCallback);
- SetSpeechInfo(_speechChannel, soRefCon, (const void*)self);
- }
-}
-
--(void)setReserved1:(unsigned int)r
-{
- _reserved1 = r;
-}
--(void)setReserved2:(unsigned int)r
-{
- _reserved2 = r;
-}
--(NSPort*) port
-{
- return _port;
-}
--(BOOL) usesPort
-{
- return _usePort;
-}
--(void)handleMessage:(unsigned)msgid
-{
- if (msgid == 5) {
- if ([_delegate respondsToSelector:@selector(willSpeakWord:at:length:)]) {
- if (_reserved1 >= 0 && _reserved2 >= 0)
- [_delegate willSpeakWord:self at:_reserved1 length:_reserved2];
- else
- [_delegate willSpeakWord:self at:0 length:0];
- }
- } else if (msgid == 8) {
- //Notify our delegate that we finished
- if ([_delegate respondsToSelector:@selector(didFinishSpeaking:)]) {
- [_delegate didFinishSpeaking:self];
- }
- }
-}
-//--- NSPort delegate ---
-- (void)handlePortMessage:(NSPortMessage *)portMessage
-{
- int msg = [portMessage msgid];
-
- [self handleMessage:msg];
-}
-
- at end
-
-void MySpeechDoneCallback(SpeechChannel chan,SRefCon refCon)
-{
- SUSpeaker *speaker = (SUSpeaker*)refCon;
- unsigned msg = 8;
-
- if ([speaker isKindOfClass:[SUSpeaker class]]) {
- if ([speaker usesPort]) {
- NSPortMessage *message = [[NSPortMessage alloc] initWithSendPort:[speaker port]
- receivePort:[speaker port] components:nil];
-
- [message setMsgid:msg];
- [message sendBeforeDate:nil];
- [message release];
- } else {
- // short-circuit port
- [speaker handleMessage:msg];
- }
- }
-}
-void MySpeechWordCallback(SpeechChannel chan, SRefCon refCon, UInt32 wordPos,UInt16 wordLen)
-{
- SUSpeaker *speaker = (SUSpeaker*)refCon;
- unsigned msg = 5;
-
- if ([speaker isKindOfClass:[SUSpeaker class]]) {
- [speaker setReserved1:wordPos];
- [speaker setReserved2:wordLen];
-
- if ([speaker usesPort]) {
- NSPortMessage *message = [[NSPortMessage alloc] initWithSendPort:[speaker port]
- receivePort:[speaker port] components:nil];
-
- [message setMsgid:msg];
- [message sendBeforeDate:nil];
- [message release];
- } else {
- // short-circuit port
- [speaker handleMessage:msg];
- }
- }
-}
diff -r 2d9a0ce2e3db -r 0db8c654ce7f Frameworks/ShortcutRecorder/Source/SRKeyCodeTransformer.m
--- a/Frameworks/ShortcutRecorder/Source/SRKeyCodeTransformer.m Tue Apr 28 22:31:43 2009 -0700
+++ b/Frameworks/ShortcutRecorder/Source/SRKeyCodeTransformer.m Wed Apr 29 00:52:22 2009 -0700
@@ -12,8 +12,6 @@
// Jamie Kirkpatrick
#import "SRKeyCodeTransformer.h"
-#import <Carbon/Carbon.h>
-#import <CoreServices/CoreServices.h>
#import "SRCommon.h"
#import "PTKeyCodeTranslator.h"
diff -r 2d9a0ce2e3db -r 0db8c654ce7f Source/AIAdium.m
--- a/Source/AIAdium.m Tue Apr 28 22:31:43 2009 -0700
+++ b/Source/AIAdium.m Wed Apr 29 00:52:22 2009 -0700
@@ -51,8 +51,6 @@
#import <Adium/AIContactHidingController.h>
#import <Sparkle/Sparkle.h>
#import "ESAddressBookIntegrationAdvancedPreferences.h"
-//For Apple Help
-#import <Carbon/Carbon.h>
#import <Adium/AdiumAuthorization.h>
#ifdef DEBUG_BUILD
@@ -74,7 +72,6 @@
@interface AIAdium ()
- (void)completeLogin;
- (void)openAppropriatePreferencesIfNeeded;
-- (void)configureHelp;
- (void)deleteTemporaryFiles;
@end
@@ -261,8 +258,6 @@
}
completedApplicationLoad = YES;
-
- [self configureHelp];
[[NSDistributedNotificationCenter defaultCenter] addObserver:self
selector:@selector(systemTimeZoneDidChange:)
@@ -1038,23 +1033,6 @@
return handleKey;
}
-#pragma mark Help
-- (void)configureHelp
-{
- CFBundleRef myApplicationBundle;
- FSRef myBundleRef;
-
- if ((myApplicationBundle = CFBundleGetMainBundle())) {
- CFURLRef myBundleURL = CFBundleCopyBundleURL(myApplicationBundle);
-
- if (CFURLGetFSRef(myBundleURL, &myBundleRef)) {
- AHRegisterHelpBook(&myBundleRef);
- }
-
- CFRelease(myBundleURL);
- }
-}
-
#pragma mark Sparkle Delegate Methods
#define NIGHTLY_UPDATE_DICT [NSDictionary dictionaryWithObjectsAndKeys:@"type", @"key", @"nightly", @"value", nil]
diff -r 2d9a0ce2e3db -r 0db8c654ce7f Source/AISoundController.m
--- a/Source/AISoundController.m Tue Apr 28 22:31:43 2009 -0700
+++ b/Source/AISoundController.m Wed Apr 29 00:52:22 2009 -0700
@@ -53,11 +53,6 @@
[adiumSound stopPlayingSoundAtPath:inPath];
}
-//Speech
-- (NSArray *)voices{
- return [adiumSpeech voices];
-}
-
/*!
* @brief Speak the demonstration text for a voice
*
@@ -65,19 +60,19 @@
* @param pitch The pitch to use, or 0.0 to use the default pitch
* @param rate The rate to use, 0.0 to use the default rate
*/
-- (void)speakDemoTextForVoice:(NSString *)voiceString withPitch:(CGFloat)pitch andRate:(CGFloat)rate{
+- (void)speakDemoTextForVoice:(NSString *)voiceString withPitch:(float)pitch andRate:(float)rate{
[adiumSpeech speakDemoTextForVoice:voiceString withPitch:pitch andRate:rate];
}
-- (CGFloat)defaultRate{
+- (float)defaultRate{
return [adiumSpeech defaultRate];
}
-- (CGFloat)defaultPitch{
+- (float)defaultPitch{
return [adiumSpeech defaultPitch];
}
- (void)speakText:(NSString *)text{
[adiumSpeech speakText:text];
}
-- (void)speakText:(NSString *)text withVoice:(NSString *)voiceString pitch:(CGFloat)pitch rate:(CGFloat)rate{
+- (void)speakText:(NSString *)text withVoice:(NSString *)voiceString pitch:(float)pitch rate:(float)rate{
[adiumSpeech speakText:text withVoice:voiceString pitch:pitch rate:rate];
}
diff -r 2d9a0ce2e3db -r 0db8c654ce7f Source/AdiumSpeech.h
--- a/Source/AdiumSpeech.h Tue Apr 28 22:31:43 2009 -0700
+++ b/Source/AdiumSpeech.h Wed Apr 29 00:52:22 2009 -0700
@@ -14,18 +14,14 @@
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+ at interface AdiumSpeech : NSObject {
+ NSMutableArray *speechArray;
- at class SUSpeaker;
-
- at interface AdiumSpeech : NSObject {
- NSMutableArray *speechArray;
- NSMutableArray *voiceArray;
-
- SUSpeaker *_variableVoice;
- SUSpeaker *_defaultVoice;
- CGFloat _defaultRate;
- CGFloat _defaultPitch;
- CGFloat customVolume;
+ NSSpeechSynthesizer *_variableVoice;
+ NSSpeechSynthesizer *_defaultVoice;
+ float _defaultRate;
+ float _defaultPitch;
+ float customVolume;
BOOL workspaceSessionIsActive;
BOOL speaking;
@@ -34,11 +30,10 @@
- (void)controllerDidLoad;
- (void)speakText:(NSString *)text;
-- (void)speakText:(NSString *)text withVoice:(NSString *)voiceString pitch:(CGFloat)pitch rate:(float)rate;
-- (void)speakDemoTextForVoice:(NSString *)voiceString withPitch:(CGFloat)pitch andRate:(float)rate;
+- (void)speakText:(NSString *)text withVoice:(NSString *)voiceString pitch:(float)pitch rate:(float)rate;
+- (void)speakDemoTextForVoice:(NSString *)voiceString withPitch:(float)pitch andRate:(float)rate;
-- (NSArray *)voices;
-- (CGFloat)defaultRate;
-- (CGFloat)defaultPitch;
+- (float)defaultRate;
+- (float)defaultPitch;
@end
diff -r 2d9a0ce2e3db -r 0db8c654ce7f Source/AdiumSpeech.m
--- a/Source/AdiumSpeech.m Tue Apr 28 22:31:43 2009 -0700
+++ b/Source/AdiumSpeech.m Wed Apr 29 00:52:22 2009 -0700
@@ -16,7 +16,6 @@
#import "AdiumSpeech.h"
#import "AISoundController.h"
-#import "SUSpeaker.h"
#import <Adium/AIListObject.h>
#define TEXT_TO_SPEAK @"Text"
@@ -24,19 +23,12 @@
#define PITCH @"Pitch"
#define RATE @"Rate"
-/* Text to Speech
- * We use SUSpeaker to provide maximum flexibility over speech. NSSpeechSynthesizer does not gives us pitch/rate controls.
- * The only significant bug in SUSpeaker is that it does not reset to the system default voice when it is asked to. We
- * therefore use 2 instances of SUSpeaker: one for default settings, and one for custom settings.
- */
-
@interface AdiumSpeech ()
-- (SUSpeaker *)defaultVoice;
-- (SUSpeaker *)variableVoice;
+- (NSSpeechSynthesizer *)defaultVoice;
+- (NSSpeechSynthesizer *)variableVoice;
- (void)_speakNext;
- (void)_stopSpeaking;
-- (SUSpeaker *)_speakerForVoice:(NSString *)voiceString index:(NSInteger *)voiceIndex;
-- (void)_setVolumeOfVoicesTo:(CGFloat)newVolume;
+- (void)_setVolumeOfVoicesTo:(float)newVolume;
@end
@implementation AdiumSpeech
@@ -69,21 +61,6 @@
}
/*!
- * @brief Load the array of voices
- */
-- (void)loadVoices
-{
- //Load voices
- //Vicki, a new voice in 10.3, returns an invalid name to SUSpeaker, Vicki3Smallurrent. If we see that name,
- //replace it with just Vicki. If this gets fixed in a future release of OS X, this code will simply do nothing.
- voiceArray = [[SUSpeaker voiceNames] mutableCopy];
- NSInteger messedUpIndex = [voiceArray indexOfObject:@"Vicki3Smallurrent"];
- if (messedUpIndex != NSNotFound) {
- [voiceArray replaceObjectAtIndex:messedUpIndex withObject:@"Vicki"];
- }
-}
-
-/*!
* @brief Close
*/
- (void)dealloc
@@ -91,14 +68,8 @@
[[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self];
[adium.preferenceController unregisterPreferenceObserver:self];
+ [speechArray release]; speechArray = nil;
[self _stopSpeaking];
-
- [speechArray release]; speechArray = nil;
- if(voiceArray)
- {
- [voiceArray release];
- voiceArray = nil;
- }
[super dealloc];
}
@@ -123,7 +94,7 @@
- (void)preferencesChangedForGroup:(NSString *)group key:(NSString *)key
object:(AIListObject *)object preferenceDict:(NSDictionary *)prefDict firstTime:(BOOL)firstTime
{
- CGFloat newVolume = [[prefDict objectForKey:KEY_SOUND_CUSTOM_VOLUME_LEVEL] doubleValue];
+ float newVolume = [[prefDict objectForKey:KEY_SOUND_CUSTOM_VOLUME_LEVEL] floatValue];
//If sound volume has changed, we must update all existing sounds to the new volume
if (customVolume != newVolume) {
@@ -134,7 +105,7 @@
customVolume = newVolume;
}
-- (void)_setVolumeOfVoicesTo:(CGFloat)newVolume
+- (void)_setVolumeOfVoicesTo:(float)newVolume
{
if (_defaultVoice) [_defaultVoice setVolume:newVolume];
if (_variableVoice) [_variableVoice setVolume:newVolume];
@@ -161,12 +132,10 @@
* @param pitch Speaking pitch
* @param rate Speaking rate
*/
-- (void)speakText:(NSString *)text withVoice:(NSString *)voiceString pitch:(CGFloat)pitch rate:(float)rate
+- (void)speakText:(NSString *)text withVoice:(NSString *)voiceString pitch:(float)pitch rate:(float)rate
{
- if (text && [text length] && workspaceSessionIsActive) {
- NSMutableDictionary *dict;
-
- dict = [[NSMutableDictionary alloc] init];
+ if (text && [text length] && workspaceSessionIsActive) {
+ NSMutableDictionary *dict = [NSMutableDictionary dictionary];
if (text) {
[dict setObject:text forKey:TEXT_TO_SPEAK];
@@ -177,10 +146,9 @@
if (rate > FLT_EPSILON) [dict setObject:[NSNumber numberWithDouble:rate] forKey:RATE];
AILog(@"AdiumSpeech: %@",dict);
[speechArray addObject:dict];
- [dict release];
[self _speakNext];
- }
+ }
}
/*!
@@ -190,34 +158,22 @@
* @param pitch Speaking pitch
* @param rate Speaking rate
*/
-- (void)speakDemoTextForVoice:(NSString *)voiceString withPitch:(CGFloat)pitch andRate:(float)rate
+- (void)speakDemoTextForVoice:(NSString *)voiceString withPitch:(float)pitch andRate:(float)rate
{
- if(workspaceSessionIsActive){
- NSInteger voiceIndex;
- SUSpeaker *theSpeaker = [self _speakerForVoice:voiceString index:&voiceIndex];
- NSString *demoText = [theSpeaker demoTextForVoiceAtIndex:((voiceIndex != NSNotFound) ? voiceIndex : -1)];
-
+ if(workspaceSessionIsActive) {
[self _stopSpeaking];
- [self speakText:demoText withVoice:voiceString pitch:pitch rate:rate];
+ [self speakText:[[NSSpeechSynthesizer attributesForVoice:voiceString] objectForKey:NSVoiceDemoText] withVoice:voiceString pitch:pitch rate:rate];
}
}
//Voices ---------------------------------------------------------------------------------------------------------------
#pragma mark Voices
-/*!
- * @brief Returns an array of available voices
- */
-- (NSArray *)voices
-{
- if(!voiceArray) [self loadVoices];
- return voiceArray;
-}
/*!
* @brief Returns the systemwide default rate
*/
-- (CGFloat)defaultRate
+- (float)defaultRate
{
if (!_defaultRate) { //Cache this, since the calculation may be slow
_defaultRate = [[self defaultVoice] rate];
@@ -228,10 +184,16 @@
/*!
* @brief Returns the systemwide default pitch
*/
-- (CGFloat)defaultPitch
+- (float)defaultPitch
{
if (!_defaultPitch) { //Cache this, since the calculation may be slow
- _defaultPitch = [[self defaultVoice] pitch];
+ NSNumber *pitchNumber = [[self defaultVoice] objectForProperty:NSSpeechPitchBaseProperty error:NULL];
+ if (pitchNumber) {
+ _defaultPitch = [pitchNumber floatValue];
+ } else {
+ NSLog(@"Couldn't get a pitch from the default voice. How strange.");
+ _defaultPitch = 0.0f;
+ }
}
return _defaultPitch;
}
@@ -239,26 +201,26 @@
/*!
* @brief Returns the default voice, creating if necessary
*/
-- (SUSpeaker *)defaultVoice
+- (NSSpeechSynthesizer *)defaultVoice
{
- if (!_defaultVoice) {
- _defaultVoice = [[SUSpeaker alloc] init];
+ if (!_defaultVoice) {
+ _defaultVoice = [[NSSpeechSynthesizer alloc] init];
[_defaultVoice setDelegate:self];
[_defaultVoice setVolume:customVolume];
- }
+ }
return _defaultVoice;
}
/*!
* @brief Returns the variable voice, creating if necessary
*/
-- (SUSpeaker *)variableVoice
+- (NSSpeechSynthesizer *)variableVoice
{
- if (!_variableVoice) {
- _variableVoice = [[SUSpeaker alloc] init];
+ if (!_variableVoice) {
+ _variableVoice = [[NSSpeechSynthesizer alloc] init];
[_variableVoice setDelegate:self];
[_variableVoice setVolume:customVolume];
- }
+ }
return _variableVoice;
}
@@ -270,10 +232,10 @@
*/
- (void)_speakNext
{
- //we have items left to speak and aren't already speaking
- if ([speechArray count] && !speaking) {
+ //we have items left to speak and aren't already speaking
+ if ([speechArray count] && !speaking) {
//Don't speak on top of other apps; instead, wait 1 second and try again
- if (SpeechBusySystemWide() > 0) {
+ if ([NSSpeechSynthesizer isAnyApplicationSpeaking]) {
[self performSelector:@selector(_speakNext)
withObject:nil
afterDelay:1.0];
@@ -285,13 +247,16 @@
NSString *text = [dict objectForKey:TEXT_TO_SPEAK];
NSNumber *pitchNumber = [dict objectForKey:PITCH];
NSNumber *rateNumber = [dict objectForKey:RATE];
- SUSpeaker *theSpeaker = [self _speakerForVoice:[dict objectForKey:VOICE] index:NULL];
+ NSSpeechSynthesizer *theSpeaker = [self variableVoice];
+ [theSpeaker setVoice:[dict objectForKey:VOICE]];
- [theSpeaker setPitch:(pitchNumber ? [pitchNumber doubleValue] : [self defaultPitch])];
- [theSpeaker setRate: (rateNumber ? [rateNumber doubleValue] : [self defaultRate])];
+ if (!pitchNumber)
+ pitchNumber = [NSNumber numberWithFloat:[self defaultPitch]];
+ [theSpeaker setObject:pitchNumber forProperty:NSSpeechPitchBaseProperty error:NULL];
+ [theSpeaker setRate:(rateNumber ? [rateNumber floatValue] : [self defaultRate])];
[theSpeaker setVolume:customVolume];
- [theSpeaker speakText:text];
+ [theSpeaker startSpeakingString:text];
[speechArray removeObjectAtIndex:0];
}
}
@@ -300,10 +265,10 @@
/*!
* @brief Speaking has finished, begin speaking the next item in our queue
*/
-- (IBAction)didFinishSpeaking:(SUSpeaker *)theSpeaker
+- (void)speechSynthesizer:(NSSpeechSynthesizer *)sender didFinishSpeaking:(BOOL)success
{
speaking = NO;
- [self _speakNext];
+ [self _speakNext];
}
/*!
@@ -317,36 +282,6 @@
[_variableVoice stopSpeaking];
}
-/*!
- * @brief Return the SUSpeaker which should be used for a given voice name, configured for that voice.
- * Optionally, return the index of that voice in our array by reference.
- */
-- (SUSpeaker *)_speakerForVoice:(NSString *)voiceString index:(NSInteger *)voiceIndex
-{
- SUSpeaker *speaker;
- NSInteger theIndex;
- if(voiceString)
- {
- if(!voiceArray) [self loadVoices];
- theIndex = [voiceArray indexOfObject:voiceString];
- }
- else
- theIndex = NSNotFound;
-
- //Return the voice index by reference
- if (voiceIndex) *voiceIndex = theIndex;
-
- //Configure and return the voice
- if (theIndex != NSNotFound) {
- speaker = [self variableVoice];
- [speaker setVoiceUsingIndex:theIndex];
- } else {
- speaker = [self defaultVoice];
- }
-
- return speaker;
-}
-
//Misc -----------------------------------------------------------------------------------------------------------------
#pragma mark Misc
diff -r 2d9a0ce2e3db -r 0db8c654ce7f Source/ESAnnouncerAbstractDetailPane.m
--- a/Source/ESAnnouncerAbstractDetailPane.m Tue Apr 28 22:31:43 2009 -0700
+++ b/Source/ESAnnouncerAbstractDetailPane.m Wed Apr 29 00:52:22 2009 -0700
@@ -62,25 +62,25 @@
speakTime = [[inDetails objectForKey:KEY_ANNOUNCER_TIME] boolValue];
speakContactName = [[inDetails objectForKey:KEY_ANNOUNCER_SENDER] boolValue];
- if ((voice = [inDetails objectForKey:KEY_VOICE_STRING])) {
- [popUp_voices selectItemWithTitle:voice];
- } else {
- [popUp_voices selectItemAtIndex:0]; //"Default"
- }
-
- if ((pitchNumber = [inDetails objectForKey:KEY_PITCH])) {
- [slider_pitch setDoubleValue:[pitchNumber doubleValue]];
- } else {
- [slider_pitch setDoubleValue:[adium.soundController defaultPitch]];
- }
+ if ((voice = [inDetails objectForKey:KEY_VOICE_STRING])) {
+ [popUp_voices selectItemWithTitle:voice];
+ } else {
+ [popUp_voices selectItemAtIndex:0]; //"Default"
+ }
+
+ if ((pitchNumber = [inDetails objectForKey:KEY_PITCH])) {
+ [slider_pitch setFloatValue:[pitchNumber floatValue]];
+ } else {
+ [slider_pitch setFloatValue:[adium.soundController defaultPitch]];
+ }
[checkBox_customPitch setState:[[inDetails objectForKey:KEY_PITCH_CUSTOM] boolValue]];
- if ((rateNumber = [inDetails objectForKey:KEY_RATE])) {
- [slider_rate setDoubleValue:[rateNumber doubleValue]];
- } else {
- [slider_rate setDoubleValue:[adium.soundController defaultRate]];
- }
+ if ((rateNumber = [inDetails objectForKey:KEY_RATE])) {
+ [slider_rate setFloatValue:[rateNumber floatValue]];
+ } else {
+ [slider_rate setFloatValue:[adium.soundController defaultRate]];
+ }
[checkBox_customRate setState:[[inDetails objectForKey:KEY_RATE_CUSTOM] boolValue]];
@@ -145,20 +145,20 @@
speakContactName = [NSNumber numberWithBool:([checkBox_speakContactName state] == NSOnState)];
voice = [[popUp_voices selectedItem] representedObject];
- pitch = [NSNumber numberWithDouble:[slider_pitch doubleValue]];
- rate = [NSNumber numberWithDouble:[slider_rate doubleValue]];
+ pitch = [NSNumber numberWithFloat:[slider_pitch floatValue]];
+ rate = [NSNumber numberWithFloat:[slider_rate floatValue]];
if (voice) {
[actionDetails setObject:voice
More information about the commits
mailing list