|
1 /* |
|
2 * Copyright (c) 2005-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: AMMS player builder for adding AMMS audio player controls. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <CMMAMIDIPlayer.h> |
|
21 #include <CMMAAudioPlayer.h> |
|
22 #include <jdebug.h> |
|
23 |
|
24 #include "CAMMSAudioPlayerBuilder.h" |
|
25 #include "CAMMSCustomCommandUtility.h" |
|
26 |
|
27 #include "CAMMSEqualizerControl.h" |
|
28 #include "CAMMSReverbControl.h" |
|
29 #include "CAMMSReverbSourceControl.h" |
|
30 #include "CAMMSAudioVirtualizerControl.h" |
|
31 #include "CAMMSPanControl.h" |
|
32 #include "CAMMSDistanceAttenuationControl.h" |
|
33 #include "CAMMSAudioDopplerControl.h" |
|
34 #include "CAMMSSpectatorDopplerControl.h" |
|
35 #include "CAMMSAudioLocationControl.h" |
|
36 #include "CAMMSSpectatorLocationControl.h" |
|
37 #include "CAMMSSpectatorOrientationControl.h" |
|
38 #include "CAMMSVolumeControl.h" |
|
39 #include "AMMSConstants.h" |
|
40 |
|
41 // ============================ MEMBER FUNCTIONS =============================== |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CAMMSAudioPlayerBuilder::NewLC |
|
45 // Two-phased constructor. |
|
46 // ----------------------------------------------------------------------------- |
|
47 CAMMSAudioPlayerBuilder* CAMMSAudioPlayerBuilder::NewLC() |
|
48 { |
|
49 CAMMSAudioPlayerBuilder* self = new(ELeave) CAMMSAudioPlayerBuilder(); |
|
50 |
|
51 CleanupStack::PushL(self); |
|
52 |
|
53 return self; |
|
54 } |
|
55 |
|
56 // Destructor |
|
57 CAMMSAudioPlayerBuilder::~CAMMSAudioPlayerBuilder() |
|
58 { |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CAMMSAudioPlayerBuilder::PreparePlayerL |
|
63 // Adds the AMMS audio controls to the player. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 void CAMMSAudioPlayerBuilder::PreparePlayerL(CMMAPlayer* aPlayer) |
|
67 { |
|
68 const TDesC& playerType = aPlayer->Type(); |
|
69 |
|
70 DEBUG_STR("AMMS::CAMMSAudioPlayerBuilder::PreparePlayerL type %S", |
|
71 playerType); |
|
72 |
|
73 if ((playerType != KMMAAudioPlayer) && |
|
74 (playerType != KMMAMIDIPlayer)) |
|
75 { |
|
76 DEBUG("AMMS::CAMMSAudioPlayerBuilder::PreparePlayerL, not supported"); |
|
77 return; |
|
78 } |
|
79 |
|
80 |
|
81 // Default type for a Control is base Control (=not a derived Control). |
|
82 // DopplerControl and LocationControl have different Effect API |
|
83 // implementations and also different corresponding AMMS Controls for |
|
84 // SoundSource3D and for Spectator, so these Control types need to be |
|
85 // set accordingly. |
|
86 // |
|
87 // CMMAPlayer::AddControlL( CMMAControl* aControl ) adds a new control. |
|
88 // Ownership of the control is transferred to CMMAPlayer. |
|
89 // |
|
90 |
|
91 #ifndef __WINS__ |
|
92 // PanControl is not supported in WINSCW builds. |
|
93 // This is because of limited pan support in DirectX. |
|
94 CAMMSPanControl* panControl = CAMMSPanControl::NewLC(aPlayer); |
|
95 aPlayer->AddControlL(panControl); |
|
96 CleanupStack::Pop(panControl); |
|
97 #endif // __WINS__ |
|
98 |
|
99 CAMMSEqualizerControl* equalizerControl = |
|
100 CAMMSEqualizerControl::NewLC(aPlayer); |
|
101 aPlayer->AddControlL(equalizerControl); |
|
102 CleanupStack::Pop(equalizerControl); |
|
103 |
|
104 CAMMSReverbControl* reverbControl = |
|
105 CAMMSReverbControl::NewLC(aPlayer); |
|
106 aPlayer->AddControlL(reverbControl); |
|
107 CleanupStack::Pop(reverbControl); |
|
108 |
|
109 CAMMSAudioVirtualizerControl* audioVirtualizerControl = |
|
110 CAMMSAudioVirtualizerControl::NewLC(aPlayer); |
|
111 aPlayer->AddControlL(audioVirtualizerControl); |
|
112 CleanupStack::Pop(audioVirtualizerControl); |
|
113 |
|
114 CAMMSReverbSourceControl* reverbSourceControl = |
|
115 CAMMSReverbSourceControl::NewLC(aPlayer, reverbControl); |
|
116 aPlayer->AddControlL(reverbSourceControl); |
|
117 CleanupStack::Pop(reverbSourceControl); |
|
118 |
|
119 CAMMSDistanceAttenuationControl* distanceAttenuationControl = |
|
120 CAMMSDistanceAttenuationControl::NewLC(aPlayer); |
|
121 aPlayer->AddControlL(distanceAttenuationControl); |
|
122 CleanupStack::Pop(distanceAttenuationControl); |
|
123 |
|
124 CAMMSAudioDopplerControl* audioDopplerControl = |
|
125 CAMMSAudioDopplerControl::NewLC(aPlayer); |
|
126 audioDopplerControl->iControlType = EAMMSSoundSource3DControl; |
|
127 aPlayer->AddControlL(audioDopplerControl); |
|
128 CleanupStack::Pop(audioDopplerControl); |
|
129 |
|
130 CAMMSSpectatorDopplerControl* spectatorDopplerControl = |
|
131 CAMMSSpectatorDopplerControl::NewLC(aPlayer); |
|
132 spectatorDopplerControl->iControlType = EAMMSSpectatorControl; |
|
133 aPlayer->AddControlL(spectatorDopplerControl); |
|
134 CleanupStack::Pop(spectatorDopplerControl); |
|
135 |
|
136 CAMMSAudioLocationControl* audioLocationControl = |
|
137 CAMMSAudioLocationControl::NewLC(aPlayer); |
|
138 audioLocationControl->iControlType = EAMMSSoundSource3DControl; |
|
139 aPlayer->AddControlL(audioLocationControl); |
|
140 CleanupStack::Pop(audioLocationControl); |
|
141 |
|
142 CAMMSSpectatorLocationControl* spectatorLocationControl = |
|
143 CAMMSSpectatorLocationControl::NewLC(aPlayer); |
|
144 spectatorLocationControl->iControlType = EAMMSSpectatorControl; |
|
145 aPlayer->AddControlL(spectatorLocationControl); |
|
146 CleanupStack::Pop(spectatorLocationControl); |
|
147 |
|
148 CAMMSSpectatorOrientationControl* spectatorOrientationControl = |
|
149 CAMMSSpectatorOrientationControl::NewLC(aPlayer); |
|
150 aPlayer->AddControlL(spectatorOrientationControl); |
|
151 CleanupStack::Pop(spectatorOrientationControl); |
|
152 |
|
153 DEBUG("AMMS::CAMMSAudioPlayerBuilder::PreparePlayerL add OK"); |
|
154 } |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // CAMMSAudioPlayerBuilder::CAMMSAudioPlayerBuilder |
|
158 // C++ default constructor can NOT contain any code, that |
|
159 // might leave. |
|
160 // ----------------------------------------------------------------------------- |
|
161 CAMMSAudioPlayerBuilder::CAMMSAudioPlayerBuilder() |
|
162 { |
|
163 } |
|
164 |
|
165 // End of File |