Pd++  0.01
A pure C++ implementation of Pure Data objects
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
PdAlgorithm.h
1 /*! \brief This class is where you put all your audio routines, etc.
2 
3  This class emulates a Pd Patch. Your algorithm or patch code would
4  be simulated in the runAlgorithm(double, double) function.
5  Subpatches and abstractions could be member functions.
6  Abstractions and externals could be separate classes.
7  The runAlgorithm receives audio input and writes the output
8  to the Buffer data type. Buffer is defined in the superclass PdMaster.
9  The audio I/O class paRender only calls the runAlgorithm function, so
10  all your audio output data must end up in this function via objects
11  or member functions.
12 
13  NOTE: It's best not to write to the stdout (e.g std::cout, or printf()) in
14  your runAlgorithm function, unless you are using mainNoAudio.cpp. It could
15  cause audio interruptions.
16 
17  Created by Robert Esler on 9/17/14.
18  Copyright (c) 2014 Robert Esler. All rights reserved.
19  */
20 
21 #ifndef __Pd____PdAlgorithm__
22 #define __Pd____PdAlgorithm__
23 
24 #include "PdMaster.h"
25 #include "MasterObjectList.h"
26 #include <cmath>
27 
28 /*A simulation of a Pd Patch, this is where your audio code will be placed.*/
29 class PdAlgorithm : public PdMaster {
30 
31  /*Pd++ objects created here, plus other private members*/
32 private:
33 
34  rwe::SineWave sine[6];
35  rwe::SSB ssb;
36  rwe::WhiteNoise myWhiteNoise;
37  rwe::Metro metro;
38  rwe::Timer timer;
39 
40  pd::SoundFiler soundfiler;
41  std::vector<double> audioFileData;
42  double *outFile;
43  pd::realFFT rFFT;
44  pd::realIFFT rIFFT;
45  pd::Line line;
46  pd::TabRead4 tabRead4;
47  pd::Noise noise;
48  pd::Cosine cos;
49  pd::Phasor phasor;
50  pd::Oscillator osc;
51  pd::Delay delay;
54  pd::LowPass lop;
55  pd::Envelope env;
56 
57 
58  double freqSweep;
59  double feedBack = 0;
60  double arraySize = 0;
61  double f = 441;
62  int tabRead4Counter = 1;
63  int count = 0;
64 
65 public:
66 
67  std::vector<double> test;
68 
69  PdAlgorithm();
70  ~PdAlgorithm();
71 
72  /*algorithm goes here
73  audio input is passed from paRender*/
74  Buffer runAlgorithm(double input1, double input2);
75 
76 };
77 
78 #endif /* defined(__Pd____PdAlgorithm__) */
Reads and writes sound files.
Definition: SoundFiler.h:38
This class is where you put all your audio routines, etc.
Definition: PdAlgorithm.h:29
A sinewave oscillator.
Definition: Oscillator.h:32
A 4-point table lookup routine.
Definition: TabRead4.h:41
A super class inherited by all Pd++ objects.
Definition: PdMaster.h:62
A sawtooth generator.
Definition: Phasor.h:27
Input and output struct for PdAlgorithm.
Definition: PdMaster.h:46
A sine wave generator.
Definition: SineWave.h:23
A white noise generator.
Definition: WhiteNoise.h:22
A simple envelope follower with Hanning window. Use setWindowSize() and setPeriod() the window size a...
Definition: Envelope.h:27
A noise~ generator.
Definition: Noise.h:24
A cosine waveshaper.
Definition: Cosine.h:34
A simple timer that outputs milliseconds.
Definition: Timer.h:25
Real Inverse Fast Fourier Transform.
Definition: rIFFT.h:33
Voltage-controlled filter.
Definition: VoltageControlFilter.h:46
A basic delay line.
Definition: Delay.h:30
Single Sideband Modulation.
Definition: SingleSideBandModulation.h:32
Real Fast Fourier Transform.
Definition: rFFT.h:28
A ramp generator.
Definition: Line.h:29
A one-pole low pass filter.
Definition: LowPass.h:29
Buffer runAlgorithm(double input1, double input2)
Definition: PdAlgorithm (Robert-Eslers-MacBook-Pro's conflicted copy 2014-10-11).cpp:60
Reads from a table at a variable delay rate.
Definition: VariableDelay.h:39
A simple metronome that accepts milliseconds and beats per minute.
Definition: Metro.h:25