camerauis/cameraapp/generic/inc/audioplayer/camaudioplayercontroller.h
changeset 0 1ddebce53859
child 20 38fb6f7eacd5
equal deleted inserted replaced
-1:000000000000 0:1ddebce53859
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Audio Player Controller
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAM_AUDIOPLAYERCONTROLLER_H
       
    20 #define CAM_AUDIOPLAYERCONTROLLER_H
       
    21 
       
    22 // ===========================================================================
       
    23 // Includes
       
    24 #include <e32base.h>
       
    25 #include "CamControllerObservers.h"
       
    26 #include "mcamsettingsmodelobserver.h"
       
    27 
       
    28 // ===========================================================================
       
    29 // Forward declarations
       
    30 class CAknKeySoundSystem;
       
    31 class CCamAppController;
       
    32 class MCamAudioPlayerObserver;
       
    33 class CCamPlayerWrapperBase;
       
    34 class CCamTonePlayerWrapper;
       
    35 
       
    36 // ===========================================================================
       
    37 // Class definitions
       
    38 
       
    39 /**
       
    40 * Audio Player Controller class
       
    41 *
       
    42 * Controls tone and audio players and caches needed
       
    43 * players based on Camera capture mode to enable
       
    44 * fast playing of needed sounds/tones.
       
    45 *
       
    46 */
       
    47 class CCamAudioPlayerController : public CBase,
       
    48                                   public MCamControllerObserver,
       
    49                                   public MCamSettingsModelObserver
       
    50   {
       
    51   // =======================================================
       
    52   // Methods
       
    53 
       
    54   // -------------------------------------------------------
       
    55   // constructors and destructor
       
    56   public:
       
    57 
       
    58     static CCamAudioPlayerController* NewL( CCamAppController&  aController,
       
    59                                             MCamPlayerObserver& aObserver );
       
    60     virtual ~CCamAudioPlayerController();
       
    61 
       
    62   // -------------------------------------------------------
       
    63   // from MCamControllerObserver
       
    64   public: 
       
    65     
       
    66     virtual void HandleControllerEventL( TCamControllerEvent aEvent, TInt aStatus );
       
    67 
       
    68   // -------------------------------------------------------
       
    69   // from MCamSettingsModelObserver
       
    70   public: 
       
    71   
       
    72     virtual void IntSettingChangedL ( TCamSettingItemIds aSettingItem, TInt aSettingValue );
       
    73     virtual void TextSettingChangedL( TCamSettingItemIds aSettingItem, const TDesC& aSettingValue );
       
    74 
       
    75   // -------------------------------------------------------
       
    76   // new public
       
    77   public:
       
    78     
       
    79     /**
       
    80     * @param aCallback If set ETrue, calling method this results in one 
       
    81     *                  callback to MCamAudioPlayerObserver::PlayComplete
       
    82     */
       
    83     void PlaySound( TInt  aSoundId, 
       
    84                     TBool aCallback );
       
    85 
       
    86     /**
       
    87     * @param aCallback If set ETrue, calling method this results in one 
       
    88     *                  callback to MCamAudioPlayerObserver::PlayComplete
       
    89     */
       
    90     void PlayTone( TInt    aToneInHz, 
       
    91                    TInt    aLengthInUs, 
       
    92                    TReal32 aVolumeInPercent, 
       
    93                    TBool   aCallback );
       
    94 
       
    95     /**
       
    96     * Cancel all ongoing playing activity.
       
    97     */
       
    98     void CancelAllPlaying();
       
    99     
       
   100     /**
       
   101     * Cancel given sound playing, if ongoing.
       
   102     * @aSoundId Id of the sound to be cancelled.
       
   103     */
       
   104     void CancelPlaying( TInt aSoundId );
       
   105     
       
   106     void InitKeySoundSystem();
       
   107     void EnableAllKeySounds();
       
   108     void DisableAllKeySoundsL();
       
   109 
       
   110 
       
   111   // -------------------------------------------------------
       
   112   // new private
       
   113   private:
       
   114 
       
   115     TInt                   FindPlayerIndex( TInt aSoundId ) const;
       
   116     CCamPlayerWrapperBase* GetPlayerL     ( TInt aSoundId );
       
   117     void                   RemovePlayer   ( TInt aSoundId );
       
   118 
       
   119     void Setup( TCamCameraMode aCameraMode );
       
   120     void SetupForVideoL();
       
   121     void SetupForImageL();
       
   122     void SetupCaptureSoundPlayerL( TInt aNewSoundId );
       
   123     void Reset();
       
   124   
       
   125   // -------------------------------------------------------
       
   126   // private constructors
       
   127   private:
       
   128 
       
   129     void ConstructL();
       
   130     
       
   131     CCamAudioPlayerController( CCamAppController&  aController,
       
   132                                MCamPlayerObserver& aObserver );
       
   133 
       
   134   // =======================================================
       
   135   // Data
       
   136   private:
       
   137 
       
   138     CCamAppController&                   iController;
       
   139     MCamPlayerObserver&                  iObserver;
       
   140 
       
   141     RPointerArray<CCamPlayerWrapperBase> iPlayers;
       
   142     CCamTonePlayerWrapper*               iTonePlayer;
       
   143 
       
   144     TInt                                 iCameraMode;     // TCamCameraMode value
       
   145     TInt                                 iCaptureSoundId; // Sound id or -1 if not set
       
   146 
       
   147     CAknKeySoundSystem*                  iKeySoundSystem; // not own
       
   148     TBool                                iKeySoundsDisabled;
       
   149 
       
   150   // =======================================================
       
   151   };
       
   152 
       
   153 #endif // CAM_AUDIOPLAYERCONTROLLER_H
       
   154 
       
   155 // ===========================================================================
       
   156 // end of file
       
   157 
       
   158