|
1 /* |
|
2 * Copyright (c) 2008 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: Implementation of CDevSoundIf |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: 5 % |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <mmf/server/sounddevice.h> |
|
24 #include <devsoundif.h> |
|
25 |
|
26 #include "playbackhelper_log.h" |
|
27 |
|
28 // CONSTANTS |
|
29 const TInt KTenStepsVolume = 10; |
|
30 const TInt KTwentyStepsVolume = 20; |
|
31 |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =================================================== |
|
34 |
|
35 // ------------------------------------------------------------------------------------------------- |
|
36 // CDevSoundIf::CDevSoundIf |
|
37 // C++ default constructor can NOT contain any code, that might leave. |
|
38 // ------------------------------------------------------------------------------------------------- |
|
39 // |
|
40 CDevSoundIf::CDevSoundIf() |
|
41 { |
|
42 PLAYBACKHELPER_DEBUG(_L("CDevSoundIf::CDevSoundIf()")); |
|
43 } |
|
44 |
|
45 // ------------------------------------------------------------------------------------------------- |
|
46 // CDevSoundIf::ConstructL |
|
47 // Symbian 2nd phase constructor can leave. |
|
48 // ------------------------------------------------------------------------------------------------- |
|
49 // |
|
50 void CDevSoundIf::ConstructL() |
|
51 { |
|
52 PLAYBACKHELPER_DEBUG(_L("CDevSoundIf::ConstructL()")); |
|
53 |
|
54 iDevSound = CMMFDevSound::NewL(); |
|
55 } |
|
56 |
|
57 // ------------------------------------------------------------------------------------------------- |
|
58 // CDevSoundIf::NewL |
|
59 // Two-phased constructor. |
|
60 // ------------------------------------------------------------------------------------------------- |
|
61 // |
|
62 EXPORT_C CDevSoundIf* CDevSoundIf::NewL() |
|
63 { |
|
64 PLAYBACKHELPER_DEBUG(_L("CDevSoundIf::NewL()")); |
|
65 |
|
66 CDevSoundIf* self = new( ELeave ) CDevSoundIf; |
|
67 CleanupStack::PushL( self ); |
|
68 self->ConstructL(); |
|
69 CleanupStack::Pop(); |
|
70 return self; |
|
71 } |
|
72 |
|
73 // ------------------------------------------------------------------------------------------------- |
|
74 // CDevSoundIf::~CDevSoundIf |
|
75 // Destructor |
|
76 // ------------------------------------------------------------------------------------------------- |
|
77 // |
|
78 EXPORT_C CDevSoundIf::~CDevSoundIf() |
|
79 { |
|
80 PLAYBACKHELPER_DEBUG(_L("CDevSoundIf::~CDevSoundIf()")); |
|
81 |
|
82 if ( iDevSound ) |
|
83 { |
|
84 delete iDevSound; |
|
85 } |
|
86 |
|
87 } |
|
88 |
|
89 // ------------------------------------------------------------------------------------------------- |
|
90 // CDevSoundIf::GetNumberOfVolumeSteps |
|
91 // ------------------------------------------------------------------------------------------------- |
|
92 // |
|
93 EXPORT_C TInt CDevSoundIf::GetNumberOfVolumeSteps() |
|
94 { |
|
95 // |
|
96 // set default 10-steps volume |
|
97 // |
|
98 TInt volumeSteps = KTenStepsVolume; |
|
99 |
|
100 if ( iDevSound && |
|
101 iDevSound->MaxVolume() >= KTwentyStepsVolume ) |
|
102 { |
|
103 // |
|
104 // set 20-steps volume |
|
105 // |
|
106 volumeSteps = KTwentyStepsVolume; |
|
107 } |
|
108 |
|
109 PLAYBACKHELPER_DEBUG(_L("CDevSoundIf::GetNumberOfVolumeSteps() returns [%d]"), volumeSteps); |
|
110 |
|
111 return volumeSteps; |
|
112 } |
|
113 |
|
114 // End of File |