diff -r f9bb0fca356a -r 0fd27995241b javauis/mmapi_qt/baseline/inc/cmmamidiplayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/mmapi_qt/baseline/inc/cmmamidiplayer.h Tue May 11 16:07:20 2010 +0300 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2002-2007 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 used for playing MIDI. +* +*/ + + +#ifndef CMMAMIDIPLAYER_H +#define CMMAMIDIPLAYER_H + + +// INCLUDES +#include "cmmaplayer.h" +#include +#include + +// CONSTANTS +_LIT(KMMAMIDIPlayer, "MIDIPlayer"); + +const TMdaPriorityPreference KMMAMIDIPriorityPreference = + EMdaPriorityPreferenceTimeAndQuality; + +// FORWARD DECLARATIONS +class MMAFunctionServer; + +// CLASS DECLARATION +/** +* This class is used for playing MIDI. +* +* +*/ + +class CMMAMIDIPlayer : public CMMAPlayer, public MMidiClientUtilityObserver +{ +public: // Construction + static CMMAMIDIPlayer* NewLC(const TDesC& aContentType, + TFileName aFileName); + + // Destructor + ~CMMAMIDIPlayer(); + +protected: + // C++ constructor + CMMAMIDIPlayer(TFileName aFileName); + void ConstructL(const TDesC& aContentType); + +public: // new methods + IMPORT_C CMidiClientUtility* MidiClient() const; + void ReInitializeMidiEngineL(const TDesC8* aMidiSequence); + void addObserverL(MMidiClientUtilityObserver* aObserver); + +public: // from CMMAPlayer + void StartL(); + void StopL(TBool aPostEvent); + void RealizeL(); + void PrefetchL(); + void DeallocateL(); + void GetDuration(TInt64* aDuration); + void SetMediaTimeL(TInt64* aTime); + void GetMediaTime(TInt64* aMediaTime); + void CloseL(); + const TDesC& Type(); + +public: // from CMMAPlayer/MMMASourceStreamListener + void ReadCompletedL(TInt aStatus, const TDesC8& aData); + void PlayCompleteL(TInt aError); + +public: // from MMidiClientUtilityObserver + void MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& aTime,TInt aError); + void MmcuoTempoChanged(TInt aMicroBeatsPerMinute); + void MmcuoVolumeChanged(TInt aChannel,TReal32 aVolumeInDecibels); + void MmcuoMuteChanged(TInt aChannel,TBool aMuted); + void MmcuoSyncUpdate(const TTimeIntervalMicroSeconds& aMicroSeconds,TInt64 aMicroBeats); + void MmcuoMetaDataEntryFound(const TInt aMetaDataEntryId,const TTimeIntervalMicroSeconds& aPosition); + void MmcuoMipMessageReceived(const RArray& aMessage); + void MmcuoPolyphonyChanged(TInt aNewPolyphony); + void MmcuoInstrumentChanged(TInt aChannel,TInt aBankId,TInt aInstrumentId); + +protected: + void CloseClientUtility(); + +private: // Data + CMidiClientUtility* iMidi; + + // CActiveShedulerWait object for reinitializing midi engine + CActiveSchedulerWait* iActiveSchedulerWait; + + // Array for subsequent MMidiClientUtilityObservers + RPointerArray iObservers; + + TFileName iFileName; + + /** + * Cached media time + */ + TInt64 iMediaTime; + + /** + * The time that will be sent with CMMAPlayerEvent::EStarted + * (may be different from iMediaTime). + */ + TInt64 iStartedEventTime; +}; + +#endif // CMMAMIDIPLAYER_H