camerauis/cameraapp/generic/src/audioplayer/camaudioplayercontroller.cpp
branchRCL_3
changeset 13 38fb6f7eacd5
parent 0 1ddebce53859
equal deleted inserted replaced
12:51dda465e618 13:38fb6f7eacd5
    31 #include "CamSettingsInternal.hrh"       // TCamCameraMode, TCamSettingItemIds
    31 #include "CamSettingsInternal.hrh"       // TCamCameraMode, TCamSettingItemIds
    32 #include "CamAppController.h"
    32 #include "CamAppController.h"
    33 #include "mcamplayerobserver.h"
    33 #include "mcamplayerobserver.h"
    34 #include "mcamplayerwrapper.h"
    34 #include "mcamplayerwrapper.h"
    35 #include "camaudioplayerwrapper.h"
    35 #include "camaudioplayerwrapper.h"
    36 #include "camtoneplayerwrapper.h"
       
    37 #include "camaudioplayercontroller.h"
    36 #include "camaudioplayercontroller.h"
    38 #include "OstTraceDefinitions.h"
    37 #include "OstTraceDefinitions.h"
    39 #ifdef OST_TRACE_COMPILER_IN_USE
    38 #ifdef OST_TRACE_COMPILER_IN_USE
    40 #include "camaudioplayercontrollerTraces.h"
    39 #include "camaudioplayercontrollerTraces.h"
    41 #endif
    40 #endif
   254     }
   253     }
   255   }
   254   }
   256 
   255 
   257 
   256 
   258 // ---------------------------------------------------------------------------
   257 // ---------------------------------------------------------------------------
   259 // PlayTone
       
   260 // ---------------------------------------------------------------------------
       
   261 // 
       
   262 void
       
   263 CCamAudioPlayerController::PlayTone( TInt    aToneInHz, 
       
   264                                      TInt    aLengthInUs, 
       
   265                                      TReal32 aVolumeInPercent, 
       
   266                                      TBool   aCallback )
       
   267   {
       
   268   TInt status( KErrNone );
       
   269 
       
   270   if( !iTonePlayer )
       
   271     {
       
   272     TRAP( status, iTonePlayer = CCamTonePlayerWrapper::NewL( iObserver ) );
       
   273     }
       
   274 
       
   275   if( KErrNone == status )
       
   276     {
       
   277     iTonePlayer->PlayTone( aToneInHz, aLengthInUs, aVolumeInPercent, aCallback );
       
   278     }
       
   279   else
       
   280     {
       
   281     if( aCallback )
       
   282       iObserver.PlayComplete( status, -1 );
       
   283     }
       
   284   }
       
   285   
       
   286 
       
   287 // ---------------------------------------------------------------------------
       
   288 // CancelAllPlaying
   258 // CancelAllPlaying
   289 // ---------------------------------------------------------------------------
   259 // ---------------------------------------------------------------------------
   290 //
   260 //
   291 void 
   261 void 
   292 CCamAudioPlayerController::CancelAllPlaying()
   262 CCamAudioPlayerController::CancelAllPlaying()
   293   {
   263   {
   294   PRINT( _L("Camera => CCamAudioPlayerController::CancelAllPlaying") );
   264   PRINT( _L("Camera => CCamAudioPlayerController::CancelAllPlaying") );
   295 
   265 
   296   if( iTonePlayer )
       
   297     {
       
   298     iTonePlayer->CancelPlay();
       
   299     }
       
   300   for( TInt i = 0; i < iPlayers.Count(); i++ )
   266   for( TInt i = 0; i < iPlayers.Count(); i++ )
   301     {
   267     {
   302     iPlayers[i]->CancelPlay();
   268     iPlayers[i]->CancelPlay();
   303     }
   269     }
   304 
   270 
   585 CCamAudioPlayerController::Reset()
   551 CCamAudioPlayerController::Reset()
   586   {
   552   {
   587   PRINT ( _L("Camera => CCamAudioPlayerController::Reset") );
   553   PRINT ( _L("Camera => CCamAudioPlayerController::Reset") );
   588   iPlayers.ResetAndDestroy();
   554   iPlayers.ResetAndDestroy();
   589 
   555 
   590   delete iTonePlayer;
       
   591   iTonePlayer = NULL;
       
   592 
   556 
   593   iCameraMode     = ECamControllerIdle;
   557   iCameraMode     = ECamControllerIdle;
   594   iCaptureSoundId = -1;
   558   iCaptureSoundId = -1;
   595   PRINT ( _L("Camera <= CCamAudioPlayerController::Reset") );
   559   PRINT ( _L("Camera <= CCamAudioPlayerController::Reset") );
   596   }
   560   }