1////////////////////////////////////////////////////////////////////////////////
2// //
3// This software is supplied under the terms of a license agreement or //
4// nondisclosure agreement with Mitov Software and may not be copied //
5// or disclosed except in accordance with the terms of that agreement. //
6// Copyright(c) 2002-2016 Mitov Software. All Rights Reserved. //
7// //
8////////////////////////////////////////////////////////////////////////////////
9
10#ifndef _MITOV_SINE_GENERATOR_h
11#define _MITOV_SINE_GENERATOR_h
12
13#include <Mitov.h>
14#include "Mitov_BasicGenerator.h"
15
16namespace Mitov
17{
18 class SineAnalogGenerator : public Mitov::BasicFrequencyGenerator<float>
19 {
20 typedef Mitov::BasicFrequencyGenerator<float> inherited;
21
22 protected:
23 virtual void CalculateValue() override
24 {
25 FValue = sin( FPhase * 2 * PI ) * Amplitude + Offset;
26 }
27
28 public:
29 SineAnalogGenerator() :
30 inherited( 0.5, 0.5 )
31 {
32 }
33 };
34//---------------------------------------------------------------------------
35 class SineIntegerGenerator : public Mitov::BasicFrequencyGenerator<long>
36 {
37 typedef Mitov::BasicFrequencyGenerator<long> inherited;
38
39 protected:
40 virtual void CalculateValue() override
41 {
42 FValue = sin( FPhase * 2 * PI ) * Amplitude + Offset + 0.5;
43 }
44
45 public:
46 SineIntegerGenerator() :
47 inherited( 1000, 0 )
48 {
49 }
50 };
51//---------------------------------------------------------------------------
52 class SineUnsignedGenerator : public Mitov::BasicFrequencyGenerator<unsigned long>
53 {
54 typedef Mitov::BasicFrequencyGenerator<unsigned long> inherited;
55
56 protected:
57 virtual void CalculateValue() override
58 {
59 FValue = sin( FPhase * 2 * PI ) * Amplitude + Offset + 0.5;
60 }
61
62 public:
63 SineUnsignedGenerator() :
64 inherited( 1000, 1000 )
65 {
66 }
67 };
68}
69
70#endif