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: Wrapper for Audio Player Utility |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAM_AUDIOPLAYERWRAPPER_H |
|
20 #define CAM_AUDIOPLAYERWRAPPER_H |
|
21 |
|
22 // =========================================================================== |
|
23 // Includes |
|
24 #include <mdaaudiosampleplayer.h> // for MMdaAudioPlayerCallback |
|
25 #include "mcamplayerwrapper.h" // CCamPlayerWrapperBase |
|
26 |
|
27 // =========================================================================== |
|
28 // Forward declarations |
|
29 class MCamPlayerObserver; |
|
30 |
|
31 // =========================================================================== |
|
32 // Class definitions |
|
33 |
|
34 /** |
|
35 * Audio Player Wrapper class |
|
36 * |
|
37 */ |
|
38 class CCamAudioPlayerWrapper : public CCamPlayerWrapperBase, |
|
39 public MMdaAudioPlayerCallback |
|
40 { |
|
41 // ======================================================= |
|
42 // methods |
|
43 |
|
44 public: // constructors and destructor |
|
45 |
|
46 static CCamAudioPlayerWrapper* NewL( MCamPlayerObserver& aObserver, |
|
47 TInt aSoundId ); |
|
48 virtual ~CCamAudioPlayerWrapper(); |
|
49 |
|
50 public: // from CCamPlayerWrapperBase |
|
51 |
|
52 virtual TInt Id ( ) const; |
|
53 virtual TBool IsEqualSound( TInt aSoundId ) const; |
|
54 virtual void Play ( TBool aCallback ); |
|
55 virtual void CancelPlay ( ); |
|
56 |
|
57 public: // from MMdaAudioPlayerCallback |
|
58 |
|
59 virtual void MapcInitComplete( TInt aStatus, const TTimeIntervalMicroSeconds &aDuration ); |
|
60 virtual void MapcPlayComplete( TInt aStatus ); |
|
61 |
|
62 public: // new static public |
|
63 |
|
64 static TPtrC MapSoundId2FilenameL( TInt aSoundId ); |
|
65 |
|
66 private: // new private |
|
67 |
|
68 void InitL(); |
|
69 void NotifyPlayComplete( TInt aStatus ); |
|
70 |
|
71 private: // private constructors |
|
72 |
|
73 void ConstructL(); |
|
74 |
|
75 CCamAudioPlayerWrapper( MCamPlayerObserver& aObserver, |
|
76 TInt aSoundId ); |
|
77 |
|
78 // ======================================================= |
|
79 // data |
|
80 private: |
|
81 |
|
82 enum TCamAudioPlayerWrapperState |
|
83 { |
|
84 EIdle = 0, |
|
85 EInitializing = 1, |
|
86 EReady = 2, |
|
87 EPlaying = 3, |
|
88 ECorrupt = 4 |
|
89 }; |
|
90 |
|
91 MCamPlayerObserver& iObserver; |
|
92 TInt iSoundId; |
|
93 CMdaAudioPlayerUtility* iPlayer; |
|
94 TCamAudioPlayerWrapperState iState; |
|
95 |
|
96 TBool iPlayRequested; |
|
97 TBool iCallback; |
|
98 |
|
99 // ======================================================= |
|
100 }; |
|
101 |
|
102 #ifdef _DEBUG |
|
103 static const TUint16* KCamAudioPlayerWrapperStateNames[] = |
|
104 { |
|
105 (const TUint16*)_S16("EIdle"), |
|
106 (const TUint16*)_S16("EInitializing"), |
|
107 (const TUint16*)_S16("EReady"), |
|
108 (const TUint16*)_S16("EPlaying"), |
|
109 (const TUint16*)_S16("ECorrupt") |
|
110 }; |
|
111 #endif // _DEBUG |
|
112 |
|
113 #endif // CAM_AUDIOPLAYERWRAPPER_H |
|
114 |
|
115 // =========================================================================== |
|
116 // end of file |
|
117 |
|