equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2002-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: This class is used for setting volume to audio player |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <logger.h> |
|
20 #include "cmmamidivolumecontrol.h" |
|
21 #include "cmmamidiplayer.h" |
|
22 |
|
23 CMMAMIDIVolumeControl::CMMAMIDIVolumeControl(CMMAMIDIPlayer* aPlayer) |
|
24 : CMMAVolumeControl(aPlayer) |
|
25 { |
|
26 iPlayer = aPlayer; |
|
27 } |
|
28 |
|
29 void CMMAMIDIVolumeControl::ConstructL() |
|
30 { |
|
31 ConstructBaseL(); |
|
32 } |
|
33 |
|
34 CMMAMIDIVolumeControl* CMMAMIDIVolumeControl::NewL(CMMAMIDIPlayer* aPlayer) |
|
35 { |
|
36 CMMAMIDIVolumeControl* self = new(ELeave)CMMAMIDIVolumeControl(aPlayer); |
|
37 CleanupStack::PushL(self); |
|
38 self->ConstructL(); |
|
39 CleanupStack::Pop(); |
|
40 return self; |
|
41 } |
|
42 |
|
43 void CMMAMIDIVolumeControl::DoSetLevelL(TInt aLevel) |
|
44 { |
|
45 CMidiClientUtility* midi = iPlayer->MidiClient(); |
|
46 TInt maxVolume = midi->MaxVolumeL(); |
|
47 midi->SetVolumeL(aLevel * maxVolume / KMMAVolumeMaxLevel); |
|
48 } |
|
49 |
|
50 TInt CMMAMIDIVolumeControl::DoGetLevelL() |
|
51 { |
|
52 CMidiClientUtility* midi = iPlayer->MidiClient(); |
|
53 // result is in range 0..100 |
|
54 return (midi->VolumeL() * KMMAVolumeMaxLevel / midi->MaxVolumeL()); |
|
55 } |
|
56 |
|
57 |
|
58 // END OF FILE |
|
59 |