First public contribution.
1 // Copyright (c) 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include "wavegenerator.h"
23 Generates a set of values that resembles a sine wave that has no negative
26 void WaveGenerator::GenerateSineWave(TValueList& aResults, TInt aNumSamples,
27 TReal aAmplitude, TReal aFrequency, TBool aPositiveValues)
30 TReal part = 1.0 / aNumSamples;
32 TReal preCalculation = 3.14159265358979323846 * aFrequency;
38 for (TInt i = aNumSamples; i > 0; --i)
41 Math::Sin(sinResult, preCalculation * time);
42 aResults.Append(prefix * Abs(aAmplitude * sinResult));