Pd++  0.01
A pure C++ implementation of Pure Data objects
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Phasor.h
1 /*
2  Phasor.cpp
3  Pd++
4 
5  Created by Robert Esler on 9/16/14.
6  Copyright (c) 2014 Robert Esler. All rights reserved.
7 
8  Some of the code in Pd++ is Copyright (c) 1997-1999 Miller Puckette.
9  For information on usage and redistribution, and for a DISCLAIMER OF ALL
10  WARRANTIES, see the file, "LICENSE.txt," in this distribution.
11  */
12 #ifndef __Pd____Phasor__
13 #define __Pd____Phasor__
14 
15 #include "math.h"
16 #include <string>
17 #include "PdMaster.h"
18 
19 namespace pd {
20 /*! \brief A sawtooth generator.
21 
22  Phasor is also the template class that explains how other classes can be
23  organized.
24 */
25 
26 /*Based on Miller Puckette's Phasor~ ala in the style of R. Hoeldrich (ICMC 1995 Banff) */
27 class Phasor : public PdMaster {
28 
29 private:
30  double phase;
31  double dphase;
32  double conv;
33  double frequency; /* scalar frequency */
34  double volume = 1;
35  int sample = 0;
36  int normhipart;
37  union tabfudge tf;
38 
39  void setConv();
40  double getConv() {return conv;};
41 
42 public:
43 
44 
45  Phasor();
46  Phasor(double); //! Frequency
47  Phasor(double, double); //! Frequency and phase.
48  ~Phasor();
49 
50  double perform(double input);
51 
52  void setPhase(double);
53  double getPhase() {return phase;};
54  void setFrequency(double);
55  double getFrequency() {return frequency;};
56  void setVolume(double);
57  double getVolume();
58 
59  //! Every pd++ class should have a pdName that is its pd equivalent
60  const std::string pdName = "phasor~"; };
61 
62 } // pd namespace
63 
64 #endif /* defined(__Pd____Phasor__) */
The Pd++ namespace.
Definition: BandPass.cpp:14
A super class inherited by all Pd++ objects.
Definition: PdMaster.h:62
A sawtooth generator.
Definition: Phasor.h:27
Definition: PdMaster.h:82
const std::string pdName
Every pd++ class should have a pdName that is its pd equivalent.
Definition: Phasor.h:60
double perform(double input)
Definition: Phasor.cpp:50
~Phasor()
Frequency and phase.
Definition: Phasor.cpp:43
void setFrequency(double)
Definition: Phasor.cpp:75