camerauis/cameraxui/cxengine/inc/cxesoundplayersymbian.h
changeset 37 64817133cd1d
parent 19 d9aefe59d544
equal deleted inserted replaced
36:b12f3922a74f 37:64817133cd1d
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    17 #ifndef CXESOUNDPLAYERSYMBIAN_H
    17 #ifndef CXESOUNDPLAYERSYMBIAN_H
    18 #define CXESOUNDPLAYERSYMBIAN_H
    18 #define CXESOUNDPLAYERSYMBIAN_H
    19 
    19 
    20 #include <QObject>
    20 #include <QObject>
    21 #include <QMetaType>
    21 #include <QMetaType>
       
    22 #include <QVariant>
    22 #include <mdaaudiosampleplayer.h>
    23 #include <mdaaudiosampleplayer.h>
    23 #include "cxestatemachine.h"
    24 #include "cxestatemachine.h"
    24 
    25 
    25 class CMdaAudioPlayerUtility;
    26 class CMdaAudioPlayerUtility;
    26 class CxeCameraDeviceControlSymbian;
    27 class CxeCameraDeviceControlSymbian;
       
    28 class CxeSettings;
    27 
    29 
    28 class CxeSoundPlayerSymbian : public QObject,
    30 class CxeSoundPlayerSymbian : public QObject,
    29                               public CxeStateMachine,
    31                               public CxeStateMachine,
    30                               public MMdaAudioPlayerCallback
    32                               public MMdaAudioPlayerCallback
    31 {
    33 {
    32     Q_OBJECT
    34     Q_OBJECT
    33 public:
    35 public:
    34     /**
    36     /*!
    35      * CaptureSound enum defines different types of capture sounds
    37      * CaptureSound enum defines different types of capture sounds
    36      */
    38      */
    37     enum CaptureSound {
    39     enum CaptureSound {
    38         //! Unknown is used when the capture sound is not set
    40         //! Unknown is used when the capture sound is not set
    39         Unknown = 0,
    41         Unknown = 0,
    45         VideoCaptureStop,
    47         VideoCaptureStop,
    46         //! AutoFocus is used when auto focus completes succesfully
    48         //! AutoFocus is used when auto focus completes succesfully
    47         AutoFocus
    49         AutoFocus
    48     };
    50     };
    49 
    51 
    50     /*
    52     /*!
    51      * Sound player states.
    53      * Sound player states.
    52      */
    54      */
    53     enum State {
    55     enum State {
    54         //! No sound is open
    56         //! No sound is open
    55         NotReady = 0x01,
    57         NotReady = 0x01,
    62 
    64 
    63         //! Playback in progress
    65         //! Playback in progress
    64         Playing = 0x08
    66         Playing = 0x08
    65     };
    67     };
    66 
    68 
    67     CxeSoundPlayerSymbian(CaptureSound soundId);
    69     CxeSoundPlayerSymbian(CaptureSound soundId, CxeSettings &settings);
    68     virtual ~CxeSoundPlayerSymbian();
    70     virtual ~CxeSoundPlayerSymbian();
    69 
    71 
    70     /**
       
    71      * Plays the currently open capture sound.
       
    72      */
       
    73     void play();
    72     void play();
       
    73 
       
    74 public slots:
       
    75     void enableSound(long int uid, unsigned long int key, QVariant value);
    74 
    76 
    75 protected: // from CxeStateMachine
    77 protected: // from CxeStateMachine
    76     void handleStateChanged(int newStateId, CxeError::Id error);
    78     void handleStateChanged(int newStateId, CxeError::Id error);
    77 
    79 
    78 signals:
    80 signals:
    79     /**
    81     /*!
    80      * playComlete signal is emitted when sound has been played.
    82      * playComplete signal is emitted when sound has been played.
    81      * @param error Contains status information whether there was a problem with playing or not
    83      * @param error Contains status information whether there was a problem with playing or not
    82      */
    84      */
    83     void playComplete(int error);
    85     void playComplete(int error);
    84 
    86 
    85 public slots:
    87 public slots:
    87 protected: // from MMdaAudioPlayerCallback
    89 protected: // from MMdaAudioPlayerCallback
    88     void MapcInitComplete(TInt aStatus, const TTimeIntervalMicroSeconds &aDuration);
    90     void MapcInitComplete(TInt aStatus, const TTimeIntervalMicroSeconds &aDuration);
    89     void MapcPlayComplete(TInt aStatus);
    91     void MapcPlayComplete(TInt aStatus);
    90 
    92 
    91 private:
    93 private:
    92     /**
       
    93      * Get current sound player state.
       
    94      */
       
    95     State state() const;
    94     State state() const;
    96 
       
    97     /**
       
    98      *
       
    99      */
       
   100     void doOpen();
    95     void doOpen();
   101 
       
   102     /**
       
   103      * Initialize CxeStateMachine.
       
   104      */
       
   105     void initializeStates();
    96     void initializeStates();
       
    97     void checkCaptureSoundSettings();
   106 
    98 
   107     //! Own.
    99     //! Own.
   108     CMdaAudioPlayerUtility *mAudioPlayer;
   100     CMdaAudioPlayerUtility *mAudioPlayer;
   109 
   101 
   110     //! Currently opened sound file
   102     //! Currently opened sound file
   111     CxeSoundPlayerSymbian::CaptureSound mSoundId;
   103     CxeSoundPlayerSymbian::CaptureSound mSoundId;
       
   104 
       
   105     bool mUseSound;
       
   106     bool mCaptureSoundForced;
       
   107 
       
   108     CxeSettings &mSettings;
       
   109 
   112 };
   110 };
   113 
   111 
   114 Q_DECLARE_METATYPE(CxeSoundPlayerSymbian::State)
   112 Q_DECLARE_METATYPE(CxeSoundPlayerSymbian::State)
   115 
   113 
   116 #endif  // CXESOUNDPLAYERSYMBIAN_H
   114 #endif  // CXESOUNDPLAYERSYMBIAN_H