os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/toneTest.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef _TONETEST_H_
    17 #define _TONETEST_H_
    18 
    19 // taken from tmdatest.h
    20 
    21 
    22 class TLitPtrC8
    23 	{
    24 public:
    25 	inline const TDesC8* operator&() const;
    26 	inline operator const TDesC8&() const;
    27 	inline const TDesC8& operator()() const;
    28 	inline operator const __TRefDesC8() const;
    29 public:
    30 	TUint iTypeLength;
    31 	const TUint8 *iPtr;
    32 	};
    33 
    34 #define KNumBuf 5
    35 #define _LIT8DATA(name,data) const static TLitPtrC8 name={(sizeof(data) | (1<<28)),REINTERPRET_CAST(const TUint8 *, data)}
    36 
    37 // Signature definitions
    38 #define SEQ_SIG1 0x5153
    39 #define SEQ_SIG2 0x434E	
    40 #define SEQ_SIG	SEQ_SIG1,SEQ_SIG2, // Signature = "SQNC" ASCII
    41 
    42 // Commands
    43 #define SEQ_CMD_RET         -1
    44 #define SEQ_CMD_STARTLOOP   -2,
    45 #define SEQ_CMD_ENDLOOP     -3,
    46 
    47 // Useful values
    48 // Note frequencies
    49 #define SEQ_FREQ_A0	     440
    50 #define SEQ_FREQ_AsBf0   466  // 466.1637615 A#, Bb
    51 #define SEQ_FREQ_B0	     494  // 493.8833013
    52 #define SEQ_FREQ_C0	     523  // 523.2511306
    53 #define SEQ_FREQ_CsDf0	 554  // 554.365262 C#, Db, etc.
    54 #define SEQ_FREQ_D0	     587  // 587.3295358
    55 #define SEQ_FREQ_DsEf0   622  // 622.2539674
    56 #define SEQ_FREQ_E0      659  // 659.2551138
    57 #define SEQ_FREQ_F0      698  // 698.4564629
    58 #define SEQ_FREQ_FsGf0   740  // 739.9888454
    59 #define SEQ_FREQ_G0      784  // 783.990872
    60 #define SEQ_FREQ_GsAf0   831  // 830.6093952
    61 #define SEQ_FREQ_A1      880
    62 #define SEQ_FREQ_AsBf1   932  // 932.327523
    63 #define SEQ_FREQ_B1      988  // 987.7666025
    64 #define SEQ_FREQ_C1      1047 // 1046.502261
    65 #define SEQ_FREQ_CsDf1   1109 // 1108.730524
    66 #define SEQ_FREQ_D1      1175 // 1174.659072
    67 #define SEQ_FREQ_DsEf1   1245 // 1244.507935
    68 #define SEQ_FREQ_E1      1319 // 1318.510228
    69 #define SEQ_FREQ_F1      1397 // 1396.912926
    70 #define SEQ_FREQ_FsGf1   1480 // 1479.977691
    71 #define SEQ_FREQ_G1      1568 // 1567.981744
    72 #define SEQ_FREQ_GsAf1   1661 // 1661.21879
    73 #define SEQ_FREQ_A2      1760
    74 #define SEQ_FREQ_AsBf2   1865 // 1864.655046
    75 #define SEQ_FREQ_B2      1976 // 1975.533205
    76 #define SEQ_FREQ_C2      2093 // 2093.004522
    77 #define SEQ_FREQ_CsDf2   2217 // 2217.461048
    78 #define SEQ_FREQ_D2      2349 // 2349.318143
    79 #define SEQ_FREQ_DsEf2   2489 // 2489.01587
    80 #define SEQ_FREQ_E2      2673 // 2637.020455
    81 #define SEQ_FREQ_F2      2794 // 2793.825851
    82 #define SEQ_FREQ_FsGf2   2960 // 2959.955382
    83 #define SEQ_FREQ_G2      3136 // 3135.963488
    84 #define SEQ_FREQ_GsAf2   3322 // 3322.437581
    85 #define SEQ_FREQ_A3      3520
    86 #define SEQ_FREQ_AsBf3   3729 // 3729.310092
    87 
    88 // Volume defines
    89 #define SEQ_VOL_F        32767 // Forte = Loud
    90 #define SEQ_VOL_MF	     24575 // Mezzo forte = Medium loud
    91 #define SEQ_VOL_MP		 16383 // Mezzo piano = Medium soft
    92 #define SEQ_VOL_P         8191 // Piano = Soft
    93 	
    94 // Macros for defining sequences
    95 #define SEQ_DATA(A) SEQ_SIG A SEQ_CMD_RET
    96 #define SEQ_VAL(N) N,
    97 #define SEQ_LOOP(NUMBEROFTIMES,DATA) SEQ_CMD_STARTLOOP SEQ_VAL(NUMBEROFTIMES) DATA SEQ_CMD_ENDLOOP
    98 #define SEQ_TONE(DUR,F1,V1) SEQ_VAL(DUR) SEQ_VAL(F1) SEQ_VAL(V1) SEQ_VAL(0) SEQ_VAL(0)
    99 #define SEQ_2TONES(DUR,F1,V1,F2,V2) SEQ_VAL(DUR) SEQ_VAL(F1) SEQ_VAL(V1) SEQ_VAL(F2) SEQ_VAL(V2)
   100 #define SEQ_SILENCE(DUR) SEQ_VAL(DUR) SEQ_VAL(0) SEQ_VAL(0) SEQ_VAL(0) SEQ_VAL(0)
   101 // DUR = number samples@8kHz hence 8000 = 1 second
   102 // F1/F2 = frequency in Hz - can use note definitions above
   103 // V1/V1 = volume in range 0-32767 - can use volume definitions above
   104 // When playing two tones, sum of volumes should not be greater than 32767
   105 // e.g. can use MF+P or MP+MP
   106 
   107 // end of rip from tmdatest.h
   108 //
   109 const TInt16 KFixedSequenceTestSequenceData[]=
   110     {
   111 	SEQ_DATA
   112 		(
   113 		SEQ_LOOP
   114 			(
   115 			2, // Repeat twice
   116 			SEQ_TONE(100,SEQ_FREQ_A0,SEQ_VOL_F)
   117 			SEQ_TONE(100,SEQ_FREQ_AsBf0,SEQ_VOL_F)
   118 			SEQ_TONE(100,SEQ_FREQ_B0,SEQ_VOL_F)
   119 			SEQ_TONE(100,SEQ_FREQ_C0,SEQ_VOL_F)
   120 			SEQ_TONE(100,SEQ_FREQ_CsDf0,SEQ_VOL_F)
   121 			SEQ_TONE(100,SEQ_FREQ_D0,SEQ_VOL_F)
   122 			SEQ_TONE(100,SEQ_FREQ_DsEf0,SEQ_VOL_F)
   123 			SEQ_TONE(100,SEQ_FREQ_E0,SEQ_VOL_F)
   124 			SEQ_TONE(100,SEQ_FREQ_F0,SEQ_VOL_F)
   125 			SEQ_TONE(100,SEQ_FREQ_FsGf0,SEQ_VOL_F)
   126 			SEQ_TONE(100,SEQ_FREQ_GsAf0,SEQ_VOL_F)
   127 			SEQ_TONE(100,SEQ_FREQ_A1,SEQ_VOL_F)
   128 			SEQ_TONE(100,SEQ_FREQ_AsBf1,SEQ_VOL_F)
   129 			SEQ_TONE(100,SEQ_FREQ_B1,SEQ_VOL_F)
   130 			SEQ_TONE(100,SEQ_FREQ_C1,SEQ_VOL_F)
   131 			SEQ_TONE(100,SEQ_FREQ_CsDf1,SEQ_VOL_F)
   132 			SEQ_TONE(100,SEQ_FREQ_D1,SEQ_VOL_F)
   133 			SEQ_TONE(100,SEQ_FREQ_DsEf1,SEQ_VOL_F)
   134 			SEQ_TONE(100,SEQ_FREQ_E1,SEQ_VOL_F)
   135 			SEQ_TONE(100,SEQ_FREQ_F1,SEQ_VOL_F)
   136 			SEQ_TONE(100,SEQ_FREQ_FsGf1,SEQ_VOL_F)
   137 			SEQ_TONE(100,SEQ_FREQ_GsAf1,SEQ_VOL_F)
   138 			SEQ_TONE(100,SEQ_FREQ_A2,SEQ_VOL_F)
   139 			SEQ_TONE(100,SEQ_FREQ_AsBf2,SEQ_VOL_F)
   140 			SEQ_TONE(100,SEQ_FREQ_B2,SEQ_VOL_F)
   141 			SEQ_TONE(100,SEQ_FREQ_C2,SEQ_VOL_F)
   142 			SEQ_TONE(100,SEQ_FREQ_CsDf2,SEQ_VOL_F)
   143 			SEQ_TONE(100,SEQ_FREQ_D2,SEQ_VOL_F)
   144 			SEQ_TONE(100,SEQ_FREQ_DsEf2,SEQ_VOL_F)
   145 			SEQ_TONE(100,SEQ_FREQ_E2,SEQ_VOL_F)
   146 			SEQ_TONE(100,SEQ_FREQ_F2,SEQ_VOL_F)
   147 			SEQ_TONE(100,SEQ_FREQ_FsGf2,SEQ_VOL_F)
   148 			SEQ_TONE(100,SEQ_FREQ_GsAf2,SEQ_VOL_F)
   149 			SEQ_TONE(100,SEQ_FREQ_A3,SEQ_VOL_F)
   150 			SEQ_SILENCE(6000)
   151 			)
   152 		SEQ_SILENCE(6000)
   153 		)	
   154     };
   155 
   156 _LIT8DATA(KFixedSequenceData,KFixedSequenceTestSequenceData);
   157 
   158 
   159 // Inline functions
   160 
   161 // Template class TLitC8
   162 inline const TDesC8* TLitPtrC8::operator&() const
   163 	{return REINTERPRET_CAST(const TDesC8*,this);}
   164 inline const TDesC8& TLitPtrC8::operator()() const
   165 	{return *operator&();}
   166 inline TLitPtrC8::operator const TDesC8&() const
   167 	{return *operator&();}
   168 inline TLitPtrC8::operator const __TRefDesC8() const
   169 	{return *operator&();}
   170 
   171 
   172 
   173 
   174 
   175 #endif //_FONTTEST_H_