54
|
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: Handles the playing of sounds and tones for the Camera App*
|
|
15 |
*/
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CAMSOUNDPLAYER_H
|
|
20 |
#define CAMSOUNDPLAYER_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <MdaAudioSamplePlayer.h>
|
|
24 |
#include "Cam.hrh" // For TCamSoundId
|
|
25 |
|
|
26 |
// CONSTANTS
|
|
27 |
|
|
28 |
// MACROS
|
|
29 |
|
|
30 |
// DATA TYPES
|
|
31 |
|
|
32 |
// FUNCTION PROTOTYPES
|
|
33 |
|
|
34 |
// FORWARD DECLARATIONS
|
|
35 |
class CAknKeySoundSystem;
|
|
36 |
|
|
37 |
// CLASS DECLARATION
|
|
38 |
|
|
39 |
|
|
40 |
/**
|
|
41 |
* Observer class for getting notified when sound playback completes.
|
|
42 |
*/
|
|
43 |
class MCamSoundPlayerObserver
|
|
44 |
{
|
|
45 |
public:
|
|
46 |
/**
|
|
47 |
* CCamSoundPlayer has finished sound playback
|
|
48 |
* and callback was requested (aEnableCallback was true
|
|
49 |
* in CCamSoundPlayer::PlaySound()).
|
|
50 |
* @since 2.8
|
|
51 |
*/
|
|
52 |
virtual void PlaySoundComplete() = 0;
|
|
53 |
};
|
|
54 |
|
|
55 |
/**
|
|
56 |
* This class is used to play sounds and tones for the Camera app
|
|
57 |
*
|
|
58 |
* @since 2.8
|
|
59 |
*/
|
|
60 |
class CCamSoundPlayer : public CBase,
|
|
61 |
public MMdaAudioPlayerCallback
|
|
62 |
{
|
|
63 |
public: // Constructors and destructor
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Two-phased constructor.
|
|
67 |
* @param aObs Observer to be informed when sound playback is complete.
|
|
68 |
*/
|
|
69 |
static CCamSoundPlayer* NewL( MCamSoundPlayerObserver* aObs );
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Destructor.
|
|
73 |
*/
|
|
74 |
virtual ~CCamSoundPlayer();
|
|
75 |
|
|
76 |
public: // New functions
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Initialises the sound player.
|
|
80 |
* @since 2.8
|
|
81 |
*/
|
|
82 |
void InitialiseL();
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Starts procedure to play the specified sound
|
|
86 |
* @since 2.8
|
|
87 |
* @param aSound The sound to play
|
|
88 |
* @param aEnableCallback Whether to call back when play complete
|
|
89 |
*/
|
|
90 |
void PlaySound( TCamSoundId aSound, TBool aEnableCallback );
|
|
91 |
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Called to disable certain key press clicks
|
|
95 |
* @since 2.8
|
|
96 |
*/
|
|
97 |
void DisableSelectionKeySoundL();
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Called to enable certain key press clicks
|
|
101 |
* @since 2.8
|
|
102 |
*/
|
|
103 |
void EnableSelectionKeySound();
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Called to disable all key sounds, usually when video recording
|
|
107 |
* is active
|
|
108 |
* @since 2.8
|
|
109 |
*/
|
|
110 |
void DisableAllKeySoundsL();
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Called to enable all key sounds, usually when video recording
|
|
114 |
* is has stopped
|
|
115 |
* @since 2.8
|
|
116 |
*/
|
|
117 |
void EnableAllKeySounds();
|
|
118 |
|
|
119 |
|
|
120 |
public: // Functions from base classes
|
|
121 |
/**
|
|
122 |
* From MMdaAudioPlayerCallback.
|
|
123 |
* @since 2.8
|
|
124 |
*/
|
|
125 |
void MapcInitComplete( TInt aError,
|
|
126 |
const TTimeIntervalMicroSeconds& aDuration );
|
|
127 |
|
|
128 |
/**
|
|
129 |
* From MMdaAudioPlayerCallback.
|
|
130 |
* @since 2.8
|
|
131 |
*/
|
|
132 |
void MapcPlayComplete( TInt aError );
|
|
133 |
|
|
134 |
private:
|
|
135 |
|
|
136 |
/**
|
|
137 |
* C++ default constructor.
|
|
138 |
* @since 2.8
|
|
139 |
* @param aObs Observer to be informed when sound playback is complete.
|
|
140 |
*/
|
|
141 |
CCamSoundPlayer( MCamSoundPlayerObserver* aObs );
|
|
142 |
|
|
143 |
/**
|
|
144 |
* By default Symbian 2nd phase constructor is private.
|
|
145 |
*/
|
|
146 |
void ConstructL();
|
|
147 |
|
|
148 |
/**
|
|
149 |
* Starts procedure to play audio (WAV) files. Internal function
|
|
150 |
* @since 2.8
|
|
151 |
* @param aFile The file to open
|
|
152 |
* @param aEnableCallback Whether to call back when play complete
|
|
153 |
*/
|
|
154 |
void StartPlaySound( const TDesC& aFile, const TBool aEnableCallback );
|
|
155 |
|
|
156 |
public: // Data
|
|
157 |
|
|
158 |
// Audio player utility for WAV sounds (eg Video Recording)
|
|
159 |
CMdaAudioPlayerUtility* iAudioPlayer;
|
|
160 |
|
|
161 |
// Key sound system for Self-timer sound and camera shutter.
|
|
162 |
CAknKeySoundSystem* iKeySoundSystem;
|
|
163 |
|
|
164 |
// Observer to notify when playback completes
|
|
165 |
MCamSoundPlayerObserver* iObserver;
|
|
166 |
|
|
167 |
// Whether file open is still in progress
|
|
168 |
TBool iOpenFileInProgress;
|
|
169 |
|
|
170 |
// Whether a callback for current sound has been requested
|
|
171 |
TBool iEnableCallback;
|
|
172 |
|
|
173 |
// Whether this class has been initialised yet
|
|
174 |
TBool iInitialised;
|
|
175 |
|
|
176 |
// Whether selection keys have been silenced
|
|
177 |
TBool iSelectionKeySilent;
|
|
178 |
|
|
179 |
// Whether all keys have been silenced
|
|
180 |
TBool iAllKeysSilent;
|
|
181 |
|
|
182 |
};
|
|
183 |
|
|
184 |
#endif // CAMSOUNDPLAYER_H
|
|
185 |
|
|
186 |
// End of File
|