Reply To: NeatSpeech not playing audio after stopping

Home Forums OpenEars plugins NeatSpeech not playing audio after stopping Reply To: NeatSpeech not playing audio after stopping

#1024401
lfoster0
Participant

Alright so here is ViewController.mm

//  ViewController.m
//  OpenEarsSampleApp
//
//  ViewController.m demonstrates the use of the OpenEars framework. 
//
//  Copyright Politepix UG (haftungsbeschränkt) 2014. All rights reserved.
//  https://www.politepix.com
//  Contact at https://www.politepix.com/contact
//
//  This file is licensed under the Politepix Shared Source license found in the root of the source distribution.

#import "ViewController.h"

@implementation ViewController

#pragma mark View Lifecycle

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.audioToggleButton addTarget:self action:@selector(toggleAudio) forControlEvents:UIControlEventTouchUpInside];
    
    
    self.openEarsEventsObserver = [[OEEventsObserver alloc] init];
    [self.openEarsEventsObserver setDelegate:self];
    self.audioEnabled = YES;
    
    self.voiceController = [[OEFliteController alloc] init];
    self.voice = [[EmmaAlternate alloc] initWithPitch:0.0 speed:0.0 transform:0.0];
    
    self.tripDescription = @"The route of the tour can be seen on the above map; we begin by walking out of the civic plaza, along 7th until we reach City Hall and the Cenotaph and the beginning of George Street.  We then walk down George Street until 3rd Avenue.  We follow 3rd avenue for 3 blocks until we reach Brunswick Street.  We walk up Brunswick street until 5th Avenue, back towards the library for one block along 5th, we turn left down Quebec and then right onto 4th Avenue to see a few more historic sites before turning right onto Dominion and heading back to the Civic Plaza and the Library for the end of our tour.";
    
}

- (void) toggleAudio {
    NSLog(@"pressed");
    NSLog(@"Audio Enabled: %i",self.audioEnabled);
    if (self.audioEnabled) {
        NSLog(@"saying text: %@", self.tripDescription);
        [self.voiceController sayWithNeatSpeech:self.tripDescription withVoice:self.voice];
    }
    else {
        [self.voiceController stopSpeaking];
    }
    self.audioEnabled  = !self.audioEnabled;
}

- (void) neatSpeechWillSay:(NSString *)statement {
    NSLog(@"neatSpeechWillSay %@",statement);
}

- (void) fliteDidStartSpeaking {
    NSLog(@"SPEEEEAAKKKINNNGGGGG");
}

- (void) fliteDidFinishSpeaking {
    NSLog(@"DONE SPEAKING");
}

@end

Here is ViewController.h

//  ViewController.h
//  OpenEarsSampleApp
//
//  ViewController.h demonstrates the use of the OpenEars framework. 
//
//  Copyright Politepix UG (haftungsbeschränkt) 2014. All rights reserved.
//  https://www.politepix.com
//  Contact at https://www.politepix.com/contact
//
//  This file is licensed under the Politepix Shared Source license found in the root of the source distribution.

#import <UIKit/UIKit.h>
#import <OpenEars/OEEventsObserver.h>
#import <EmmaAlternate/EmmaAlternate.h>
#import <OpenEars/OEFliteController.h>
#import <NeatSpeechDemo/OEFliteController+NeatSpeech.h>

@interface ViewController : UIViewController <OEEventsObserverDelegate> // This is how we implement the delegate protocol of OEEventsObserver.

@property (weak, nonatomic) IBOutlet UIButton *audioToggleButton;

/* Audio Related */
@property (nonatomic) BOOL audioEnabled;
@property (strong, nonatomic) OEEventsObserver *openEarsEventsObserver;
@property (strong, nonatomic) OEFliteController *voiceController;
@property (strong, nonatomic) NeatSpeechVoice *voice;
@property (strong,nonatomic) NSString *tripDescription;

@end

And in the ViewController_iPhone.xib I deleted everything and just added a single button hooked up to
@property (weak, nonatomic) IBOutlet UIButton *audioToggleButton;

Same issue as before running on my iPhone 4 running iOS 7.0

Hope this helps, let me know if theres any other information I can provide!