00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "Panorama.h"
00021
00022 using std::ostringstream;
00023 using namespace Marsyas;
00024
00025 Panorama::Panorama(mrs_string name):MarSystem("Panorama", name)
00026 {
00027 addControls();
00028 }
00029
00030 Panorama::Panorama(const Panorama& a) : MarSystem(a)
00031 {
00032 ctrl_angle_ = getctrl("mrs_real/angle");
00033 }
00034
00035 Panorama::~Panorama()
00036 {
00037 }
00038
00039 MarSystem*
00040 Panorama::clone() const
00041 {
00042 return new Panorama(*this);
00043 }
00044
00045 void
00046 Panorama::addControls()
00047 {
00048 addctrl("mrs_real/angle", PI/4, ctrl_angle_);
00049 }
00050
00051 void
00052 Panorama::myUpdate(MarControlPtr sender)
00053 {
00054 (void) sender;
00055 setctrl("mrs_natural/onSamples", getctrl("mrs_natural/onSamples"));
00056
00057 mrs_natural inObservations = getctrl("mrs_natural/inObservations")->to<mrs_natural>();
00058
00059 if (inObservations == 1)
00060 {
00061 setctrl("mrs_natural/onObservations", 2);
00062 mrs_string inObsNames = getctrl("mrs_string/inObsNames")->to<mrs_string>();
00063 inObsNames += ",";
00064 inObsNames += inObsNames;
00065 setctrl("mrs_string/onObsNames", inObsNames);
00066 }
00067 else
00068 {
00069 setctrl("mrs_natural/onObservations", inObservations);
00070 setctrl("mrs_string/onObsNames", getctrl("mrs_string/inObsNames"));
00071 }
00072 setctrl("mrs_real/osrate", getctrl("mrs_real/israte"));
00073 }
00074
00075
00076 void
00077 Panorama::myProcess(realvec& in, realvec& out)
00078 {
00079 mrs_natural t,o;
00080 mrs_real angle = ctrl_angle_->to<mrs_real>();
00081 mrs_real gl = cos(angle) - sin(angle);
00082 mrs_real gr = sin(angle) + cos(angle);
00083
00084 if (inObservations_ == 1)
00085 {
00086 for (t = 0; t < inSamples_; t++)
00087 {
00088 out(0,t) = gl * in(0,t);
00089 out(1,t) = gr * in(0,t);
00090 }
00091 }
00092
00093 else
00094 {
00095 for (o=0; o < onObservations_; o++)
00096 for (t = 0; t < inSamples_; t++)
00097 {
00098 out(o,t) = in(0,t);
00099 }
00100 }
00101
00102
00103 }
00104
00105
00106
00107
00108
00109
00110
00111