harrypell

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)

  • Author
    Posts
  • in reply to: OpenEars / AVPlayer Issue #1017377
    harrypell
    Participant

    Thanks Josh & Halle.

    That does seem to have done the trick. It slows things down a little, but that’s preferable to random crashing : )

    Thanks for you help!

    In case anyone else is wondering how to fix this. This is what I did…

    First you add this to your header –

    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    #import <OpenEars/AudioSessionManager.h>
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    Then you need to initialise the AVAudio session so you can manually reset it
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    NSError *activationError = nil;
    BOOL success = [[AVAudioSession sharedInstance] setActive: YES error: &activationError];

    if (!success) {
    NSLog(@”Audio Session Error”);
    }
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    After suspending recognition in OpenEars with this –

    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    [self.pocketsphinxController suspendRecognition];
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    – manually reset the audio session on a delay with this call –

    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    [self performSelector:@selector(reconfigureAudioForPlayingMovie) withObject:nil afterDelay: 1.0];
    }
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    – and this (this is the AVAudioSessionCategory I believe I need for playing an M4V in AVPlayer or an Mp3 in AVAudioPlayer ) –

    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    -(void)reconfigureAudioForPlayingMovie {
    NSError *setCategoryError = nil;
    BOOL success = [[AVAudioSession sharedInstance]
    setCategory: AVAudioSessionCategoryAmbient
    error: &setCategoryError];

    if (!success) {
    NSLog(@”Audio Session Error”);
    }
    NSLog(@”Audio Session Reconfigured”);

    }
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    And then give a little delay before playing your video/audio.

    When you want to listen again you resume the Audio session and OpenEars

    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    [[AudioSessionManager sharedAudioSessionManager] startAudioSession];
    [self.pocketsphinxController resumeRecognition];
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    I’ve been testing this most of the day and playing around with how long the delays need to be.

    I’ll post an update here if I figure anything else out.

    Harriet

    in reply to: RapidEars Demo Error #1016918
    harrypell
    Participant

    Hi Halle,

    I am adding RapidEars to an existing project. I wonder if it’s the ASIHTTPRequest which is causing problems.

    It might be worth my gutting it and adding RapidEars to a cleanr version of the file. I’ll give this a whirl tomorrow and see if that sorts out the error.

    Thanks for your help.

    Harriet

    in reply to: RapidEars Demo Error #1016916
    harrypell
    Participant

    Hi Halle,

    I definitely have the -ObjC other linker flag. I’m afraid I don’t know how to check for a C++ compilation flag. (Or what one is…)

    Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)