From b7a5a477b8ff4d4e3028b9dfb9a9df0a41463f92 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 27 Dec 2013 15:47:10 +0000 Subject: making template connection logic --- NT/src/rotor.cpp | 4 ++++ NT/src/rotor.h | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/NT/src/rotor.cpp b/NT/src/rotor.cpp index 9a0bc5d..056736d 100644 --- a/NT/src/rotor.cpp +++ b/NT/src/rotor.cpp @@ -12,4 +12,8 @@ int main(){ m.init(settings); if (m.connect("inlet",&t)) printf("connected!\n"); else printf("not connected...\n"); + for (double t=0;t<10.0;t+=0.765){ + Frame_parameters f=Frame_parameters(t,25.0,10.0,640,360); + printf() + } } \ No newline at end of file diff --git a/NT/src/rotor.h b/NT/src/rotor.h index 93b6865..1451a1b 100644 --- a/NT/src/rotor.h +++ b/NT/src/rotor.h @@ -39,7 +39,7 @@ namespace Rotor { double duration; Audio_frame *audio; }; - class Variable { //base type for variable pointers + class Variable { //pure virtual base type for variable pointers public: virtual void init(std::string s)=0; virtual ~Variable(){}; @@ -49,6 +49,7 @@ namespace Rotor { }; template class Variable_type : public Variable { public: + Variable_type(bool _c){connectable=_c;}; void init(std::string s){ std::istringstream cur(s); cur >> value; @@ -108,7 +109,11 @@ namespace Rotor { return false; } template IT* create_inlet(std::string name){ - vars[name]=new Variable_type(); + vars[name]=new Variable_type(true); + return &((dynamic_cast*>(vars[name]))->value); + } + template IT* create_attribute(std::string name){ + vars[name]=new Variable_type(false); return &((dynamic_cast*>(vars[name]))->value); } }; -- cgit v1.2.3