added volume controll
This commit is contained in:
parent
9be22a3f91
commit
0415fdd974
3 changed files with 211 additions and 26 deletions
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1090</int>
|
||||
<int key="IBDocument.SystemTarget">101000</int>
|
||||
<string key="IBDocument.SystemVersion">14A389</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">6245</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">6154.17</string>
|
||||
<string key="IBDocument.AppKitVersion">1343.14</string>
|
||||
<string key="IBDocument.HIToolboxVersion">755.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="NS.object.0">6245</string>
|
||||
<string key="NS.object.0">6154.17</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>NSCustomObject</string>
|
||||
|
@ -18,6 +18,8 @@
|
|||
<string>NSPopUpButtonCell</string>
|
||||
<string>NSScrollView</string>
|
||||
<string>NSScroller</string>
|
||||
<string>NSSlider</string>
|
||||
<string>NSSliderCell</string>
|
||||
<string>NSTextView</string>
|
||||
<string>NSToolbar</string>
|
||||
<string>NSToolbarFlexibleSpaceItem</string>
|
||||
|
@ -1321,6 +1323,48 @@
|
|||
<int key="NSToolbarDisplayMode">1</int>
|
||||
<int key="NSToolbarSizeMode">1</int>
|
||||
<dictionary class="NSMutableDictionary" key="NSToolbarIBIdentifiedItems">
|
||||
<object class="NSToolbarItem" key="6B9D411D-B22D-42EF-A3C2-F6BC2192030C" id="760683990">
|
||||
<string key="NSToolbarItemIdentifier">6B9D411D-B22D-42EF-A3C2-F6BC2192030C</string>
|
||||
<string key="NSToolbarItemLabel">Volume</string>
|
||||
<string key="NSToolbarItemPaletteLabel">Volume</string>
|
||||
<nil key="NSToolbarItemToolTip"/>
|
||||
<object class="NSSlider" key="NSToolbarItemView" id="1056307265">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{0, 14}, {96, 26}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSSliderCell" key="NSCell" id="279183685">
|
||||
<int key="NSCellFlags">-2080374784</int>
|
||||
<int key="NSCellFlags2">0</int>
|
||||
<string key="NSContents"/>
|
||||
<string key="NSCellIdentifier">_NS:9</string>
|
||||
<reference key="NSControlView" ref="1056307265"/>
|
||||
<double key="NSMaxValue">100</double>
|
||||
<double key="NSMinValue">0.0</double>
|
||||
<double key="NSValue">50</double>
|
||||
<double key="NSAltIncValue">0.0</double>
|
||||
<int key="NSNumberOfTickMarks">6</int>
|
||||
<int key="NSTickMarkPosition">1</int>
|
||||
<bool key="NSAllowsTickMarkValuesOnly">NO</bool>
|
||||
<bool key="NSVertical">NO</bool>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
<nil key="NSToolbarItemImage"/>
|
||||
<nil key="NSToolbarItemTarget"/>
|
||||
<nil key="NSToolbarItemAction"/>
|
||||
<string key="NSToolbarItemMinSize">{96, 21}</string>
|
||||
<string key="NSToolbarItemMaxSize">{96, 26}</string>
|
||||
<bool key="NSToolbarItemEnabled">YES</bool>
|
||||
<bool key="NSToolbarItemAutovalidates">YES</bool>
|
||||
<int key="NSToolbarItemTag">0</int>
|
||||
<bool key="NSToolbarIsUserRemovable">YES</bool>
|
||||
<int key="NSToolbarItemVisibilityPriority">0</int>
|
||||
</object>
|
||||
<object class="NSToolbarItem" key="BB31836C-C94C-4C54-B51B-8C9C9A2D1280" id="319967180">
|
||||
<object class="NSMutableString" key="NSToolbarItemIdentifier">
|
||||
<characters key="NS.bytes">BB31836C-C94C-4C54-B51B-8C9C9A2D1280</characters>
|
||||
|
@ -1334,6 +1378,7 @@
|
|||
<string key="NSFrame">{{0, 14}, {264, 25}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:868</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSPopUpButtonCell" key="NSCell" id="890650070">
|
||||
|
@ -1586,10 +1631,12 @@
|
|||
<reference ref="911163514"/>
|
||||
<reference ref="405021031"/>
|
||||
<reference ref="319967180"/>
|
||||
<reference ref="760683990"/>
|
||||
</array>
|
||||
<array class="NSMutableArray" key="NSToolbarIBDefaultItems">
|
||||
<array key="NSToolbarIBDefaultItems">
|
||||
<reference ref="405021031"/>
|
||||
<reference ref="188610191"/>
|
||||
<reference ref="760683990"/>
|
||||
<reference ref="448369132"/>
|
||||
<reference ref="188610191"/>
|
||||
<reference ref="319967180"/>
|
||||
|
@ -1803,12 +1850,12 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
|
|||
<object class="NSUserDefaultsController" id="789215370">
|
||||
<bool key="NSSharedInstance">YES</bool>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="346086284">
|
||||
<object class="NSCustomObject" id="568888154">
|
||||
<string key="NSClassName">NSSpeechSynthesizer</string>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<array key="connectionRecords">
|
||||
<array class="NSMutableArray" key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">terminate:</string>
|
||||
|
@ -2521,6 +2568,38 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
|
|||
</object>
|
||||
<int key="connectionID">595</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">synth</string>
|
||||
<reference key="source" ref="976324537"/>
|
||||
<reference key="destination" ref="568888154"/>
|
||||
</object>
|
||||
<int key="connectionID">621</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">setVolume:</string>
|
||||
<reference key="source" ref="976324537"/>
|
||||
<reference key="destination" ref="1056307265"/>
|
||||
</object>
|
||||
<int key="connectionID">636</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">value: values.volume</string>
|
||||
<reference key="source" ref="1056307265"/>
|
||||
<reference key="destination" ref="789215370"/>
|
||||
<object class="NSNibBindingConnector" key="connector">
|
||||
<reference key="NSSource" ref="1056307265"/>
|
||||
<reference key="NSDestination" ref="789215370"/>
|
||||
<string key="NSLabel">value: values.volume</string>
|
||||
<string key="NSBinding">value</string>
|
||||
<string key="NSKeyPath">values.volume</string>
|
||||
<int key="NSNibBindingConnectorVersion">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="connectionID">639</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
|
@ -3519,6 +3598,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
|
|||
<reference ref="911163514"/>
|
||||
<reference ref="405021031"/>
|
||||
<reference ref="319967180"/>
|
||||
<reference ref="760683990"/>
|
||||
</array>
|
||||
<reference key="parent" ref="972006081"/>
|
||||
</object>
|
||||
|
@ -3642,8 +3722,29 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
|
|||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">582</int>
|
||||
<reference key="object" ref="346086284"/>
|
||||
<int key="objectID">598</int>
|
||||
<reference key="object" ref="760683990"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="1056307265"/>
|
||||
</array>
|
||||
<reference key="parent" ref="1046718163"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">596</int>
|
||||
<reference key="object" ref="1056307265"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="279183685"/>
|
||||
</array>
|
||||
<reference key="parent" ref="760683990"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">597</int>
|
||||
<reference key="object" ref="279183685"/>
|
||||
<reference key="parent" ref="1056307265"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">620</int>
|
||||
<reference key="object" ref="568888154"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
</array>
|
||||
|
@ -3708,6 +3809,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
|
|||
<string key="350.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="351.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="354.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="371.IBPersistedLastKnownCanvasPosition">{359.5, 917.5}</string>
|
||||
<string key="371.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="371.IBWindowTemplateEditedContentRect">{{422, 131}, {500, 371}}</string>
|
||||
<integer value="1" key="371.NSWindowTemplate.visibleAtLaunch"/>
|
||||
|
@ -3811,7 +3913,10 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
|
|||
<string key="57.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="58.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="580.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="582.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="596.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="597.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="598.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="620.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="72.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="73.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="74.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
|
@ -3828,28 +3933,40 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
|
|||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">595</int>
|
||||
<int key="maxID">639</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">FirstResponder</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBUserSource</string>
|
||||
<string key="minorKey"/>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">SpeakerAppDelegate</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<dictionary class="NSMutableDictionary" key="actions">
|
||||
<string key="seekBack:">id</string>
|
||||
<string key="seekForward:">id</string>
|
||||
<string key="setVolume:">NSSlider</string>
|
||||
<string key="speakAction:">id</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="actionInfosByName">
|
||||
<object class="IBActionInfo" key="seekBack:">
|
||||
<object class="IBActionInfo" key="seekBack:" id="812720436">
|
||||
<string key="name">seekBack:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="seekForward:">
|
||||
<object class="IBActionInfo" key="seekForward:" id="429231919">
|
||||
<string key="name">seekForward:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="speakAction:">
|
||||
<object class="IBActionInfo" key="setVolume:" id="259827734">
|
||||
<string key="name">setVolume:</string>
|
||||
<string key="candidateClassName">NSSlider</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="speakAction:" id="451012767">
|
||||
<string key="name">speakAction:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
|
@ -3858,27 +3975,32 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
|
|||
<string key="languageMenu">NSMenu</string>
|
||||
<string key="languageMenuPopupButton">NSPopUpButton</string>
|
||||
<string key="speakButton">NSToolbarItem</string>
|
||||
<string key="synth">NSSpeechSynthesizer</string>
|
||||
<string key="textView">NSTextView</string>
|
||||
<string key="window">NSWindow</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="languageMenu">
|
||||
<object class="IBToOneOutletInfo" key="languageMenu" id="94240548">
|
||||
<string key="name">languageMenu</string>
|
||||
<string key="candidateClassName">NSMenu</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="languageMenuPopupButton">
|
||||
<object class="IBToOneOutletInfo" key="languageMenuPopupButton" id="878011511">
|
||||
<string key="name">languageMenuPopupButton</string>
|
||||
<string key="candidateClassName">NSPopUpButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="speakButton">
|
||||
<object class="IBToOneOutletInfo" key="speakButton" id="207174429">
|
||||
<string key="name">speakButton</string>
|
||||
<string key="candidateClassName">NSToolbarItem</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="textView">
|
||||
<object class="IBToOneOutletInfo" key="synth" id="432188065">
|
||||
<string key="name">synth</string>
|
||||
<string key="candidateClassName">NSSpeechSynthesizer</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="textView" id="212559543">
|
||||
<string key="name">textView</string>
|
||||
<string key="candidateClassName">NSTextView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="window">
|
||||
<object class="IBToOneOutletInfo" key="window" id="962788542">
|
||||
<string key="name">window</string>
|
||||
<string key="candidateClassName">NSWindow</string>
|
||||
</object>
|
||||
|
@ -3893,6 +4015,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
|
|||
<dictionary class="NSMutableDictionary" key="actions">
|
||||
<string key="seekBack:">id</string>
|
||||
<string key="seekForward:">id</string>
|
||||
<string key="setVolume:">NSSlider</string>
|
||||
<string key="speakAction:">id</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="actionInfosByName">
|
||||
|
@ -3904,6 +4027,10 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
|
|||
<string key="name">seekForward:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="setVolume:">
|
||||
<string key="name">setVolume:</string>
|
||||
<string key="candidateClassName">NSSlider</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="speakAction:">
|
||||
<string key="name">speakAction:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
|
@ -3914,11 +4041,51 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
|
|||
<string key="minorKey">../SpeakerAppDelegate.m</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">SpeakerAppDelegate</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<dictionary class="NSMutableDictionary" key="actions">
|
||||
<string key="seekBack:">id</string>
|
||||
<string key="seekForward:">id</string>
|
||||
<string key="setVolume:">NSSlider</string>
|
||||
<string key="speakAction:">id</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="actionInfosByName">
|
||||
<reference key="seekBack:" ref="812720436"/>
|
||||
<reference key="seekForward:" ref="429231919"/>
|
||||
<reference key="setVolume:" ref="259827734"/>
|
||||
<reference key="speakAction:" ref="451012767"/>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="languageMenu">NSMenu</string>
|
||||
<string key="languageMenuPopupButton">NSPopUpButton</string>
|
||||
<string key="speakButton">NSToolbarItem</string>
|
||||
<string key="synth">NSSpeechSynthesizer</string>
|
||||
<string key="textView">NSTextView</string>
|
||||
<string key="window">NSWindow</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<reference key="languageMenu" ref="94240548"/>
|
||||
<reference key="languageMenuPopupButton" ref="878011511"/>
|
||||
<reference key="speakButton" ref="207174429"/>
|
||||
<reference key="synth" ref="432188065"/>
|
||||
<reference key="textView" ref="212559543"/>
|
||||
<reference key="window" ref="962788542"/>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/SpeakerAppDelegate.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
|
||||
<bool key="IBDocument.previouslyAttemptedUpgradeToXcode5">NO</bool>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
|
||||
<real value="101000" key="NS.object.0"/>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
|
||||
<integer value="4600" key="NS.object.0"/>
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
NSTextView *textView;
|
||||
NSMenu *__weak languageMenu;
|
||||
NSPopUpButton *__weak languageMenuPopupButton;
|
||||
NSSpeechSynthesizer *synth;
|
||||
NSRange oldRange;
|
||||
BOOL isNewLocation;
|
||||
NSArray *languages;
|
||||
|
@ -24,10 +23,12 @@
|
|||
@property (weak) IBOutlet NSMenu *languageMenu;
|
||||
@property (weak) IBOutlet NSPopUpButton *languageMenuPopupButton;
|
||||
@property (weak) IBOutlet NSToolbarItem *speakButton;
|
||||
@property (weak) IBOutlet NSSpeechSynthesizer *synth;
|
||||
|
||||
-(IBAction)speakAction:(id)sender;
|
||||
-(IBAction)seekForward:(id)sender;
|
||||
-(IBAction)seekBack:(id)sender;
|
||||
-(IBAction)setVolume:(NSSlider *)sender;
|
||||
|
||||
-(void)stopSpeaking;
|
||||
-(void)startSpeaking;
|
||||
|
|
|
@ -16,12 +16,11 @@
|
|||
@synthesize languageMenu;
|
||||
@synthesize languageMenuPopupButton;
|
||||
@synthesize speakButton;
|
||||
@synthesize synth;
|
||||
|
||||
@synthesize window, textView;
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
||||
// Insert code here to initialize your application
|
||||
synth = [[NSSpeechSynthesizer alloc] init];
|
||||
synth.delegate = self;
|
||||
oldRange = NSMakeRange(-1, -1);
|
||||
isNewLocation = YES;
|
||||
|
@ -37,6 +36,13 @@
|
|||
[textView scrollRangeToVisible:aRange];
|
||||
}
|
||||
|
||||
float volume = [defaults floatForKey:@"volume"];
|
||||
if (volume == 0.0) {
|
||||
synth.volume = 1.0;
|
||||
} else {
|
||||
synth.volume = volume / 100;
|
||||
}
|
||||
|
||||
[self initLanugageMenu];
|
||||
}
|
||||
|
||||
|
@ -126,6 +132,8 @@
|
|||
}
|
||||
|
||||
-(void)startSpeaking {
|
||||
|
||||
[synth stopSpeaking];
|
||||
|
||||
[textView setEditable:NO];
|
||||
|
||||
|
@ -145,13 +153,9 @@
|
|||
} else { // only pointer
|
||||
text = [wholeText substringWithRange:NSMakeRange(range.location, [wholeText length] - range.location)];
|
||||
}
|
||||
|
||||
[synth stopSpeaking];
|
||||
|
||||
[self setVoiceForLanguage:[self findLanguageFromString:text]];
|
||||
|
||||
[synth startSpeakingString:text];
|
||||
|
||||
oldRange = range;
|
||||
|
||||
}
|
||||
|
@ -173,6 +177,19 @@
|
|||
|
||||
}
|
||||
|
||||
- (IBAction)setVolume:(NSSlider *)sender {
|
||||
BOOL restart = NO;
|
||||
if ([synth isSpeaking]) {
|
||||
restart = YES;
|
||||
[self stopSpeaking];
|
||||
}
|
||||
synth.volume = sender.floatValue / 100;
|
||||
|
||||
if (restart) {
|
||||
[self startSpeaking];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)speechSynthesizer:(NSSpeechSynthesizer *)sender willSpeakWord:(NSRange)wordToSpeak ofString:(NSString *)text {
|
||||
NSRange range = NSMakeRange(oldRange.location + wordToSpeak.location, wordToSpeak.length);
|
||||
[textView scrollRangeToVisible:range];
|
||||
|
@ -194,7 +211,7 @@
|
|||
{
|
||||
NSArray *tagschemes = [NSArray arrayWithObjects:NSLinguisticTagSchemeLanguage, nil];
|
||||
NSLinguisticTagger *tagger = [[NSLinguisticTagger alloc] initWithTagSchemes:tagschemes options:0];
|
||||
[tagger setString:text];
|
||||
[tagger setString:[[[text componentsSeparatedByCharactersInSet:[[NSCharacterSet letterCharacterSet] invertedSet]] componentsJoinedByString:@" "] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]];
|
||||
NSString *language = [tagger tagAtIndex:0 scheme:NSLinguisticTagSchemeLanguage tokenRange:NULL sentenceRange:NULL];
|
||||
|
||||
return language;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue