javauis/mmapi_qt/baseline/src/cmmamidipitchcontrol.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 15:09:22 +0300
branchRCL_3
changeset 65 ae942d28ec0e
permissions -rw-r--r--
Revision: v2.2.11 Kit: 201035

/*
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  This class is a PitchControl.
*
*/


//  INCLUDE FILES
#include <logger.h>

#include "cmmamidipitchcontrol.h"
#include "cmmamidiplayer.h"

CMMAMIDIPitchControl* CMMAMIDIPitchControl::NewL(CMMAMIDIPlayer* aPlayer)
{
    CMMAMIDIPitchControl* self = new(ELeave) CMMAMIDIPitchControl(aPlayer);
    return self;
}

CMMAMIDIPitchControl::CMMAMIDIPitchControl(CMMAMIDIPlayer* aPlayer)
{
    iPlayer = aPlayer;
    LOG(EJavaMMAPI, EInfo, "MMA:CMMAMIDIPitchControl::CMMAMIDIPitchControl");
}

CMMAMIDIPitchControl::~CMMAMIDIPitchControl()
{
    LOG(EJavaMMAPI, EInfo, "MMA:CMMAMIDIPitchControl::~CMMAMIDIPitchControl");
}

const TDesC& CMMAMIDIPitchControl::ClassName() const
{
    LOG(EJavaMMAPI, EInfo, "MMA:CMMAMIDIPitchControl::ClassName");
    return KMIDIPitchControlName;
}


TInt CMMAMIDIPitchControl::PitchL()
{
    return iPlayer->MidiClient()->PitchTranspositionCentsL();
}

TInt CMMAMIDIPitchControl::SetPitchL(TInt aPitch)
{
    TInt pitch = aPitch;
    if (aPitch > KMIDIPitchControlMaxPitch)
    {
        pitch = KMIDIPitchControlMaxPitch;
    }
    else if (aPitch < KMIDIPitchControlMinPitch)
    {
        pitch = KMIDIPitchControlMinPitch;
    }
    iPlayer->MidiClient()->SetPitchTranspositionL(pitch);

    return PitchL();            // return the actual Pitch
}

// this method is intentionally left leaving to allow leaving implementation in the future
TInt CMMAMIDIPitchControl::MaxPitchL()
{
    return KMIDIPitchControlMaxPitch;
}

// this method is intentionally left leaving to allow leaving implementation in the future
TInt CMMAMIDIPitchControl::MinPitchL()
{
    return KMIDIPitchControlMinPitch;
}

//  END OF FILE