Update of /cvsroot/pure-data/externals/tbext/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24408/source
Modified Files:
him.cpp
Log Message:
some updates
Index: him.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tbext/source/him.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** him.cpp 31 Mar 2004 11:44:38 -0000 1.2
--- him.cpp 9 Apr 2004 13:42:01 -0000 1.3
***************
*** 72,76 ****
void set_dt(t_float);
void set_regtime(bool);
- void set_output(t_int);
void state();
void reset();
--- 72,75 ----
***************
*** 93,97 ****
//and these our settings
t_float dt;
- t_int output; //mu, muv, nu, nuv, x, y
bool regtime; //if true "regularisierte zeit"
--- 92,95 ----
***************
*** 104,108 ****
FLEXT_CALLBACK_1(set_dt,t_float);
FLEXT_CALLBACK_1(set_regtime,bool);
- FLEXT_CALLBACK_1(set_output,t_int);
FLEXT_CALLBACK(state);
FLEXT_CALLBACK(reset);
--- 102,105 ----
***************
*** 136,139 ****
--- 133,141 ----
AddInAnything();
AddOutSignal();
+ AddOutSignal();
+ AddOutSignal();
+ AddOutSignal();
+ AddOutSignal();
+ AddOutSignal();
FLEXT_ADDMETHOD_F(0,"mu",set_mu);
FLEXT_ADDMETHOD_F(0,"muv",set_muv);
***************
*** 143,147 ****
FLEXT_ADDMETHOD_F(0,"dt",set_dt);
FLEXT_ADDMETHOD_B(0,"regtime",set_regtime);
- FLEXT_ADDMETHOD_I(0,"output",set_output);
FLEXT_ADDMETHOD_(0,"state",state);
FLEXT_ADDMETHOD_(0,"reset",reset);
--- 145,148 ----
***************
*** 160,164 ****
//default mode
regtime=true;
- output=0;
dt=0.01;
}
--- 161,164 ----
***************
*** 200,205 ****
data[i] = data[i] + (k1[i] + (2.*(k2[i]+k3[i])) + k4[i])/6.;
}
!
! reset_muv();
}
--- 200,215 ----
data[i] = data[i] + (k1[i] + (2.*(k2[i]+k3[i])) + k4[i])/6.;
}
!
!
! /*
! the system might become unstable ... in this case, we'll reset the system
! */
!
! for(i=0;i<=NUMB_EQ-1;i++)
! if(data[i]>2)
! reset();
! else
! if(PD_BADFLOAT(data[i])) //not that we get some troubles with denormals
! data[i]=0;
}
***************
*** 209,324 ****
void him::m_signal(int n, t_float *const *in, t_float *const *out)
{
- outs = out[0];
-
if (regtime)
{
! switch (output)
{
! case 0:
! for (int j=0;j!=n;++j)
! {
! runge_kutta_4(dt);
! *(outs+j)=data[0];
! }
! break;
!
! case 1:
! for (int j=0;j!=n;++j)
! {
! runge_kutta_4(dt);
! *(outs+j)=data[1];
! }
! break;
!
! case 2:
! for (int j=0;j!=n;++j)
! {
! runge_kutta_4(dt);
! *(outs+j)=data[2];
! }
! break;
!
! case 3:
! for (int j=0;j!=n;++j)
! {
! runge_kutta_4(dt);
! *(outs+j)=data[3];
! }
! break;
!
! case 4:
! for (int j=0;j!=n;++j)
! {
! runge_kutta_4(dt);
! *(outs+j)=data[0]*data[2];
! }
! break;
!
! case 5:
! for (int j=0;j!=n;++j)
! {
! runge_kutta_4(dt);
! *(outs+j)=(data[0]*data[0]-data[2]*data[2])*0.5;
! }
! break;
}
}
else
{
! switch (output)
! {
! case 0:
! for (int j=0;j!=n;++j)
! {
! runge_kutta_4(dt/
! (2*sqrt(data[0]*data[0]+data[2]*data[2])));
! *(outs+j)=data[0];
! }
! break;
!
! case 1:
! for (int j=0;j!=n;++j)
! {
! runge_kutta_4(dt/
! (2*sqrt(data[0]*data[0]+data[2]*data[2])));
! *(outs+j)=data[1];
! }
! break;
!
! case 2:
! for (int j=0;j!=n;++j)
! {
! runge_kutta_4(dt/
! (2*sqrt(data[0]*data[0]+data[2]*data[2])));
! *(outs+j)=data[2];
! }
! break;
!
! case 3:
! for (int j=0;j!=n;++j)
! {
! runge_kutta_4(dt/
! (2*sqrt(data[0]*data[0]+data[2]*data[2])));
! *(outs+j)=data[3];
! }
! break;
!
! case 4:
! for (int j=0;j!=n;++j)
! {
! runge_kutta_4(dt/
! (2*sqrt(data[0]*data[0]+data[2]*data[2])));
! *(outs+j)=data[0]*data[2];
! }
! break;
!
! case 5:
! for (int j=0;j!=n;++j)
! {
! runge_kutta_4(dt/
! (2*sqrt(data[0]*data[0]+data[2]*data[2])));
! *(outs+j)=(data[0]*data[0]-data[2]*data[2])*0.5;
! }
! break;
}
}
--- 219,247 ----
void him::m_signal(int n, t_float *const *in, t_float *const *out)
{
if (regtime)
{
! for (int j=0;j!=n;++j)
{
! runge_kutta_4(dt);
! *(out[0]+j)=data[0];
! *(out[1]+j)=data[1];
! *(out[2]+j)=data[2];
! *(out[3]+j)=data[3];
! *(out[4]+j)=data[0]*data[2];
! *(out[5]+j)=(data[0]*data[0]-data[2]*data[2])*0.5;
}
}
else
{
! for (int j=0;j!=n;++j)
! {
! runge_kutta_4(dt/
! (2*sqrt(data[0]*data[0]+data[2]*data[2])));
! *(out[0]+j)=data[0];
! *(out[1]+j)=data[1];
! *(out[2]+j)=data[2];
! *(out[3]+j)=data[3];
! *(out[4]+j)=data[0]*data[2];
! *(out[5]+j)=(data[0]*data[0]-data[2]*data[2])*0.5;
}
}
***************
*** 366,373 ****
}
- void him::set_output(t_int i)
- {
- output=i;
- }
void him::state()
--- 289,292 ----
***************
*** 385,389 ****
data[1]=float(rand())/float(RAND_MAX);
data[2]=float(rand())/float(RAND_MAX);
! reset_muv();
post("randomizing values");
}
--- 304,308 ----
data[1]=float(rand())/float(RAND_MAX);
data[2]=float(rand())/float(RAND_MAX);
! reset_nuv();
post("randomizing values");
}