mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioToneTestModule/inc/TonePlayer.h
changeset 0 71ca22bcf22a
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     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:  MmfTsTone test module.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TONE_PLAYER_H
       
    20 #define TONE_PLAYER_H
       
    21 
       
    22 #include <Stiftestinterface.h>
       
    23 #include <MdaAudioTonePlayer.h>
       
    24 #include <StifLogger.h>
       
    25 #include "EventTarget.h"
       
    26 #include "ObjectCountDown.h"
       
    27 #include "ActiveScheduledTestModuleBase.h"
       
    28 
       
    29 class CTonePlayer : public CBase , public MEventTarget , public MMdaAudioToneObserver
       
    30 	{
       
    31 private:
       
    32 	//CTonePlayer(CLogger *aLogger);
       
    33 	CTonePlayer(COutputPrinter *aOutputPrinter);
       
    34 
       
    35 	void Exit(TInt aExitCode);
       
    36 	void ConstructL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration, TBool aPlayInmediately=ETrue);
       
    37 	void ConstructL();
       
    38 
       
    39 	void CancelPrepare();
       
    40 
       
    41 public:
       
    42 	// Standard two-phase construction
       
    43 	//static CTonePlayer* NewL(CLogger *aLogger, TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration, TBool aPlayInmediately=ETrue);
       
    44 	//static CTonePlayer* NewLC(CLogger *aLogger, TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration, TBool aPlayInmediately=ETrue);
       
    45 
       
    46 	//static CTonePlayer* NewL(CLogger *aLogger);
       
    47 	//static CTonePlayer* NewLC(CLogger *aLogger);
       
    48 
       
    49 	static CTonePlayer* NewL(COutputPrinter *aOutputPrinter, TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration, TBool aPlayInmediately=ETrue);
       
    50 	static CTonePlayer* NewLC(COutputPrinter *aOutputPrinter, TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration, TBool aPlayInmediately=ETrue);
       
    51 
       
    52 	static CTonePlayer* NewL(COutputPrinter *aOutputPrinter);
       
    53 	static CTonePlayer* NewLC(COutputPrinter *aOutputPrinter);
       
    54 
       
    55 	~CTonePlayer();
       
    56 	TBool Play();
       
    57 	void Stop();
       
    58 	void SetVolumeRamp(TTimeIntervalMicroSeconds aRamp);
       
    59 	void SetVolume(TInt Volume);
       
    60 	TInt GetVolume();
       
    61 	TInt GetMaxVolume();
       
    62 	void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds &aTrailingSilence);
       
    63 	TInt GetFixedSequenceCount();
       
    64 	const TDesC &GetFixedSequenceName(TInt aSequenceNumber);
       
    65 	void PrepareTone(TInt aFreq, const TTimeIntervalMicroSeconds &aToneDuration, TBool aPlayInmediately=ETrue);
       
    66 	void PrepareFixedSequence(TInt aSequenceNumber, TBool aPlayInmediately=ETrue);
       
    67 	void PrepareFixedSequenceCustomInterface(TInt aSequenceNumber, TBool aPlayInmediately=ETrue); 
       
    68 	void PrepareFileSequence(const TDesC &aFileName, TBool aPlayInmediately=ETrue);
       
    69 	void PrepareRFileSequence(const TDesC &aFileName, TBool aPlayInmediately=ETrue);
       
    70     void PrepareDTMFSequence(const TDesC &aSequence, TBool aPlayInmediately=ETrue);
       
    71 	void PrepareDesSequence(const TDesC8 &aSequence, TBool aPlayInmediately=ETrue);
       
    72 	void PrepareDualTone(TInt aFreq1, TInt aFreq2, const TTimeIntervalMicroSeconds &aToneDuration, TBool aPlayInmediately=ETrue);
       
    73 	void SetPriority(TInt aPriority, TMdaPriorityPreference aPref);
       
    74 
       
    75 	void SetId(TInt aId);
       
    76 	TInt GetId();
       
    77 	TInt GetFinalError();
       
    78 	TInt GetLastPrepareCompleteError();
       
    79 	TInt GetPrepareCompleteCallbackCount();
       
    80 
       
    81 	void SetSupervisor(TObjectCountDown *aCounter);
       
    82 	void SetExitCompleteTarget(MEventTarget *aTarget, CParameters *aParameters) ;
       
    83 	TTimeIntervalMicroSeconds GetPlayDuration();
       
    84 	TTime GetPlayStartTime();
       
    85 	TTime GetPlayStopTime();
       
    86 	TInt GetBalanceL();
       
    87 	void SetBalanceL(TInt aBalance);
       
    88 	void SetDTMFLengths(TTimeIntervalMicroSeconds32 iToneOnLength, TTimeIntervalMicroSeconds32 iToneOffLength, TTimeIntervalMicroSeconds32 iPauseLength);
       
    89 	// inherited from MMdaAudioToneObserver
       
    90 	void MatoPrepareComplete(TInt aError);
       
    91 	void MatoPlayComplete(TInt aError);
       
    92 	TInt ExecuteL(CParameters *aParams);
       
    93 	TInt State();
       
    94 
       
    95 public:	
       
    96 	static const TInt KPlayerActionPlay;
       
    97 	static const TInt KPlayerActionReportVolume;
       
    98 	static const TInt KPlayerActionStop;
       
    99 	static const TInt KPlayerActionCancelPrepare;
       
   100 
       
   101 	static const TInt KPlayerActionPrepareFileSequence;
       
   102 
       
   103 	static const TInt KPlayerActionPrepareFixedSequence;
       
   104 	static const TInt KPlayerActionPrepareTone;
       
   105 	static const TInt KPlayerActionPrepareDualTone;
       
   106 	static const TInt KPlayerActionPrepareDTMFSequence;
       
   107 	static const TInt KPlayerActionPrepareDesSequence;
       
   108 	static const TInt KPlayerActionChangeVolumeToMax;
       
   109 	static const TInt KPlayerActionChangeVolumeToAvg;
       
   110 	static const TInt KPlayerActionChangeVolumeToZero;
       
   111 
       
   112 	enum TPrepare {
       
   113 		EPrepareTone=1,
       
   114 		EPrepareFixedSequence,
       
   115 		EPrepareFileSequence,
       
   116 		
       
   117 		EPrepareDesSequence,
       
   118 		EPrepareDTMF,
       
   119 		EPrepareDualTone
       
   120 	};
       
   121 enum TPlay
       
   122     {
       
   123     EPlayTone=1,
       
   124     EPlayFixedSequence,
       
   125     EPlayFileSequence,
       
   126     EPlayDesSequence,
       
   127     EPlayDTMF,
       
   128     EPlayDualTone
       
   129     };
       
   130 
       
   131 enum TState
       
   132     {
       
   133     ETonePlayerNotReady,
       
   134     ETonePlayerPrepared,
       
   135     ETonePlayerPlaying
       
   136     };
       
   137 private:
       
   138 	TObjectCountDown *iSupervisor;
       
   139 	TInt iId;
       
   140 	TInt iFinalError;
       
   141 	//const CLogger *iLogger;
       
   142 
       
   143 	TBool iFreeToPrepare;
       
   144 	TBool iFreeToPlay;
       
   145 	TInt iFrequency;
       
   146 	TBool iPlayInmediately;
       
   147 	TTimeIntervalMicroSeconds iDuration;
       
   148 	CMdaAudioToneUtility *iMdaAudioToneUtility;
       
   149 	TTime iLastPlayTime;
       
   150 	TTime iLastStopTime;
       
   151 	TInt iLastPrepareError;
       
   152 	TInt iPrepareCalledCounter;
       
   153 	//TTimeIntervalMicroSeconds iPlayInterval;
       
   154 
       
   155 	MEventTarget *iExitEventTarget;
       
   156 	CParameters *iExitEventParameters;
       
   157 	COutputPrinter *iOutputPrinter;
       
   158 	};
       
   159 
       
   160 #endif      // TONE_PLAYER_H