summaryrefslogtreecommitdiff
path: root/rotord
diff options
context:
space:
mode:
Diffstat (limited to 'rotord')
-rw-r--r--rotord/Makefile1
-rwxr-xr-xrotord/rotor.h28
2 files changed, 29 insertions, 0 deletions
diff --git a/rotord/Makefile b/rotord/Makefile
index d2546e0..ed200cc 100644
--- a/rotord/Makefile
+++ b/rotord/Makefile
@@ -43,6 +43,7 @@ HDREXTS = .h .H .hh .hpp .HPP .h++ .hxx .hp
# Users can override those variables from the command line.
CFLAGS = -g -O2
CXXFLAGS=
+CXX = colorgcc
# The C program compiler.
#CC = gcc
diff --git a/rotord/rotor.h b/rotord/rotor.h
index f27d99d..ed566c7 100755
--- a/rotord/rotor.h
+++ b/rotord/rotor.h
@@ -599,6 +599,34 @@ namespace Rotor {
return 0.0f;
}
};
+ //pseudo random repeatable hash function
+ //http://create.stephan-brumme.com/fnv-hash/
+ const uint32_t Prime = 0x01000193; // 16777619
+ const uint32_t Seed = 0x811C9DC5; // 2166136261
+ class Random: public Signal_node {
+ public:
+ Random(){};
+ Random(map<string,string> &settings) {
+ base_settings(settings);
+ seed=ofToFloat(find_setting(settings,"amount"));
+ for (auto p:parameter_inputs){
+ if (p->parameter=="seed") p->receiver=&seed;
+ }
+ key=0xffffffff;
+ };
+ Random* clone(map<string,string> &_settings) { return new Random(_settings);};
+ const float output(const Time_spec &time) {
+ if (inputs.size()) { //there should there be a way to specify number of inputs in the code rather than in xml
+ if (inputs[0]->connection) {
+ return 0.0f;
+ //return (((Signal_node*)inputs[0]->connection)->get_output(time))/divide_amount;
+ }
+ }
+ return 0.0f;
+ }
+ float seed;
+ uint32_t key;
+ };
class Signal_output: public Signal_node {
public:
Signal_output(){};