summaryrefslogtreecommitdiff
path: root/rotord/src/graph.cpp
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 /rotord/src/graph.cpp
parent5d0dbb41b66792662170ce86334bf4cba87ed700 (diff)
random seed not working
Diffstat (limited to 'rotord/src/graph.cpp')
-rw-r--r--rotord/src/graph.cpp7
1 files changed, 6 insertions, 1 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)) {