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