summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-11-04 14:46:10 +0000
committerTim Redfern <tim@eclectronics.org>2013-11-04 14:46:10 +0000
commitd480bf3349d2411d20ff0816df5ac7e55ed511f9 (patch)
tree5e645f3dfd2192789296b712f130dabbdeec3806
parent5d0dbb41b66792662170ce86334bf4cba87ed700 (diff)
random seed not working
-rw-r--r--rotord/src/graph.cpp7
-rw-r--r--rotord/src/graph.h3
-rw-r--r--rotord/src/rotor.cpp2
-rw-r--r--rotord/src/rotor.h6
4 files changed, 12 insertions, 6 deletions
diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp
index e323b87..23e2c93 100644
--- a/rotord/src/graph.cpp
+++ b/rotord/src/graph.cpp
@@ -313,6 +313,7 @@ bool Graph::parseJson(string &data,string &media_path){
//we know the json validates so clear the existing graph
clear();
Node_factory factory;
+ analysis_seed=root["seed"].asInt();
check_audio(root["audio"].asString(),media_path);
init(root["ID"].asString(),root["description"].asString());
Json::Value jnodes = root["nodeDefinitions"];
@@ -456,6 +457,7 @@ bool Graph::parseXml(string media_path){
clear();
Node_factory factory;
check_audio(xml.getAttribute("patchbay","audio","",0),media_path);
+ analysis_seed=xml.getAttribute("patchbay","seed",0,0);
init(xml.getAttribute("patchbay","ID","",0),xml.getValue("patchbay","",0));
if(xml.pushTag("patchbay")) {
int n1=xml.getNumTags("node");
@@ -602,7 +604,8 @@ bool Graph::parseXml(string media_path){
bool Graph::load_audio(const string &filename,vector<Audio_processor*> processors){
if (filename.size()==0) return false;
Logger& logger = Logger::get("Rotor");
- logger.information("Analysing "+filename);
+ logger.information("Analysing "+filename+" seed:"+toString(analysis_seed));
+
//audio_loaded=false;
libav::audio_decoder loader;
@@ -629,6 +632,8 @@ bool Graph::load_audio(const string &filename,vector<Audio_processor*> processor
uint16_t *audio=new uint16_t[1024*loader.get_number_channels()];
uint64_t sample=0;
+ srand(analysis_seed);
+
while (!finished&&!cancelled)
{
if (loader.get_samples(audio,sample,1024)) {
diff --git a/rotord/src/graph.h b/rotord/src/graph.h
index ddf2471..4dcd254 100644
--- a/rotord/src/graph.h
+++ b/rotord/src/graph.h
@@ -25,7 +25,7 @@ copy nodes `
namespace Rotor {
class Graph{
public:
- Graph(){duration=20.0f;loaded = false;outW=640;outH=360;audio_thumb=new Audio_thumbnailer();use_fragmentation=false;};
+ Graph(){duration=20.0f;loaded = false;outW=640;outH=360;audio_thumb=new Audio_thumbnailer();use_fragmentation=false;analysis_seed=0;};
Graph(const string& _uid,const string& _desc){
init(_uid,_desc);
audio_loaded=false;
@@ -92,6 +92,7 @@ namespace Rotor {
private:
int outW,outH;
bool use_fragmentation;
+ int analysis_seed;
};
class Thumbnailer{
diff --git a/rotord/src/rotor.cpp b/rotord/src/rotor.cpp
index 840298e..d6e445f 100644
--- a/rotord/src/rotor.cpp
+++ b/rotord/src/rotor.cpp
@@ -72,7 +72,7 @@ Node_factory::Node_factory(){
category["FX"]=vector<Node*>();
add_type("blur",new Blur(),category["FX"]);
- add_type("vhs",new VHS(),category["FX"]);
+ //add_type("vhs",new VHS(),category["FX"]);
add_type("echo_trails",new Echo_trails(),category["FX"]);
add_type("video_feedback",new Video_feedback(),category["FX"]);
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h
index 3bbf5b4..ea9d144 100644
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -220,9 +220,9 @@ namespace Rotor {
}
void init(const std::vector<std::string> &_vals){
vals=_vals;
- //string s;
- //for (auto v:vals) s=s+v+" ";
- //cerr<<"array attribute "<<title<<": "<<s<<endl;
+ string s;
+ for (auto v:vals) s=s+v+" ";
+ cerr<<"array attribute "<<title<<": "<<s<<endl;
}
string value,description,title,type;
std::vector<std::string> vals;