commands/play/play.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // play.h
       
     2 // 
       
     3 // Copyright (c) 2005 - 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "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 // Accenture - Initial contribution
       
    11 //
       
    12 
       
    13 #ifndef __PLAY_H__
       
    14 #define __PLAY_H__
       
    15 
       
    16 #include <fshell/ioutils.h>
       
    17 #include <MdaAudioSampleEditor.h>
       
    18 
       
    19 using namespace IoUtils;
       
    20 
       
    21 class CMmfPlayer;
       
    22 
       
    23 class CCmdPlay	: public CCommandBase
       
    24 	{
       
    25 public:
       
    26 	static CCommandBase* NewLC();
       
    27 	~CCmdPlay();
       
    28 private: // From CCommandBase.
       
    29 	virtual const TDesC& Name() const;
       
    30 	virtual void DoRunL();
       
    31 	virtual void OptionsL(RCommandOptionList& aOptions);
       
    32 	virtual void ArgumentsL(RCommandArgumentList& aArguments);
       
    33 private:
       
    34 	CCmdPlay();
       
    35 	void ConstructL();
       
    36 private:
       
    37 	CMmfPlayer* iPlayer;
       
    38 	TFileName2 iFile;
       
    39 	TInt iPriority;
       
    40 	TInt iPreference;
       
    41 	TInt iVolume;
       
    42 	TBool iVerbose;
       
    43 	TBool iMaxVolume;
       
    44 	};
       
    45 
       
    46 
       
    47 class CConsoleKeystrokeNotifier;
       
    48 
       
    49 class CMmfPlayer : public CActive, public MMdaObjectStateChangeObserver
       
    50 	{
       
    51 public:
       
    52 	static CMmfPlayer* NewL(RIoConsoleWriteHandle& aStdOut);
       
    53 	virtual ~CMmfPlayer();
       
    54 	
       
    55 	TInt GetMaxVolume();
       
    56 	TInt Error();
       
    57 	
       
    58 	void GetReady(const TDesC& aFileName, TBool aVerbose);
       
    59 	void SetPriority(TInt aPriority, TInt iPreference);
       
    60 	void SetVolume(TInt aVolume);
       
    61 	
       
    62 	virtual void RunL();
       
    63 	virtual TInt RunError(TInt aError);
       
    64 	virtual void DoCancel();
       
    65 	
       
    66 	virtual void MoscoStateChangeEvent(CBase *aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode);
       
    67 	
       
    68 	void KeyStroke(TKeyCode aCode);
       
    69 private:
       
    70 	CMmfPlayer(RIoConsoleWriteHandle& aStdOut);
       
    71 	void ConstructL();
       
    72 	void Message(TRefByValue<const TDesC> aFmt, ...);
       
    73 	void ProcessL();
       
    74 	void Error(TInt aError);
       
    75 	void Stop();
       
    76 private:
       
    77 	RIoConsoleWriteHandle& iStdOut;
       
    78 	TBuf<0x200> iMsgBuf;
       
    79 	
       
    80 	const TDesC* iFileName;
       
    81 	
       
    82 	enum TState
       
    83 		{
       
    84 		EInitial,
       
    85 		EOpening,
       
    86 		EPlaying,
       
    87 		};
       
    88 	TState iState;
       
    89 	
       
    90 	CMdaAudioRecorderUtility* iUtil;
       
    91 	TInt iVolume;
       
    92 	TBool iVerbose;
       
    93 	TInt iError;
       
    94 	};
       
    95 
       
    96 class TTruncateOverflow : public TDes16Overflow
       
    97 	{
       
    98 	virtual void Overflow(TDes16& /*aDes*/) {};
       
    99 	};
       
   100 	
       
   101 #endif // __PLAY_H__