Namespaces
Variants
Actions

Archived:Controlling audio routing in S60 3rd Edition FP1

Jump to: navigation, search
Archived.png
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.


Article Metadata

Compatibility
Platform(s): S60 3rd Edition, Feature Pack 1

Article
Created: User:Technical writer 1 (September 17, 2007, updated October 16, 2007)
Last edited: lpvalente (09 Nov 2012)

Overview

In S60 3rd Edition, Feature Pack 1 devices, audio output (playback) routing can be controlled with the Audio Output Routing API, included in the Extensions plug-in package for S60 3rd Edition SDK for Symbian OS, for C++, supporting Feature Pack 1.

Description

When playing audio using either CMdaAudioPlayerUtility, CMdaAudioRecorderUtility, CMdaAudioOutputStream, or CMMFDevSound, the audio will be routed to the loudspeaker by default. When a headset or another accessory is connected, the audio is routed to the headset automatically.

The Audio Output Routing API provides means to change the routing from the default.

When no headset is connected, audio can be routed to the earpiece using the SetAudioOutputL() function in AudioOutput.h. Likewise, audio can be routed to the loudspeaker even when a headset is connected.

AudioOutput.h, part of the Audio Output Routing API, is included in the Extensions plug-in package for S60 3rd Edition SDK for Symbian OS, for C++, supporting Feature Pack 1.

Solution

Once the audio playback is started with CMdaAudioPlayerUtility, create a CAudioOutput instance and pass a reference of the player utility to it. The output routing can be now controlled with the TAudioOutputPreference parameter, passed to the SetAudioOutputL() function:

  void CMySound::SetRoutingL(CAudioOutput::TAudioOutputPreference aAudioOutput)
{
iAudioOutput = CAudioOutput::NewL(*iMyAudioPlayerUtility);
iAudioOutput->SetAudioOutputL(aAudioOutput);
}

CAudioOutput provides NewL contructors also for other audio playback classes in addition to CMdaAudioPlayerUtility.


Description of the different routing options in TAudioOutputPreference

  enum TAudioOutputPreference
{
ENoPreference, // Used to indicate that the playing audio can be routed to
// any speaker. This is the default value for audio.
 
EAll, // Used to indicate that the playing audio should be routed
// to all speakers.
 
ENoOutput, // Used to indicate that the playing audio should not be
// routed to any output.
 
EPrivate, // Used to indicate that the playing audio should be routed
// to the default private speaker. A private speaker is one
// that can only be heard by one person.
 
EPublic // Used to indicate that the playing audio should be routed
// to the default public speaker. A public speaker is one
// that can be heard by multiple people.
};


Note that the AudioOutputRouting API does not provide a constructor for the CVideoPlayerUtility instance. Therefore routing of the audio track of video clips cannot be controlled.

This page was last modified on 9 November 2012, at 19:45.
342 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved