camerauis/cameraxui/cxengine/inc/cxesoundplayersymbian.h
branchRCL_3
changeset 54 bac7acad7cb3
parent 53 61bc0f252b2b
child 57 2c87b2808fd7
equal deleted inserted replaced
53:61bc0f252b2b 54:bac7acad7cb3
     1 /*
       
     2 * Copyright (c) 2009-2010 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:
       
    15 *
       
    16 */
       
    17 #ifndef CXESOUNDPLAYERSYMBIAN_H
       
    18 #define CXESOUNDPLAYERSYMBIAN_H
       
    19 
       
    20 #include <QObject>
       
    21 #include <QMetaType>
       
    22 #include <QVariant>
       
    23 #include <mdaaudiosampleplayer.h>
       
    24 #include "cxestatemachine.h"
       
    25 
       
    26 class CMdaAudioPlayerUtility;
       
    27 class CxeCameraDeviceControlSymbian;
       
    28 class CxeSettings;
       
    29 
       
    30 class CxeSoundPlayerSymbian : public QObject,
       
    31                               public CxeStateMachine,
       
    32                               public MMdaAudioPlayerCallback
       
    33 {
       
    34     Q_OBJECT
       
    35 public:
       
    36     /*!
       
    37      * CaptureSound enum defines different types of capture sounds
       
    38      */
       
    39     enum CaptureSound {
       
    40         //! Unknown is used when the capture sound is not set
       
    41         Unknown = 0,
       
    42         //! StillCapture sound is used in image capturing
       
    43         StillCapture,
       
    44         //! VideoCaptureStart is used as video start sound
       
    45         VideoCaptureStart,
       
    46         //! VideoCaptureStop is used as video stop sound
       
    47         VideoCaptureStop,
       
    48         //! AutoFocus is used when auto focus completes succesfully
       
    49         AutoFocus
       
    50     };
       
    51 
       
    52     /*!
       
    53      * Sound player states.
       
    54      */
       
    55     enum State {
       
    56         //! No sound is open
       
    57         NotReady = 0x01,
       
    58 
       
    59         //! OpenFileL is in progress
       
    60         Opening  = 0x02,
       
    61 
       
    62         //! Sound file is open and we're ready to play
       
    63         Ready = 0x04,
       
    64 
       
    65         //! Playback in progress
       
    66         Playing = 0x08
       
    67     };
       
    68 
       
    69     CxeSoundPlayerSymbian(CaptureSound soundId, CxeSettings &settings);
       
    70     virtual ~CxeSoundPlayerSymbian();
       
    71 
       
    72     void play();
       
    73 
       
    74 public slots:
       
    75     void enableSound(long int uid, unsigned long int key, QVariant value);
       
    76 
       
    77 protected: // from CxeStateMachine
       
    78     void handleStateChanged(int newStateId, CxeError::Id error);
       
    79 
       
    80 signals:
       
    81     /*!
       
    82      * playComplete signal is emitted when sound has been played.
       
    83      * @param error Contains status information whether there was a problem with playing or not
       
    84      */
       
    85     void playComplete(int error);
       
    86 
       
    87 public slots:
       
    88 
       
    89 protected: // from MMdaAudioPlayerCallback
       
    90     void MapcInitComplete(TInt aStatus, const TTimeIntervalMicroSeconds &aDuration);
       
    91     void MapcPlayComplete(TInt aStatus);
       
    92 
       
    93 private:
       
    94     State state() const;
       
    95     void doOpen();
       
    96     void initializeStates();
       
    97     void checkCaptureSoundSettings();
       
    98 
       
    99     //! Own.
       
   100     CMdaAudioPlayerUtility *mAudioPlayer;
       
   101 
       
   102     //! Currently opened sound file
       
   103     CxeSoundPlayerSymbian::CaptureSound mSoundId;
       
   104 
       
   105     bool mUseSound;
       
   106     bool mCaptureSoundForced;
       
   107 
       
   108     CxeSettings &mSettings;
       
   109 
       
   110 };
       
   111 
       
   112 Q_DECLARE_METATYPE(CxeSoundPlayerSymbian::State)
       
   113 
       
   114 #endif  // CXESOUNDPLAYERSYMBIAN_H
       
   115