profilesservices/RingingTone3DPlugin/inc/C3DAudioPattern.h
changeset 68 13e71d907dc3
parent 0 8c5d936e5675
equal deleted inserted replaced
40:6465d5bb863a 68:13e71d907dc3
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Handles accessing 3D motion pattern data.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C3DAUDIOPATTERN_H
       
    20 #define C3DAUDIOPATTERN_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>	// CBase
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class RReadStream;
       
    27 class RWriteStream;
       
    28 
       
    29 // DATA TYPES
       
    30 
       
    31 // Struct representing position in three dimensional space.
       
    32 struct T3DPosition 
       
    33     {
       
    34     // X-coordinate
       
    35     TInt iX;
       
    36     // Y-coordinate
       
    37     TInt iY;
       
    38     // Z-coordinate
       
    39     TInt iZ;
       
    40     };
       
    41 
       
    42 // Struct representing velocity.
       
    43 struct T3DVelocity
       
    44 	{
       
    45 	// Boolean indicating is scalar velocity in use
       
    46 	TBool iScalar;
       
    47 	// Scalar velocity
       
    48 	TInt iScalarVelocity;
       
    49 	// Velocity along x-axis.
       
    50 	TInt iXVector;
       
    51 	// Velocity along y-axis.
       
    52 	TInt iYVector;
       
    53 	// Velocity along z-axis.
       
    54 	TInt iZVector;
       
    55 	};
       
    56 
       
    57 // Struct representing update in motion pattern.
       
    58 struct T3DScriptUpdate
       
    59 	{
       
    60 	// Position of the trajectory.
       
    61 	T3DPosition iPosition;
       
    62 	// Velocity 
       
    63 	T3DVelocity iVelocity;
       
    64 	// Time the pattern stays in this position.
       
    65 	TInt iDTime;
       
    66 	};
       
    67 
       
    68 // Struct representing loop in pattern.
       
    69 struct T3DLoop
       
    70 	{
       
    71 	// Position where to start the loop.
       
    72 	TInt iLoopStart;
       
    73 	// Position where to end the loop.
       
    74 	TInt iLoopEnd;
       
    75 	// How many times the loop is to be gone through.
       
    76 	TInt iCount;
       
    77 	};
       
    78 
       
    79 
       
    80 // CLASS DECLARATION
       
    81 
       
    82 /**
       
    83 * Handles accessing 3D motion pattern data.
       
    84 *
       
    85 * @lib RingingTone3DPlugin.dll 
       
    86 * @since 5.0
       
    87 */
       
    88 NONSHARABLE_CLASS (C3DAudioPattern): public CBase
       
    89     {
       
    90     
       
    91     public:  // Constructors and destructor
       
    92     
       
    93        /**
       
    94         * Two-phased constructor. 
       
    95         */
       
    96         static C3DAudioPattern* NewL();
       
    97         
       
    98        /**
       
    99         * Two-phased constructor.
       
   100         */
       
   101         static C3DAudioPattern* NewLC();
       
   102         
       
   103        /**
       
   104         * Two-phased constructor.
       
   105         * @param aStream Stream used to internalise the pattern.
       
   106         */
       
   107         static C3DAudioPattern* NewL( RReadStream& aStream );
       
   108         
       
   109        /**
       
   110         * Two-phased constructor.
       
   111         * @param aStream Stream used to internalise the pattern.
       
   112         */
       
   113         static C3DAudioPattern* NewLC( RReadStream& aStream );
       
   114         
       
   115        /**
       
   116 		* Destructor
       
   117 		*/
       
   118         virtual ~C3DAudioPattern();
       
   119         
       
   120     private:
       
   121     	
       
   122     	/**
       
   123         * C++ default constructor.
       
   124         */
       
   125         C3DAudioPattern();
       
   126 
       
   127     private:
       
   128     
       
   129 	   /**
       
   130         * Internalizes the pattern from readstream.
       
   131         * @param aStream Readstream from which to internalize the pattern.
       
   132         */
       
   133         void InternalizeL( RReadStream& aStream );
       
   134         
       
   135     public:
       
   136 
       
   137        /**
       
   138         * Externalizes the pattern.
       
   139         * @param aStream Writestream to externalize the pattern to.
       
   140         */
       
   141 	   	void ExternalizeL( RWriteStream& aStream ) const;
       
   142 	   	
       
   143 	   /**
       
   144         * Sets the name of the pattern.
       
   145         * @param aName Descriptor containing the name of the pattern.
       
   146         */	   	    
       
   147 	   	void SetNameL( const TDesC8& aName );
       
   148 
       
   149 	   /**
       
   150         * Getter for name of the pattern.
       
   151         * @return Descriptor containing name of the pattern.
       
   152         */			
       
   153 	    const TDesC8& Name();
       
   154 	   	
       
   155 	   /**
       
   156         * Sets the doppler of the pattern.
       
   157         * @param aDoppler Boolean whether doppler is available or not.
       
   158         */	   	    
       
   159 	   	void SetDoppler( const TBool aDoppler );
       
   160 
       
   161 	   /**
       
   162         * Queries if doppler-effect is available in the pattern.
       
   163         * @return Boolean indicating whether doppler is available.
       
   164         */
       
   165 	   	TBool DopplerAvailable() const;
       
   166 
       
   167 	   /**
       
   168         * Sets the reververation of pattern.
       
   169         * @param aReverb Index of reverberation used with CEnvironmentalReverbUtility.
       
   170         */	   	    
       
   171 	   	void SetReverb( const TUint aReverb );
       
   172 
       
   173 	   /**
       
   174         * Queries reverberation preset of the pattern.
       
   175         * @return Reverberation preset used in pattern.
       
   176         */
       
   177 	   	TInt Reverb() const;
       
   178 	   	
       
   179 	   /**
       
   180         * Adds a new update to script.
       
   181         * @param aUpdate Update to add to the script.
       
   182         */
       
   183 		void AddUpdateL( T3DScriptUpdate& aUpdate );
       
   184 		
       
   185 	   /**
       
   186         * Used to indicate a start of a loop in pattern.
       
   187         * @param aCount Amount of times the loop takes place.
       
   188         */
       
   189 		void StartLoopL( TUint& aCount );
       
   190 		
       
   191 	   /**
       
   192         * Used to indicate end of a loop in pattern.
       
   193         */
       
   194 		void EndLoop();
       
   195 		
       
   196 	   /**
       
   197         * Getter for script containg motion pattern.
       
   198         * @return Array containing timeframes of pattern.
       
   199         */
       
   200 		RArray< T3DScriptUpdate > Script();
       
   201 	   
       
   202 
       
   203     private:	// Data
       
   204     
       
   205     	// Name of the pattern.
       
   206         HBufC8* iName;
       
   207         // Initial status of doppler-effect.
       
   208         TBool iInitialDoppler;
       
   209         // Initial reverb preset.
       
   210         TUint iInitialReverb;
       
   211         // Array containing indexes of open loops.
       
   212         RArray< TInt > iOpenLoops;
       
   213         // Array containing loops in the pattern.
       
   214         RArray< T3DLoop > iLoops;
       
   215         // Array containing the whole pattern as timeframes.
       
   216         RArray< T3DScriptUpdate > iScript;
       
   217 
       
   218     };
       
   219 
       
   220 #endif // C3DAUDIOPATTERN_H
       
   221 
       
   222 // End of File