Como reproduzir áudio em alto-falantes, em vez de alto-falantes muito mais fracos?

Estou aprendendo o áudio principal. Por alguma razão, o som do gráfico de processamento só reproduz os "alto-falantes de ouvido" fracos (quando você segura o dispositivo no ouvido), mas não sobre os alto-falantes normais do iPhone.

Este é o código que configura a sessão de áudio, mas não consigo ver onde ela configura a rota de áudio:

- (void) setupAudioSession {

    AVAudioSession *mySession = [AVAudioSession sharedInstance];

    // Specify that this object is the delegate of the audio session, so that
    //    this object's endInterruption method will be invoked when needed.
    [mySession setDelegate: self];

    // Assign the Playback category to the audio session.
    NSError *audioSessionError = nil;
    [mySession setCategory: AVAudioSessionCategoryPlayAndRecord//AVAudioSessionCategoryPlayback
                     error: &audioSessionError];

    if (audioSessionError != nil) {

        NSLog (@"Error setting audio session category.");
        return;
    }

    // Request the desired hardware sample rate.
    self.graphSampleRate = 44100.0;    // Hertz

    [mySession setPreferredHardwareSampleRate: graphSampleRate
                                        error: &audioSessionError];

    if (audioSessionError != nil) {

        NSLog (@"Error setting preferred hardware sample rate.");
        return;
    }

    // Activate the audio session
    [mySession setActive: YES
                   error: &audioSessionError];

    if (audioSessionError != nil) {

        NSLog (@"Error activating audio session during initial setup.");
        return;
    }

    // Obtain the actual hardware sample rate and store it for later use in the audio processing graph.
    self.graphSampleRate = [mySession currentHardwareSampleRate];

    // Register the audio route change listener callback function with the audio session.
    AudioSessionAddPropertyListener (
        kAudioSessionProperty_AudioRouteChange,
        audioRouteChangeListenerCallback,
        self
    );
}

Em que ponto do núcleo de áudio você diz "tocar nas caixas de som" ao reproduzir sons com unidades de áudio?

questionAnswers(2)

yourAnswerToTheQuestion