PageRenderTime 35ms CodeModel.GetById 20ms app.highlight 14ms RepoModel.GetById 0ms app.codeStats 0ms

/Tests/FliteEngineTestViewController.m

http://espeak-engine.googlecode.com/
Objective C | 109 lines | 36 code | 17 blank | 56 comment | 4 complexity | 71f4bb5d42907d9151f26ea0123e72fa MD5 | raw file
  1//
  2//  FliteEngineTestViewController.m
  3//  FliteEngineTest
  4//
  5//  Created by Ing. Jozef Bozek on 30.3.2010.
  6//	Copyright Š 2010 bring-it-together s.r.o.. All Rights Reserved.
  7// 
  8//	Redistribution and use in source and binary forms, with or without 
  9//	modification, are permitted provided that the following conditions are met:
 10//
 11//	1. Redistributions of source code must retain the above copyright notice, this 
 12//	   list of conditions and the following disclaimer.
 13//
 14//	2. Redistributions in binary form must reproduce the above copyright notice, 
 15//	   this list of conditions and the following disclaimer in the documentation 
 16//	   and/or other materials provided with the distribution.
 17//
 18//	3. Neither the name of the author nor the names of its contributors may be used
 19//	   to endorse or promote products derived from this software without specific
 20//	   prior written permission.
 21//
 22//	THIS SOFTWARE IS PROVIDED BY BRING-IT-TOGETHER S.R.O. "AS IS"
 23//	AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 24//	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 25//	DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
 26//	FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 27//	DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 28//	SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 29//	CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 30//	OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 31//	OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 32
 33#import "FliteEngineTestViewController.h"
 34#import "ESpeakEngine.h"
 35
 36@implementation FliteEngineTestViewController
 37
 38@synthesize textView;
 39
 40/*
 41// The designated initializer. Override to perform setup that is required before the view is loaded.
 42- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
 43    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
 44        // Custom initialization
 45    }
 46    return self;
 47}
 48*/
 49
 50/*
 51// Implement loadView to create a view hierarchy programmatically, without using a nib.
 52- (void)loadView {
 53}
 54*/
 55
 56
 57- (void)viewDidLoad {
 58    [super viewDidLoad];
 59	engine = [[ESpeakEngine alloc] init];
 60	engine.volume = 1;
 61	
 62	NSArray * languages = [engine supportedLanguages];
 63    for (NSString *lang in languages) {
 64        NSLog(@"%@", lang);
 65    }
 66	[engine setLanguage:@"en"];
 67}
 68
 69/*
 70// Override to allow orientations other than the default portrait orientation.
 71- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 72    // Return YES for supported orientations
 73    return (interfaceOrientation == UIInterfaceOrientationPortrait);
 74}
 75*/
 76
 77- (IBAction)speech {
 78	NSString * text = self.textView.text;
 79	[engine speak:text];
 80}
 81
 82- (IBAction)changeGender:(UISegmentedControl*)control {
 83    if (control.selectedSegmentIndex == 0) {
 84        [engine setGender:kESpeakEngineGenerMale];
 85    } else {
 86        [engine setGender:kESpeakEngineGenerFemale];
 87    }
 88}
 89
 90- (void)didReceiveMemoryWarning {
 91	// Releases the view if it doesn't have a superview.
 92    [super didReceiveMemoryWarning];
 93	
 94	// Release any cached data, images, etc that aren't in use.
 95}
 96
 97- (void)viewDidUnload {
 98	// Release any retained subviews of the main view.
 99	// e.g. self.myOutlet = nil;
100}
101
102
103- (void)dealloc {
104	[engine release];
105	[textView release];
106    [super dealloc];
107}
108
109@end