Pd++  0.01
A pure C++ implementation of Pure Data objects
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
TabRead4.h
1 /*
2  TabRead4.cpp
3  Pd++
4 
5  Created by Esler,Robert Wadhams on 10/13/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 
13 #ifndef __Pd____TabRead4__
14 #define __Pd____TabRead4__
15 
16 #include <string>
17 #include <vector>
18 #include "PdMaster.h"
19 
20 namespace pd {
21 
22 /*! \brief A struct that holds the four interpolation points for TabRead4. */
23 struct tableData {
24  double point1;
25  double point2;
26  double point3;
27  double point4;
28 };
29 
30 
31 /*! \brief A 4-point table lookup routine.
32 
33  This class will read from an array or vector using 4-point polynomial interpolation.
34 
35  Remember when using this class to read table values 1 to n-2 to get meaningful data.
36  Otherwise you will just get zeros at the end of your table reads.
37 
38  This class could be used for creating wavetable synthesizers.
39 
40 */
41 class TabRead4 : public PdMaster {
42 
43 
44 private:
45 
46  std::vector<double> theArray;
47  int x_npoints;
48  double x_onset = 0;
49  tableData getTableData(int index); // get the four points
50 
51 public:
52 
53  TabRead4();
54  TabRead4(std::vector<double> anArray);
55  ~TabRead4();
56  double perform(double index);
57 
58  /*getters and setters*/
59  void setTable(std::vector<double> table);
60  size_t getTableSize();
61  void setOnset(double);
62  double getOnset();
63 
64  const std::string pdName = "tabread4~";
65 
66 
67 };
68 
69 } // pd namespace
70 
71 #endif /* defined(__Pd____TabRead4__) */
The Pd++ namespace.
Definition: BandPass.cpp:14
A 4-point table lookup routine.
Definition: TabRead4.h:41
A super class inherited by all Pd++ objects.
Definition: PdMaster.h:62
A struct that holds the four interpolation points for TabRead4.
Definition: TabRead4.h:23