Re: [Sndobj-devel] (no subject)
Status: Abandoned
Brought to you by:
veplaini
From: Victor L. <Vic...@nu...> - 2007-01-26 18:29:54
|
At 18:03 26/01/2007, you wrote: >victor, >would there be any particular utility in having a series of SndObj >that performed math like functions. I am thinking in particular for >use with python or lisp scripting since they might not be as much use >in c++. Probably useful, if it would speed up calculation. These can be done in Python OK, but probably less efficiently >for instance > >class Asin : public SndObj{ >public: > > Asin(SndObj* input, int vecsize=DEF_VECSIZE, float sr=DEF_SR); > ~Asin(); > > short DoProcess(); > >}; > >Asin::Asin(SndObj* input, int vecsize, float sr): > SndObj(input, vecsize, sr) { >} > >Asin::~Asin() { >} > >short Asin::DoProcess(){ > if(!m_error){ > if(m_input){ > for(m_vecpos = 0; m_vecpos < m_vecsize; m_vecpos++){ > if(m_enable) > m_output[m_vecpos] = asinf(m_input->Output(m_vecpos)); > else m_output[m_vecpos] = 0.f; > } > return 1; > } else { > m_error=3; > return 0; > } > } > else return 0; >} > >might not be the best way to do this in some situations but in others >it might be necessary. > > >in particular, and excuse my ignorance about python (i am starting to >learn it, btw), but do SndObj operators get imported in some way? for >instance would the '+' below be valid in python? > >line = Interp(0, 10000, 0.05) >osc = Oscili(tab, pitch, 0, None, line + .2) I don't think that would work in Python. It would not work in C++ either (you have to keep adding values every control period). However, I never tried the overloaded ops in Python. >for the cffi bindings it is not and really needs some type of Add >sndobj: > >class Add : public SndObj{ >public: > > Add(SndObj* input1, SndObj* input2, int vecsize=DEF_VECSIZE, >float sr=DEF_SR); > Add(float input1, SndObj* input2, int vecsize=DEF_VECSIZE, float >sr=DEF_SR); > Add(SndObj* input1, float input1, int vecsize=DEF_VECSIZE, float >sr=DEF_SR); > ~Add(); > > short DoProcess(); > >}; > >then could be used > >(setf line (new_interp 0 10000 .05)) >(setf osc (new_oscili tab pitch 0 nil (new_add line osc))) > > >i have a bunch of these defined in a basic way - would they be useful >or merely included just for the benefit of lisp. if the latter than >maybe i could but them as separate code that SWIG would wrap? We can think about it. I'll check what can and can't be done in Python. At the moment, it's the Intel Mac bug that is making me worry. I really can't see what the issue is. But then again I only hear reports. All the best Victor Lazzarini Music Technology Laboratory Music Department National University of Ireland, Maynooth |