os/mm/devsoundextensions/effects/EffectTest/EffectConsoleTest.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). 
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:  Effects console test
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
sl@0
    20
sl@0
    21
#ifndef EFFECTSCONSOLETEST
sl@0
    22
#define EFFECTSCONSOLETEST
sl@0
    23
sl@0
    24
//  INCLUDES
sl@0
    25
#include <e32svr.h>
sl@0
    26
#include <e32base.h>
sl@0
    27
#include <e32cons.h>
sl@0
    28
#include <mdaaudiosampleplayer.h>
sl@0
    29
#include <MdaAudioSampleEditor.h>
sl@0
    30
sl@0
    31
#include <AudioEffectBase.h>
sl@0
    32
#include <MAudioEffectObserver.h>
sl@0
    33
#include <AudioEqualizerBase.h>
sl@0
    34
#include <MAudioEqualizerObserver.h>
sl@0
    35
#include <EnvironmentalReverbBase.h>
sl@0
    36
#include <MEnvironmentalReverbObserver.h>
sl@0
    37
#include <StereoWideningBase.h>
sl@0
    38
#include <MStereoWideningObserver.h>
sl@0
    39
sl@0
    40
#include <customInterfaceUtility.h>
sl@0
    41
sl@0
    42
_LIT(KAMRTestFile,"c:\\test.amr");
sl@0
    43
_LIT(KWAVTestFile,"c:\\test.wav");
sl@0
    44
sl@0
    45
sl@0
    46
//////////////////////////////////////////////////////////////////////////////
sl@0
    47
//
sl@0
    48
// -----> CmyActiveScheduler (definition)
sl@0
    49
//
sl@0
    50
//////////////////////////////////////////////////////////////////////////////
sl@0
    51
class CmyActiveScheduler : public CActiveScheduler
sl@0
    52
	{
sl@0
    53
public:
sl@0
    54
	void Error (TInt aError) const;
sl@0
    55
	};
sl@0
    56
sl@0
    57
sl@0
    58
//////////////////////////////////////////////////////////////////////////////
sl@0
    59
//
sl@0
    60
// -----> CActiveConsole (definition)
sl@0
    61
//
sl@0
    62
// An abstract class which provides the facility to issue key requests.
sl@0
    63
//
sl@0
    64
//////////////////////////////////////////////////////////////////////////////
sl@0
    65
class CActiveConsole : public CActive
sl@0
    66
	{
sl@0
    67
public:
sl@0
    68
	  // Construction
sl@0
    69
	CActiveConsole(CConsoleBase* aConsole);
sl@0
    70
	void ConstructL();
sl@0
    71
	static CActiveConsole* NewLC(CConsoleBase* aConsole) ;
sl@0
    72
	~CActiveConsole();
sl@0
    73
sl@0
    74
	  // Issue request
sl@0
    75
	void RequestCharacter();
sl@0
    76
sl@0
    77
	  // Cancel request.
sl@0
    78
	  // Defined as pure virtual by CActive;
sl@0
    79
	  // implementation provided by this class.
sl@0
    80
	void DoCancel();
sl@0
    81
sl@0
    82
	  // Service completed request.
sl@0
    83
	  // Defined as pure virtual by CActive;
sl@0
    84
	  // implementation provided by this class,
sl@0
    85
	void RunL();
sl@0
    86
sl@0
    87
	  // Called from RunL() - an implementation must be provided
sl@0
    88
	  // by derived classes to handle the completed request
sl@0
    89
	virtual void ProcessKeyPress(TChar aChar) = 0;
sl@0
    90
sl@0
    91
protected:
sl@0
    92
	  // Data members defined by this class
sl@0
    93
	CConsoleBase* iConsole; // A console for reading from
sl@0
    94
	};
sl@0
    95
sl@0
    96
//////////////////////////////////////////////////////////////////////////////
sl@0
    97
//
sl@0
    98
// -----> CConsoleTest (definition)
sl@0
    99
//
sl@0
   100
// This class is derived from CActiveConsole.
sl@0
   101
// Request handling: accepts input from the keyboard and outputs the
sl@0
   102
// test result through test harness.
sl@0
   103
//
sl@0
   104
//////////////////////////////////////////////////////////////////////////////
sl@0
   105
class CConsoleTest : public CActiveConsole,
sl@0
   106
				     public MMdaAudioPlayerCallback,
sl@0
   107
				     public MMdaObjectStateChangeObserver,
sl@0
   108
 					 public MAudioEffectObserver
sl@0
   109
					 //public MAudioEqualizerObserver
sl@0
   110
{
sl@0
   111
public:
sl@0
   112
sl@0
   113
	enum TMenu
sl@0
   114
	{
sl@0
   115
		EMain,
sl@0
   116
		EPlay,
sl@0
   117
		ERecord,
sl@0
   118
		EConvert,
sl@0
   119
		EEqualizer,
sl@0
   120
		EBandId,
sl@0
   121
		EBandLevel,
sl@0
   122
		EEnvironmentalReverb1,
sl@0
   123
		EEnvironmentalReverb2,
sl@0
   124
		EStereoWidening,
sl@0
   125
		EStereoWideningLevel
sl@0
   126
sl@0
   127
	};
sl@0
   128
sl@0
   129
	// Destruction
sl@0
   130
	~CConsoleTest();
sl@0
   131
sl@0
   132
public:
sl@0
   133
	  // Static constuction
sl@0
   134
	static CConsoleTest *NewLC (CConsoleBase* aConsole);
sl@0
   135
	static CConsoleTest *NewL(CConsoleBase* aConsole);
sl@0
   136
sl@0
   137
	virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
sl@0
   138
	virtual void MapcPlayComplete(TInt aError);
sl@0
   139
	virtual void MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorcCode);
sl@0
   140
	virtual void EffectChanged( const CAudioEffect* aAudioEffect, TUint8 aEvent );
sl@0
   141
sl@0
   142
public:
sl@0
   143
	  // Service request
sl@0
   144
	void ProcessKeyPress(TChar aChar);
sl@0
   145
	void ShowMenu();
sl@0
   146
sl@0
   147
private:
sl@0
   148
sl@0
   149
	void ConstructL();
sl@0
   150
	CConsoleTest(CConsoleBase* aConsole);
sl@0
   151
	void ProcessMain(TChar aChar);
sl@0
   152
	void ProcessPlayL(TChar aChar);
sl@0
   153
	void ProcessEqualizerL(TChar aChar);
sl@0
   154
	void ProcessBandId(TChar aChar);
sl@0
   155
	void ProcessBandLevelL(TChar aChar);
sl@0
   156
	void InitializeTestData();
sl@0
   157
	void ProcessEnvironmentalReverbL(TChar aChar);
sl@0
   158
	void TestCase1();
sl@0
   159
	void TestCase2();
sl@0
   160
	void TestCase3();
sl@0
   161
	void ProcessStereoWideningL(TChar aChar);
sl@0
   162
	void ProcessStereoWideningLevelL(TChar aChar);
sl@0
   163
sl@0
   164
sl@0
   165
sl@0
   166
sl@0
   167
private:
sl@0
   168
sl@0
   169
	TInt iInitStatus;
sl@0
   170
sl@0
   171
	TMenu iMenu;
sl@0
   172
	TMenu iParentMenu;
sl@0
   173
	TUint32 iBandId;
sl@0
   174
	CCustomInterfaceUtility* iCIUtility;
sl@0
   175
sl@0
   176
	CMdaAudioPlayerUtility* iAudioPlayer;
sl@0
   177
	CAudioEqualizer* iPlayerAudioEqualizer;
sl@0
   178
	CEnvironmentalReverb* iPlayerEnvironmentalReverb;
sl@0
   179
	CStereoWidening* iPlayerStereoWidening;
sl@0
   180
sl@0
   181
	CMdaAudioRecorderUtility* iAudioRecorder;
sl@0
   182
	CAudioEqualizer* iRecorderAudioEqualizer;
sl@0
   183
	CEnvironmentalReverb* iRecorderEnvironmentalReverb;
sl@0
   184
	CStereoWidening* iRecorderStereoWidening;
sl@0
   185
sl@0
   186
	CMdaAudioConvertUtility* iAudioConverter;
sl@0
   187
sl@0
   188
	CAudioEqualizer* iEqualizer;
sl@0
   189
	CEnvironmentalReverb* iEnvironmentalReverb;
sl@0
   190
	CStereoWidening* iStereoWidening;
sl@0
   191
sl@0
   192
sl@0
   193
	CAudioEqualizer* iAudioEqualizer;
sl@0
   194
sl@0
   195
	TBuf<100> iSampleFilePath;
sl@0
   196
sl@0
   197
	RFs  iFs;
sl@0
   198
sl@0
   199
	RArray<TInt> iGoodData;
sl@0
   200
	RArray<TInt> iBadData;
sl@0
   201
sl@0
   202
	};
sl@0
   203
sl@0
   204
//////////////////////////////////////////////////////////////////////////////
sl@0
   205
//
sl@0
   206
// Main
sl@0
   207
//
sl@0
   208
//////////////////////////////////////////////////////////////////////////////
sl@0
   209
sl@0
   210
_LIT(KTxtDBTest, "Effects Console Test");
sl@0
   211
sl@0
   212
LOCAL_C void doTestL();
sl@0
   213
sl@0
   214
GLDEF_C TInt E32Main() // main function called by E32
sl@0
   215
{
sl@0
   216
	__UHEAP_MARK;
sl@0
   217
	CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack
sl@0
   218
	TRAPD(error, doTestL());
sl@0
   219
	__ASSERT_ALWAYS(!error,User::Panic(KTxtDBTest, error));
sl@0
   220
	delete cleanup; // destroy clean-up stack
sl@0
   221
	__UHEAP_MARKEND;
sl@0
   222
	return 0; // and return
sl@0
   223
}
sl@0
   224
sl@0
   225
#endif