javauis/mmapi_qt/baseline/inc/cmmamiditempocontrol.h
changeset 23 98ccebc37403
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 implements MIDITempoControl functionality.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMMAMIDITEMPOCONTROL_H
       
    20 #define CMMAMIDITEMPOCONTROL_H
       
    21 
       
    22 // EXTERNAL INCLUDES
       
    23 #include <midiclientutility.h> // MMidiClientUtilityObserver
       
    24 
       
    25 //  INTERNAL INCLUDES
       
    26 #include "cmmaratecontrol.h" // base class
       
    27 #include "mmmaplayerstatelistener.h"
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // Constant for control name. Name is used in Java side to instantiate
       
    32 // Java Class which uses CMMAMIDITempoControl.
       
    33 _LIT(KMIDITempoControlName, "TempoControl");
       
    34 
       
    35 class CMMAMIDIPlayer;
       
    36 
       
    37 //  CLASS DECLARATION
       
    38 /**
       
    39 *   This class implements MIDITempoControl interface.
       
    40 *
       
    41 *
       
    42 */
       
    43 NONSHARABLE_CLASS(CMMAMIDITempoControl): public CMMARateControl,
       
    44         public MMidiClientUtilityObserver, public MMMAPlayerStateListener
       
    45 {
       
    46 public:
       
    47     /**
       
    48      * Creates new CMMAMIDITempoControl.
       
    49      *
       
    50      * @param aPlayer Player that plays the content.
       
    51      */
       
    52     static CMMAMIDITempoControl* NewL(CMMAMIDIPlayer* aPlayer);
       
    53 
       
    54     /**
       
    55      * Destructor.
       
    56      */
       
    57     ~CMMAMIDITempoControl();
       
    58 protected:
       
    59     /**
       
    60      * Constructor.
       
    61      * @param aPlayer Player that plays the content.
       
    62      */
       
    63     CMMAMIDITempoControl(CMMAMIDIPlayer* aPlayer);
       
    64 
       
    65     /**
       
    66      * Initializes this control.
       
    67      */
       
    68     void ConstructL();
       
    69 
       
    70 public: // From CMMAControl
       
    71     const TDesC& ClassName() const;
       
    72 
       
    73 public: // From CMMARateControl
       
    74     /**
       
    75      * @param aRate Rate to set in "milli-percentage"..
       
    76      * @return Actual rate set.
       
    77      */
       
    78     TInt SetRateL(TInt aRate);
       
    79 
       
    80     /**
       
    81      * @return The current playback rate in "milli-percentage".
       
    82      */
       
    83     TInt RateL();
       
    84 
       
    85     /**
       
    86      * @return The maximum rate supported.
       
    87      */
       
    88     TInt MaxRateL();
       
    89 
       
    90     /**
       
    91      * @return The minimum rate supported.
       
    92      */
       
    93     TInt MinRateL();
       
    94 
       
    95 public: // New methods
       
    96     /**
       
    97      * @return Tempo, if not available the default.
       
    98      */
       
    99     TInt TempoL();
       
   100 
       
   101     /**
       
   102      * @param aTempo Tempo to set in milli-beats per minute.
       
   103      * @return Actual Tempo set.
       
   104      */
       
   105     TInt SetTempoL(TInt aTempo);
       
   106 
       
   107 public:   // From MMMAPlayerStateListener
       
   108     void StateChanged(TInt aState);
       
   109 
       
   110 public: // from MMidiClientUtilityObserver
       
   111     void MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& aTime,TInt aError);
       
   112     void MmcuoTempoChanged(TInt aMicroBeatsPerMinute);
       
   113     void MmcuoVolumeChanged(TInt aChannel,TReal32 aVolumeInDecibels);
       
   114     void MmcuoMuteChanged(TInt aChannel,TBool aMuted);
       
   115     void MmcuoSyncUpdate(const TTimeIntervalMicroSeconds& aMicroSeconds,TInt64 aMicroBeats);
       
   116     void MmcuoMetaDataEntryFound(const TInt aMetaDataEntryId,const TTimeIntervalMicroSeconds& aPosition);
       
   117     void MmcuoMipMessageReceived(const RArray<TMipMessageEntry>& aMessage);
       
   118     void MmcuoPolyphonyChanged(TInt aNewPolyphony);
       
   119     void MmcuoInstrumentChanged(TInt aChannel,TInt aBankId,TInt aInstrumentId);
       
   120 
       
   121 private: // Data
       
   122     /**
       
   123      * Used to control MIDI playback.
       
   124      */
       
   125     CMMAMIDIPlayer* iPlayer;
       
   126 
       
   127     /**
       
   128      * Current tempo. Unit of the variable is milli-beat.
       
   129      * Tempo cannot be set to the midi client before the player is
       
   130      * prefetched. Thus, when the player is in REALIZED state, tempo is
       
   131      * saved to this variable and set to the client when the player is
       
   132      * prefetched.
       
   133      */
       
   134     TInt iTempo;
       
   135 
       
   136 };
       
   137 
       
   138 
       
   139 #endif // CMMAMIDITEMPOCONTROL_H