Marsyas
0.6.0-alpha
|
00001 #include "FlowToControl.h" 00002 00003 namespace Marsyas { 00004 00005 FlowToControl::FlowToControl(std::string name): 00006 MarSystem("FlowToControl", name) 00007 { 00008 addControl("mrs_natural/row", 0, m_row_ctl); 00009 addControl("mrs_natural/column", 0, m_col_ctl); 00010 addControl("mrs_real/value", 0.0, m_value_ctl); 00011 } 00012 00013 FlowToControl::FlowToControl(const FlowToControl & other): 00014 MarSystem(other) 00015 { 00016 m_row_ctl = getControl("mrs_natural/row"); 00017 m_col_ctl = getControl("mrs_natural/column"); 00018 m_value_ctl = getControl("mrs_real/value"); 00019 } 00020 00021 FlowToControl::~FlowToControl() {} 00022 00023 MarSystem* FlowToControl::clone() const 00024 { 00025 return new FlowToControl(*this); 00026 } 00027 00028 void FlowToControl::myUpdate(MarControlPtr sender) 00029 { 00030 if (sender() == m_row_ctl() || sender() == m_col_ctl()) 00031 return; 00032 00033 MarSystem::myUpdate(sender); 00034 } 00035 00036 void FlowToControl::myProcess(realvec &in, realvec &out) 00037 { 00038 out = in; 00039 00040 mrs_natural row = m_row_ctl->to<mrs_natural>(); 00041 mrs_natural col = m_col_ctl->to<mrs_natural>(); 00042 00043 if (row >= 0 && row < in.getRows() && 00044 col >= 0 && col < in.getCols() ) 00045 { 00046 m_value_ctl->setValue(in(row,col)); 00047 } 00048 } 00049 00050 } // namespace Marsyas