Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 08:29, 9 April 2008.

Audio Playback APIs

From Forum Nokia Wiki


The MMF(Multimedia Framework) provides a simple API for audio playback that is independent of the format or type of audio being played. The same API is used for playback of both local and streaming contents and is supported by the following classes:

--CMdaAudioPlayerUtility - The Audio Player API that supports audio playback operations and simple metadata retrieval operations.This class provides most of the audio playback operations and supports both local audio playback and streaming audio playback. Other than audio playback operations, this class also provides methods for more advanced operations such as metadata information retrieval and audio balancing.

--MMdaAudioPlayerCallback - The Callback API for the CMdaAudioPlayerUtility class that reports errors and notifies the application of the status of file-open operations or when play has completed.This class is a mixing class that provides feedback to applications that make use of the CMdaAudioPlayerUtility class. It is responsible for notifying the application about any error situations that occur during file opening and playback.

These classes are found in the MediaClientAudio.lib library.

Audio Playback Operations: The following operations are done using CMdaAudioPlaybackUtility class:

  • Select a file to be played.
  • Start audio playback.
  • Change playback volume.
  • Pause playback.
  • Stop playback.
  • Query metadata information.

Note that since all operations in the CMdaAudioPlaybackUtility class are asynchronous operations, it is necessary to inherit from MMdaAudioPlayerCallback so that the audio playback operations can be observed. The observer callback API consists of the following two methods:

void MapcInitComplete(TInt aError, const TTImeIntervalMicroSeconds& aDuration);
void MapcPlayComplete(TInt aError);


The callback methods will be invoked after playback initialization is completed and when the audio track playback is completed. In order to carry out the playback operations, it is first necessary to create an instance of the CMdaAudioPlayerUtility class using:

CMdaAudioPlayerUtility* iPlayer = CMdaAudioPlayerUtility::NewL(*this);
iPlayer->OpenFileL( aFilename);
iPlayer->OpenDesL( aDescriptor);
iPlayer->OpenUrlL( aUrl );

The above file-open operations can be done in the other way as well(like as follows):

CMdaAudioPlayerUtility* iPlayer = 
CMdaAudioPlayerUtility::NewFilePlayerL(aFilename, *this);
 
CMdaAudioPlayerUtility* iPlayer = 
CMdaAudioPlayerUtility::NewDesPlayerL(aDescriptor, *this);
 
CMdaAudioPlayerUtility* iPlayer = 
CMdaAudioPlayerUtility::NewDesPlayerReadOnlyL(aDescriptor, *this);


After file-open operations are completed, then playback operation can be started and playback operation properties can be set.

iPlayer->Play();
iPlayer->SetVolume( aVolume );
iPlayer->SetRepeats( aRepeatNumberOfTimes, aTrailingSilenceMicroSeconds );
iPlayer->SetVolumeRamp( aRampDuration );
iPlayer->SetPriority( aPriority );
iPlayer->SetPosition( aPositionMicroSeconds );


To query the playback information of the opened audio clip:

TTimeIntervalMicroSeconds aDuration = iPlayer->Duration();
TTimeIntervalMicroSeconds apposition = iPlayer->Position();
TInt aVolume = iPlayer->MaxVolume();


Playback is paused, resumed, stopped and closed using:

iPlayer->Pause();
iPlayer->Play();
iPlayer->Stop();
iPlayer->Close();



Links

Audio Recording APIs

Full Duplex Audio

Audio Proxy Server

Related Discussions
Thread Thread Starter Forum Replies Last Post
Preventing File Forwarding and Transfering kumar_sai123 General Symbian C++ 1 2008-07-30 12:18
Nokia 7200 audio/mpeg3 chep Audio 3 2004-12-17 00:11
MediaRecorder API niraxoid Symbian Media (Graphics & Sounds) 9 2007-12-28 11:45
Playing Audio in Telephony Link during Alerting deps777 General Symbian C++ 4 2007-02-07 03:38
recording audio and streaming it over a network using j2me babai78 Mobile Java Tools & SDKs 4 2007-10-17 08:17
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZaudioQ
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX
     
    
            
            RDF Facets:
            
            
                        qfnZuserE5ftagQSxteE78tE2DtoE2DspeechX