0 Replies
      Latest reply on Sep 11, 2015 3:21 AM by HaroldMaurice
      HaroldMaurice Level 1 Level 1 (0 points)

        Hi there,

         

        I would be interested in getting a proper way to suspend OALSimpleAudio, as I noticed a conflict between Cocos2d-objC 3.0 and the GKVoiceChat feature of Game Center. The GameCenter voiceChat uses AVAudioSession and it seems it can not get the ressource it needs when initiating the connexion. Regarding the VoiceChat code, this is not rocket science and it has been proved OK without Cocos2D. This code is launched right after a proper Game Center connexion.

         

        OALAudioSession *audioSession = [OALAudioSession sharedInstance];
        audioSession.audioSessionCategory = AVAudioSessionCategoryPlayAndRecord;
        audioSession.audioSessionActive = YES;
        myConversationChannel = [myMatch voiceChatWithName:@"conversationChannel"]; // Global variable GKVoiceChat
        
        myConversationChannel.active = YES;
        myConversationChannel.volume = 0.6;
        [myConversationChannel start];
        
        
        
        
        
        
        
        
        
        
        

         

        The program crashes at [myConversationChannel start];  I get libobjc.A.dylib`objc_exception_throw from a thread called com.apple.gamekitservices.eventcbproc from one of the connected device (the receiver).

         

        After 2 days of googling, I've tried all the possible tricks, and combinations of tricks, I've found on the web to try to suspend the OALAudio among these options:

        [[OALSimpleAudio sharedInstance] stopEverything];
        [[OALSimpleAudio sharedInstance] setManuallySuspended:YES];
        [OpenALManager purgeSharedInstance];
        [OALAudioSession purgeSharedInstance];
        [OALSimpleAudio purgeSharedInstance];
        
        
        
        
        
        
        
        
        

         

        I also noticed that [OALSimpleAudio purgeSharedInstance] crashes instantly the program, even after having stopEverything.


        Other unsuccessful trials:

        I've tried using AVAudioSession instead of OALAudioSession (in fact modifying OALAudioSession sharedInstance modifies also AvAudioSession sharedInstance)

        I've tried adding the myConversationChannel.playerVoiceChatStateDidChangeHandler = ^(GKPlayer *player, GKVoiceChatPlayerState state) {}

        but it crashes before being triggered.


        Any help is welcome,

        Thanks !