javauis/mmapi_qt/baseline/src/cmmamidipitchcontrol.cpp
changeset 23 98ccebc37403
child 26 dc7c549001d5
equal deleted inserted replaced
21:2a9601315dfc 23:98ccebc37403
       
     1 /*
       
     2 * Copyright (c) 2002 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 a PitchControl.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDE FILES
       
    20 #include <logger.h>
       
    21 
       
    22 #include "cmmamidipitchcontrol.h"
       
    23 #include "cmmamidiplayer.h"
       
    24 
       
    25 CMMAMIDIPitchControl* CMMAMIDIPitchControl::NewL(CMMAMIDIPlayer* aPlayer)
       
    26 {
       
    27     CMMAMIDIPitchControl* self = new(ELeave) CMMAMIDIPitchControl(aPlayer);
       
    28     return self;
       
    29 }
       
    30 
       
    31 CMMAMIDIPitchControl::CMMAMIDIPitchControl(CMMAMIDIPlayer* aPlayer)
       
    32 {
       
    33     iPlayer = aPlayer;
       
    34     LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDIPitchControl::CMMAMIDIPitchControl");
       
    35 }
       
    36 
       
    37 CMMAMIDIPitchControl::~CMMAMIDIPitchControl()
       
    38 {
       
    39     LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDIPitchControl::~CMMAMIDIPitchControl");
       
    40 }
       
    41 
       
    42 const TDesC& CMMAMIDIPitchControl::ClassName() const
       
    43 {
       
    44     LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDIPitchControl::ClassName");
       
    45     return KMIDIPitchControlName;
       
    46 }
       
    47 
       
    48 
       
    49 TInt CMMAMIDIPitchControl::PitchL()
       
    50 {
       
    51     return iPlayer->MidiClient()->PitchTranspositionCentsL();
       
    52 }
       
    53 
       
    54 TInt CMMAMIDIPitchControl::SetPitchL(TInt aPitch)
       
    55 {
       
    56     TInt pitch = aPitch;
       
    57     if (aPitch > KMIDIPitchControlMaxPitch)
       
    58     {
       
    59         pitch = KMIDIPitchControlMaxPitch;
       
    60     }
       
    61     else if (aPitch < KMIDIPitchControlMinPitch)
       
    62     {
       
    63         pitch = KMIDIPitchControlMinPitch;
       
    64     }
       
    65     iPlayer->MidiClient()->SetPitchTranspositionL(pitch);
       
    66 
       
    67     return PitchL();            // return the actual Pitch
       
    68 }
       
    69 
       
    70 // this method is intentionally left leaving to allow leaving implementation in the future
       
    71 TInt CMMAMIDIPitchControl::MaxPitchL()
       
    72 {
       
    73     return KMIDIPitchControlMaxPitch;
       
    74 }
       
    75 
       
    76 // this method is intentionally left leaving to allow leaving implementation in the future
       
    77 TInt CMMAMIDIPitchControl::MinPitchL()
       
    78 {
       
    79     return KMIDIPitchControlMinPitch;
       
    80 }
       
    81 
       
    82 //  END OF FILE