aboutsummaryrefslogtreecommitdiff
path: root/sc4pd/source/sc4pd.hpp
diff options
context:
space:
mode:
authorTim Blechmann <timblech@users.sourceforge.net>2004-08-07 14:01:31 +0000
committerIOhannes m zmölnig <zmoelnig@iem.at>2015-10-14 15:11:56 +0200
commit89f570e5ebeab979202acf679974bafd05072692 (patch)
treeada3cb85b33097dae4d35686e6676353d8706486 /sc4pd/source/sc4pd.hpp
parent305c08085dc742d591640f0078638b44878103be (diff)
sc4pd_dsp class and other changes
svn path=/trunk/externals/tb/; revision=1912
Diffstat (limited to 'sc4pd/source/sc4pd.hpp')
-rw-r--r--sc4pd/source/sc4pd.hpp61
1 files changed, 56 insertions, 5 deletions
diff --git a/sc4pd/source/sc4pd.hpp b/sc4pd/source/sc4pd.hpp
index f1f90e2..eacbfff 100644
--- a/sc4pd/source/sc4pd.hpp
+++ b/sc4pd/source/sc4pd.hpp
@@ -35,7 +35,6 @@
*/
#ifndef _SC4PD_HPP
-#define _SC$PD_HPP
#include <flext.h>
@@ -63,8 +62,6 @@
#undef BUFLENGTH
#define BUFLENGTH Blocksize()
-
-
/* to make sure the behaviour is consistent: */
#undef ZXP
@@ -72,6 +69,60 @@
-
-
+class sc4pd_dsp
+ : public flext_dsp
+{
+ FLEXT_HEADER(sc4pd_dsp,flext_dsp);
+
+
+/* some initialisation functions, adapted from SC_Rate.cpp*/
+
+ inline float sc_sampledur()
+ {
+ return 1 / Samplerate();
+ }
+
+ inline float sc_radianspersample()
+ {
+ return twopi / Samplerate();
+ }
+
+ inline float sc_bufduration()
+ {
+ return Blocksize() / Samplerate();
+ }
+
+ inline float sc_bufrate()
+ {
+ return 1 / sc_bufduration();
+ }
+
+ inline float sc_slopefactor()
+ {
+ return 1 / Blocksize();
+ }
+
+ inline float sc_filterloops()
+ {
+ return Blocksize() / 3;
+ }
+
+ inline float sc_filterremain()
+ {
+ return Blocksize() % 3;
+ }
+
+ inline float sc_filterslope()
+ {
+ float f = sc_filterloops();
+ if (f == 0)
+ return 0;
+ else
+ return 1. / f;
+ }
+
+};
+
+
+#define _SC$PD_HPP
#endif