os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/toneTest.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/toneTest.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,175 @@
     1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef _TONETEST_H_
    1.20 +#define _TONETEST_H_
    1.21 +
    1.22 +// taken from tmdatest.h
    1.23 +
    1.24 +
    1.25 +class TLitPtrC8
    1.26 +	{
    1.27 +public:
    1.28 +	inline const TDesC8* operator&() const;
    1.29 +	inline operator const TDesC8&() const;
    1.30 +	inline const TDesC8& operator()() const;
    1.31 +	inline operator const __TRefDesC8() const;
    1.32 +public:
    1.33 +	TUint iTypeLength;
    1.34 +	const TUint8 *iPtr;
    1.35 +	};
    1.36 +
    1.37 +#define KNumBuf 5
    1.38 +#define _LIT8DATA(name,data) const static TLitPtrC8 name={(sizeof(data) | (1<<28)),REINTERPRET_CAST(const TUint8 *, data)}
    1.39 +
    1.40 +// Signature definitions
    1.41 +#define SEQ_SIG1 0x5153
    1.42 +#define SEQ_SIG2 0x434E	
    1.43 +#define SEQ_SIG	SEQ_SIG1,SEQ_SIG2, // Signature = "SQNC" ASCII
    1.44 +
    1.45 +// Commands
    1.46 +#define SEQ_CMD_RET         -1
    1.47 +#define SEQ_CMD_STARTLOOP   -2,
    1.48 +#define SEQ_CMD_ENDLOOP     -3,
    1.49 +
    1.50 +// Useful values
    1.51 +// Note frequencies
    1.52 +#define SEQ_FREQ_A0	     440
    1.53 +#define SEQ_FREQ_AsBf0   466  // 466.1637615 A#, Bb
    1.54 +#define SEQ_FREQ_B0	     494  // 493.8833013
    1.55 +#define SEQ_FREQ_C0	     523  // 523.2511306
    1.56 +#define SEQ_FREQ_CsDf0	 554  // 554.365262 C#, Db, etc.
    1.57 +#define SEQ_FREQ_D0	     587  // 587.3295358
    1.58 +#define SEQ_FREQ_DsEf0   622  // 622.2539674
    1.59 +#define SEQ_FREQ_E0      659  // 659.2551138
    1.60 +#define SEQ_FREQ_F0      698  // 698.4564629
    1.61 +#define SEQ_FREQ_FsGf0   740  // 739.9888454
    1.62 +#define SEQ_FREQ_G0      784  // 783.990872
    1.63 +#define SEQ_FREQ_GsAf0   831  // 830.6093952
    1.64 +#define SEQ_FREQ_A1      880
    1.65 +#define SEQ_FREQ_AsBf1   932  // 932.327523
    1.66 +#define SEQ_FREQ_B1      988  // 987.7666025
    1.67 +#define SEQ_FREQ_C1      1047 // 1046.502261
    1.68 +#define SEQ_FREQ_CsDf1   1109 // 1108.730524
    1.69 +#define SEQ_FREQ_D1      1175 // 1174.659072
    1.70 +#define SEQ_FREQ_DsEf1   1245 // 1244.507935
    1.71 +#define SEQ_FREQ_E1      1319 // 1318.510228
    1.72 +#define SEQ_FREQ_F1      1397 // 1396.912926
    1.73 +#define SEQ_FREQ_FsGf1   1480 // 1479.977691
    1.74 +#define SEQ_FREQ_G1      1568 // 1567.981744
    1.75 +#define SEQ_FREQ_GsAf1   1661 // 1661.21879
    1.76 +#define SEQ_FREQ_A2      1760
    1.77 +#define SEQ_FREQ_AsBf2   1865 // 1864.655046
    1.78 +#define SEQ_FREQ_B2      1976 // 1975.533205
    1.79 +#define SEQ_FREQ_C2      2093 // 2093.004522
    1.80 +#define SEQ_FREQ_CsDf2   2217 // 2217.461048
    1.81 +#define SEQ_FREQ_D2      2349 // 2349.318143
    1.82 +#define SEQ_FREQ_DsEf2   2489 // 2489.01587
    1.83 +#define SEQ_FREQ_E2      2673 // 2637.020455
    1.84 +#define SEQ_FREQ_F2      2794 // 2793.825851
    1.85 +#define SEQ_FREQ_FsGf2   2960 // 2959.955382
    1.86 +#define SEQ_FREQ_G2      3136 // 3135.963488
    1.87 +#define SEQ_FREQ_GsAf2   3322 // 3322.437581
    1.88 +#define SEQ_FREQ_A3      3520
    1.89 +#define SEQ_FREQ_AsBf3   3729 // 3729.310092
    1.90 +
    1.91 +// Volume defines
    1.92 +#define SEQ_VOL_F        32767 // Forte = Loud
    1.93 +#define SEQ_VOL_MF	     24575 // Mezzo forte = Medium loud
    1.94 +#define SEQ_VOL_MP		 16383 // Mezzo piano = Medium soft
    1.95 +#define SEQ_VOL_P         8191 // Piano = Soft
    1.96 +	
    1.97 +// Macros for defining sequences
    1.98 +#define SEQ_DATA(A) SEQ_SIG A SEQ_CMD_RET
    1.99 +#define SEQ_VAL(N) N,
   1.100 +#define SEQ_LOOP(NUMBEROFTIMES,DATA) SEQ_CMD_STARTLOOP SEQ_VAL(NUMBEROFTIMES) DATA SEQ_CMD_ENDLOOP
   1.101 +#define SEQ_TONE(DUR,F1,V1) SEQ_VAL(DUR) SEQ_VAL(F1) SEQ_VAL(V1) SEQ_VAL(0) SEQ_VAL(0)
   1.102 +#define SEQ_2TONES(DUR,F1,V1,F2,V2) SEQ_VAL(DUR) SEQ_VAL(F1) SEQ_VAL(V1) SEQ_VAL(F2) SEQ_VAL(V2)
   1.103 +#define SEQ_SILENCE(DUR) SEQ_VAL(DUR) SEQ_VAL(0) SEQ_VAL(0) SEQ_VAL(0) SEQ_VAL(0)
   1.104 +// DUR = number samples@8kHz hence 8000 = 1 second
   1.105 +// F1/F2 = frequency in Hz - can use note definitions above
   1.106 +// V1/V1 = volume in range 0-32767 - can use volume definitions above
   1.107 +// When playing two tones, sum of volumes should not be greater than 32767
   1.108 +// e.g. can use MF+P or MP+MP
   1.109 +
   1.110 +// end of rip from tmdatest.h
   1.111 +//
   1.112 +const TInt16 KFixedSequenceTestSequenceData[]=
   1.113 +    {
   1.114 +	SEQ_DATA
   1.115 +		(
   1.116 +		SEQ_LOOP
   1.117 +			(
   1.118 +			2, // Repeat twice
   1.119 +			SEQ_TONE(100,SEQ_FREQ_A0,SEQ_VOL_F)
   1.120 +			SEQ_TONE(100,SEQ_FREQ_AsBf0,SEQ_VOL_F)
   1.121 +			SEQ_TONE(100,SEQ_FREQ_B0,SEQ_VOL_F)
   1.122 +			SEQ_TONE(100,SEQ_FREQ_C0,SEQ_VOL_F)
   1.123 +			SEQ_TONE(100,SEQ_FREQ_CsDf0,SEQ_VOL_F)
   1.124 +			SEQ_TONE(100,SEQ_FREQ_D0,SEQ_VOL_F)
   1.125 +			SEQ_TONE(100,SEQ_FREQ_DsEf0,SEQ_VOL_F)
   1.126 +			SEQ_TONE(100,SEQ_FREQ_E0,SEQ_VOL_F)
   1.127 +			SEQ_TONE(100,SEQ_FREQ_F0,SEQ_VOL_F)
   1.128 +			SEQ_TONE(100,SEQ_FREQ_FsGf0,SEQ_VOL_F)
   1.129 +			SEQ_TONE(100,SEQ_FREQ_GsAf0,SEQ_VOL_F)
   1.130 +			SEQ_TONE(100,SEQ_FREQ_A1,SEQ_VOL_F)
   1.131 +			SEQ_TONE(100,SEQ_FREQ_AsBf1,SEQ_VOL_F)
   1.132 +			SEQ_TONE(100,SEQ_FREQ_B1,SEQ_VOL_F)
   1.133 +			SEQ_TONE(100,SEQ_FREQ_C1,SEQ_VOL_F)
   1.134 +			SEQ_TONE(100,SEQ_FREQ_CsDf1,SEQ_VOL_F)
   1.135 +			SEQ_TONE(100,SEQ_FREQ_D1,SEQ_VOL_F)
   1.136 +			SEQ_TONE(100,SEQ_FREQ_DsEf1,SEQ_VOL_F)
   1.137 +			SEQ_TONE(100,SEQ_FREQ_E1,SEQ_VOL_F)
   1.138 +			SEQ_TONE(100,SEQ_FREQ_F1,SEQ_VOL_F)
   1.139 +			SEQ_TONE(100,SEQ_FREQ_FsGf1,SEQ_VOL_F)
   1.140 +			SEQ_TONE(100,SEQ_FREQ_GsAf1,SEQ_VOL_F)
   1.141 +			SEQ_TONE(100,SEQ_FREQ_A2,SEQ_VOL_F)
   1.142 +			SEQ_TONE(100,SEQ_FREQ_AsBf2,SEQ_VOL_F)
   1.143 +			SEQ_TONE(100,SEQ_FREQ_B2,SEQ_VOL_F)
   1.144 +			SEQ_TONE(100,SEQ_FREQ_C2,SEQ_VOL_F)
   1.145 +			SEQ_TONE(100,SEQ_FREQ_CsDf2,SEQ_VOL_F)
   1.146 +			SEQ_TONE(100,SEQ_FREQ_D2,SEQ_VOL_F)
   1.147 +			SEQ_TONE(100,SEQ_FREQ_DsEf2,SEQ_VOL_F)
   1.148 +			SEQ_TONE(100,SEQ_FREQ_E2,SEQ_VOL_F)
   1.149 +			SEQ_TONE(100,SEQ_FREQ_F2,SEQ_VOL_F)
   1.150 +			SEQ_TONE(100,SEQ_FREQ_FsGf2,SEQ_VOL_F)
   1.151 +			SEQ_TONE(100,SEQ_FREQ_GsAf2,SEQ_VOL_F)
   1.152 +			SEQ_TONE(100,SEQ_FREQ_A3,SEQ_VOL_F)
   1.153 +			SEQ_SILENCE(6000)
   1.154 +			)
   1.155 +		SEQ_SILENCE(6000)
   1.156 +		)	
   1.157 +    };
   1.158 +
   1.159 +_LIT8DATA(KFixedSequenceData,KFixedSequenceTestSequenceData);
   1.160 +
   1.161 +
   1.162 +// Inline functions
   1.163 +
   1.164 +// Template class TLitC8
   1.165 +inline const TDesC8* TLitPtrC8::operator&() const
   1.166 +	{return REINTERPRET_CAST(const TDesC8*,this);}
   1.167 +inline const TDesC8& TLitPtrC8::operator()() const
   1.168 +	{return *operator&();}
   1.169 +inline TLitPtrC8::operator const TDesC8&() const
   1.170 +	{return *operator&();}
   1.171 +inline TLitPtrC8::operator const __TRefDesC8() const
   1.172 +	{return *operator&();}
   1.173 +
   1.174 +
   1.175 +
   1.176 +
   1.177 +
   1.178 +#endif //_FONTTEST_H_