Tagged: error, OpenEars 2.0
- This topic has 2 replies, 2 voices, and was last updated 8 years, 3 months ago by Halle Winkler.
-
AuthorPosts
-
April 29, 2015 at 9:22 am #1025548icedParticipant
Hi Halle,
I’m unable to stop pocketSphinxController listening while playing sounds via AVAudioPlayer. Specifically, an error is fired and OpenEars halts execution for like 4-5 seconds when [[OEPocketsphinxController sharedInstance] stopListening]; is called while an AVAudioPlayer object is playing a sound (music in my application). The following error does not fire when iOS simulator is used. It only fires when an actual iOS device is used for testing.
Here’s my replication of the problem with the OESampleApp using a wav file that is already available in the mainBundle. (Note: I’ve ran sampleApp on a 4S and an iPad 4). I click the stopListening button as soon as I hear the looping sound on the background.
——————————–
The lines of codes I added to ViewController.m:..
@property (nonatomic, strong) AVAudioPlayer *mediaPlayer;
..
..
@synthesize mediaPlayer;
..
..
..
And to the end of viewDidLoad function:– (void)viewDidLoad {
..
..
pocketSphinx start etc.. //Nothing changed here
..
..
//My AVAudioPlayer code kicks in
NSURL* effectsURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@”change_model_short” ofType:@”wav”]];NSLog(@”———-should start playing———“);
self.mediaPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:effectsURL error:nil];
self.mediaPlayer.volume = 1;
self.mediaPlayer.numberOfLoops = -1;
[self.mediaPlayer play];//Now comes the part with UI stuff, nothing changed below
[self startDisplayingLevels];
// Here is some UI stuff that has nothing specifically to do with OpenEars implementation
self.startButton.hidden = TRUE;
..etc..
}———————————-
Here is the Logging information with verbose option also set to TRUE. As far as I can tell, problem is related to OE deactivating the Audio Session while we are using it for the music. How can we solve this problem besides the obvious way ‘stop AVAudioPlayers before pocketsphinx stops listening’ (this is unacceptable in my application)?…
…
2015-04-29 10:15:07.985 OpenEarsSampleApp[15775:5010855] Stopping listening.
2015-04-29 10:15:10.152 OpenEarsSampleApp[15775:5010855] 10:15:10.152 ERROR: [0x3c1459dc] AVAudioSession.mm:646: -[AVAudioSession setActive:withOptions:error:]: Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session.
2015-04-29 10:15:10.153 OpenEarsSampleApp[15775:5010855] Error: couldn’t set session inactive.: ‘!act’
2015-04-29 10:15:10.156 OpenEarsSampleApp[15775:5010855] Error: there was a problem tearing down the audio session: Error Domain=NSOSStatusErrorDomain Code=560030580 “The operation couldn’t be completed. (OSStatus error 560030580.)”.
INFO: ngram_search_fwdtree.c(432): TOTAL fwdtree 0.78 CPU 0.308 xRT
INFO: ngram_search_fwdtree.c(435): TOTAL fwdtree 8.93 wall 3.544 xRT
INFO: ngram_search_fwdflat.c(176): TOTAL fwdflat 0.04 CPU 0.016 xRT
INFO: ngram_search_fwdflat.c(179): TOTAL fwdflat 0.05 wall 0.019 xRT
INFO: ngram_search.c(307): TOTAL bestpath 0.00 CPU 0.001 xRT
INFO: ngram_search.c(310): TOTAL bestpath 0.00 wall 0.001 xRT
2015-04-29 10:15:10.161 OpenEarsSampleApp[15775:5010855] No longer listening.
2015-04-29 10:15:10.166 OpenEarsSampleApp[15775:5010855] Local callback: Tearing down the continuous recognition loop has failed for the reason Error: there was a problem tearing down the audio session: Error Domain=NSOSStatusErrorDomain Code=560030580 “The operation couldn’t be completed. (OSStatus error 560030580.)”. Please turn on OELogging in order to troubleshoot this. If you need support with this issue, please turn on both OELogging and verbosePocketsphinx in order to get assistance., please turn on [OELogging startOpenEarsLogging] to learn more.
2015-04-29 10:15:10.168 OpenEarsSampleApp[15775:5010855] Local callback: Pocketsphinx has stopped listening.
2015-04-29 10:15:10.185 OpenEarsSampleApp[15775:5010903] Audio route has changed for the following reason:
2015-04-29 10:15:10.188 OpenEarsSampleApp[15775:5010903] There was a category change. The new category is AVAudioSessionCategoryPlayAndRecord
2015-04-29 10:15:10.193 OpenEarsSampleApp[15775:5010903] This is not a case in which OpenEars notifies of a route change. At the close of this function, the new audio route is —Speaker—. The previous route before changing to this route was <AVAudioSessionRouteDescription: 0x17d56c60,
inputs = (
“<AVAudioSessionPortDescription: 0x17d6c450, type = MicrophoneBuiltIn; name = iPad Microphone; UID = Built-In Microphone; selectedDataSource = (null)>”
);
outputs = (
“<AVAudioSessionPortDescription: 0x17d5dfb0, type = Speaker; name = Speaker; UID = Speaker; selectedDataSource = (null)>”
)>.April 29, 2015 at 10:21 am #1025551Halle WinklerPolitepixThanks, I have created a ticket for this.
December 29, 2015 at 8:45 pm #1027641Halle WinklerPolitepixI’ve looked into this (sorry it took so long), and it is necessary to stop your AVAudioPlayer playback at the time that you want to stop listening.
-
AuthorPosts
- The topic ‘PocketSphinx cannot stop listening when AVAudioPlayers are in use.’ is closed to new replies.