Nokia N97 SDK
Example Applications Guide

CCESoundPlayer Class Reference

#include <CCESoundPlayer.h>

Inheritance diagram for CCESoundPlayer:

List of all members.

Detailed Description

Sound player for CLF Example Application. Plays audio files in the application.

Definition at line 32 of file CCESoundPlayer.h.


Public Member Functions

virtual  ~CCESoundPlayer ()
void  StartPlaybackL (const TDesC &aFileName)
void  StopPlayback ()
TCEPlayerState  PlayerState ()

Static Public Member Functions

static CCESoundPlayer *  NewL ()
static CCESoundPlayer *  NewLC ()

Protected Member Functions

void  MapcInitComplete (TInt aError, const TTimeIntervalMicroSeconds &aDuration)
void  MapcPlayComplete (TInt aError)

Private Member Functions

  CCESoundPlayer ()
void  ConstructL ()

Private Attributes

CMdaAudioPlayerUtility *  iMdaAudioPlayerUtility
TCEPlayerState  iPlayerState
CActiveSchedulerWait  iWait


Constructor & Destructor Documentation

CCESoundPlayer::~CCESoundPlayer (   )  [virtual]
 

Destructor.

Definition at line 71 of file CCESoundPlayer.cpp.

References iPlayerState, and StopPlayback().

00072     {
00073     if( iPlayerState == ECEPlaying )
00074         {
00075         StopPlayback();
00076         }
00077         
00078     delete iMdaAudioPlayerUtility;
00079     }

CCESoundPlayer::CCESoundPlayer (   )  [private]
 

C++ default constructor.

Definition at line 30 of file CCESoundPlayer.cpp.

00031     {
00032     }


Member Function Documentation

CCESoundPlayer * CCESoundPlayer::NewL (   )  [static]
 

Creates and returns a new instance of this class.

Returns:
Pointer to the CCESoundPlayer object

Definition at line 50 of file CCESoundPlayer.cpp.

References NewLC().

Referenced by CCEMusicView::ConstructL().

00051     {
00052     CCESoundPlayer* self = CCESoundPlayer::NewLC();
00053     CleanupStack::Pop( self );
00054     return self;
00055     }

CCESoundPlayer * CCESoundPlayer::NewLC (   )  [static]
 

Creates and returns a new instance of this class. The returned object is left on the cleanup stack.

Returns:
Pointer to the CCESoundPlayer object

Definition at line 62 of file CCESoundPlayer.cpp.

References ConstructL().

Referenced by NewL().

00063     {
00064     CCESoundPlayer* self = new (ELeave) CCESoundPlayer;
00065     CleanupStack::PushL( self );
00066     self->ConstructL();
00067     return self;
00068     }

void CCESoundPlayer::ConstructL (   )  [private]
 

Symbian 2nd phase constructor.

Definition at line 39 of file CCESoundPlayer.cpp.

References iMdaAudioPlayerUtility.

Referenced by NewLC().

00040     {
00041     // Create a player utility
00042     iMdaAudioPlayerUtility = CMdaAudioPlayerUtility::NewL( *this );
00043     }

void CCESoundPlayer::MapcInitComplete (  TInt  aError,
const TTimeIntervalMicroSeconds &  aDuration
)  [protected]
 

From MMdaAudioPlayerCallback. Defines client behaviour when opening and initialization of an audio sample has completed.

Definition at line 87 of file CCESoundPlayer.cpp.

References iMdaAudioPlayerUtility, and iPlayerState.

00090         {
00091         iPlayerState = aError ? ECENotReady : ECEReadyToPlay;
00092 
00093     // Start the playback, if audio file initialization was successful
00094     if ( iPlayerState == ECEReadyToPlay )
00095             {
00096             iMdaAudioPlayerUtility->Play();
00097                 iPlayerState = ECEPlaying;
00098             }
00099         }

void CCESoundPlayer::MapcPlayComplete (  TInt  aError  )  [protected]
 

From MMdaAudioPlayerCallback. Defines client behaviour when playback of an audio sample has completed.

Definition at line 106 of file CCESoundPlayer.cpp.

References iPlayerState.

00107         {
00108         iPlayerState = aError ? ECENotReady : ECEReadyToPlay;   
00109         }

void CCESoundPlayer::StartPlaybackL (  const TDesC &  aFileName  ) 
 

Open music file and start music playback.

Parameters:
aFileName  Path and file name of the audio file

Definition at line 116 of file CCESoundPlayer.cpp.

References iMdaAudioPlayerUtility.

00117         {
00118         // Open the sound file
00119         iMdaAudioPlayerUtility->OpenFileL( aFileName );
00120         }

void CCESoundPlayer::StopPlayback (   ) 
 

Stop music playback.

Definition at line 127 of file CCESoundPlayer.cpp.

References iMdaAudioPlayerUtility, and iPlayerState.

Referenced by ~CCESoundPlayer().

00128         {
00129         // Stop audio playback and close the audio file
00130         if( iMdaAudioPlayerUtility && iPlayerState == ECEPlaying )
00131             {
00132             iMdaAudioPlayerUtility->Stop();
00133             iMdaAudioPlayerUtility->Close();
00134             iPlayerState = ECENotReady;
00135             }
00136         }

TCEPlayerState CCESoundPlayer::PlayerState (   ) 
 

Get the state of the audio player.

Returns:
State of the audio player

Definition at line 143 of file CCESoundPlayer.cpp.

References iPlayerState.

Referenced by CCEMusicView::DynInitMenuPaneL(), and CCEMusicView::HandleCommandL().

00144     {
00145     return iPlayerState;
00146     }


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top