From b00be027fe91e9ae5a19f53b6c1fd0245b4d4bae Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 15 Jan 2003 04:37:19 +0000 Subject: "" svn path=/trunk/; revision=339 --- externals/grill/fftease/fftease.cw | Bin 131116 -> 203740 bytes externals/grill/fftease/fftease.dsp | 4 + externals/grill/fftease/make-files.txt | 2 +- externals/grill/fftease/src/burrow~.cpp | 150 +----- externals/grill/fftease/src/cross~.cpp | 181 +------ externals/grill/fftease/src/dentist~.cpp | 157 +----- externals/grill/fftease/src/disarray~.cpp | 171 +------ externals/grill/fftease/src/drown~.cpp | 168 +----- externals/grill/fftease/src/ether~.cpp | 160 +----- externals/grill/fftease/src/fftease.cpp | 185 +++++++ externals/grill/fftease/src/main.h | 47 ++ externals/grill/flext/flext.cw | Bin 205457 -> 319687 bytes externals/grill/flext/flext.pbproj/project.pbxproj | 570 ++++++++++++++++++++- externals/grill/flext/readme.txt | 1 + externals/grill/flext/source/flatom.cpp | 4 +- externals/grill/flext/source/flatom_pr.cpp | 24 +- externals/grill/flext/source/flattr.cpp | 6 +- externals/grill/flext/source/flbase.h | 110 ++-- externals/grill/flext/source/flbuf.cpp | 10 +- externals/grill/flext/source/flclass.h | 115 +++-- externals/grill/flext/source/fldsp.cpp | 122 ++++- externals/grill/flext/source/fldsp.h | 28 +- externals/grill/flext/source/flext.cpp | 28 +- externals/grill/flext/source/flinternal.h | 3 + externals/grill/flext/source/fllib.cpp | 50 +- externals/grill/flext/source/flout.cpp | 125 ++++- externals/grill/flext/source/flproxy.cpp | 18 +- externals/grill/flext/source/flqueue.cpp | 44 +- externals/grill/flext/source/flstdc.h | 42 +- externals/grill/flext/source/flsupport.cpp | 21 +- externals/grill/flext/source/flsupport.h | 56 +- externals/grill/vasp/vasp.cw | Bin 142172 -> 168240 bytes externals/grill/xsample/source/groove.cpp | 9 +- externals/grill/xsample/source/record.cpp | 9 +- externals/grill/xsample/xsample.cw | Bin 106655 -> 153773 bytes 35 files changed, 1479 insertions(+), 1141 deletions(-) create mode 100644 externals/grill/fftease/src/fftease.cpp diff --git a/externals/grill/fftease/fftease.cw b/externals/grill/fftease/fftease.cw index fb502752..8644858e 100755 Binary files a/externals/grill/fftease/fftease.cw and b/externals/grill/fftease/fftease.cw differ diff --git a/externals/grill/fftease/fftease.dsp b/externals/grill/fftease/fftease.dsp index 85b09613..f825d29b 100644 --- a/externals/grill/fftease/fftease.dsp +++ b/externals/grill/fftease/fftease.dsp @@ -409,6 +409,10 @@ SOURCE=".\ori.max\xsyn-opt~.c" # End Group # Begin Source File +SOURCE=.\src\fftease.cpp +# End Source File +# Begin Source File + SOURCE=.\src\main.cpp # End Source File # Begin Source File diff --git a/externals/grill/fftease/make-files.txt b/externals/grill/fftease/make-files.txt index 567427b4..1866faa6 100644 --- a/externals/grill/fftease/make-files.txt +++ b/externals/grill/fftease/make-files.txt @@ -2,7 +2,7 @@ SRCS= \ convert.c convert_new.c fft4.c fft.c fold.c \ leanconvert.c leanunconvert.c makewindows.c overlapadd.c unconvert.c \ - main.cpp \ + main.cpp fftease.cpp \ burrow~.cpp cross~.cpp dentist~.cpp disarray~.cpp drown~.cpp ether~.cpp HDRS= \ diff --git a/externals/grill/fftease/src/burrow~.cpp b/externals/grill/fftease/src/burrow~.cpp index d868cbb8..0bb3208f 100644 --- a/externals/grill/fftease/src/burrow~.cpp +++ b/externals/grill/fftease/src/burrow~.cpp @@ -13,41 +13,23 @@ WARRANTIES, see the file, "license.txt," in this distribution. class burrow: - public flext_dsp + public fftease { - FLEXT_HEADER_S(burrow,flext_dsp,setup) + FLEXT_HEADER_S(burrow,fftease,setup) public: burrow(I argc,const t_atom *argv); - ~burrow(); protected: - virtual V m_dsp(I n,S *const *in,S *const *out); - virtual V m_signal(I n,S *const *in,S *const *out); + virtual V Transform(I _N2,S *const *in); - I blsz; BL _invert; F _threshold,_multiplier; F _thresh_dB,_mult_dB; - F *_input1,*_input2; - F *_buffer1,*_buffer2; - F *_channel1,*_channel2; - F *_output; - F *_trigland; - I *_bitshuffle; - F *_Wanal,*_Wsyn,*_Hwin; - - I _inCount; - private: - enum { _MULT_ = 4 }; - - V Clear(); - V Delete(); - V ms_thresh(F v) { _threshold = (float) (pow( 10., ((_thresh_dB = v) * .05))); } V ms_mult(F v) { _multiplier = (float) (pow( 10., ((_mult_dB = v) * .05))); } @@ -73,9 +55,9 @@ V burrow::setup(t_classid c) burrow::burrow(I argc,const t_atom *argv): + fftease(4,true,true,true), _thresh_dB(-30),_mult_dB(-18), - _invert(false), - blsz(0) + _invert(false) { /* parse and set object's options given */ if(argc >= 1) { @@ -100,113 +82,15 @@ burrow::burrow(I argc,const t_atom *argv): ms_thresh(_thresh_dB); ms_mult(_mult_dB); - Clear(); - AddInSignal("Messages and input signal"); AddInSignal("Reference signal"); AddOutSignal("Transformed signal"); } -burrow::~burrow() -{ - Delete(); -} - -V burrow::Clear() -{ - _bitshuffle = NULL; - _trigland = NULL; - _input1 = _input2 = NULL; - _Hwin = NULL; - _Wanal = _Wsyn = NULL; - _buffer1 = _buffer2 = NULL; - _channel1 = _channel2 = NULL; - _output = NULL; -} - -V burrow::Delete() -{ - if(_bitshuffle) delete[] _bitshuffle; - if(_trigland) delete[] _trigland; - if(_input1) delete[] _input1; - if(_input2) delete[] _input2; - if(_Hwin) delete[] _Hwin; - if(_Wanal) delete[] _Wanal; - if(_Wsyn) delete[] _Wsyn; - if(_buffer1) delete[] _buffer1; - if(_buffer2) delete[] _buffer2; - if(_channel1) delete[] _channel1; - if(_channel2) delete[] _channel2; - if(_output) delete[] _output; -} - - - -V burrow::m_dsp(I n,S *const *,S *const *) -{ - const I _D = n; - if(_D != blsz) { - blsz = _D; - - Delete(); - - /* preset the objects data */ - const I _N = _D*_MULT_,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; - - _inCount = -_Nw; - - /* assign memory to the buffers */ - _input1 = new F[_Nw]; - _input2 = new F[_Nw]; - _buffer1 = new F[_N]; - _buffer2 = new F[_N]; - _channel1 = new F[_N+2]; - _channel2 = new F[_N+2]; - _output = new F[_Nw]; - _bitshuffle = new I[_N*2]; - _trigland = new F[_N*2]; - - _Hwin = new F[_Nw]; - _Wanal = new F[_Nw]; - _Wsyn = new F[_Nw]; - - /* initialize pv-lib functions */ - init_rdft( _N, _bitshuffle, _trigland); - makewindows( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0); - } -} - -V burrow::m_signal(I n,S *const *in,S *const *out) +V burrow::Transform(I _N2,S *const *in) { - /* declare working variables */ - I i, j; - const I _D = n,_N = _D*_MULT_,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; - - /* fill our retaining buffers */ - _inCount += _D; - - for(i = 0; i < _N-_D ; i++ ) { - _input1[i] = _input1[i+_D]; - _input2[i] = _input2[i+_D]; - } - for(j = 0; i < _N; i++,j++) { - _input1[i] = in[0][j]; - _input2[i] = in[1][j]; - } - - /* apply hamming window and fold our window buffer into the fft buffer */ - fold( _input1, _Wanal, _Nw, _buffer1, _N, _inCount ); - fold( _input2, _Wanal, _Nw, _buffer2, _N, _inCount ); - - /* do an fft */ - rdft( _N, 1, _buffer1, _bitshuffle, _trigland ); - rdft( _N, 1, _buffer2, _bitshuffle, _trigland ); - - - // ---- BEGIN -------------------------------- - - for ( i = 0; i <= _N2; i++ ) { + for (I i = 0; i <= _N2; i++ ) { const I even = i<<1,odd = even+1; /* convert to polar coordinates from complex values */ @@ -233,26 +117,6 @@ V burrow::m_signal(I n,S *const *in,S *const *out) if ( i != _N2 ) _buffer1[odd] = -_channel1[even] * sin( _channel1[odd] ); } - - - // ---- END -------------------------------- - - - /* do an inverse fft */ - rdft( _N, -1, _buffer1, _bitshuffle, _trigland ); - - /* dewindow our result */ - overlapadd( _buffer1, _N, _Wsyn, _output, _Nw, _inCount); - - /* set our output and adjust our retaining output buffer */ - const F mult = 1./_N; - for ( j = 0; j < _D; j++ ) - out[0][j] = _output[j] * mult; - - for ( j = 0; j < _N-_D; j++ ) - _output[j] = _output[j+_D]; - for (; j < _N; j++ ) - _output[j] = 0.; } diff --git a/externals/grill/fftease/src/cross~.cpp b/externals/grill/fftease/src/cross~.cpp index 0eb19c02..728e868a 100644 --- a/externals/grill/fftease/src/cross~.cpp +++ b/externals/grill/fftease/src/cross~.cpp @@ -13,188 +13,36 @@ WARRANTIES, see the file, "license.txt," in this distribution. class cross: - public flext_dsp + public fftease { - FLEXT_HEADER_S(cross,flext_dsp,setup) + FLEXT_HEADER(cross,fftease) public: cross(I argc,const t_atom *argv); - ~cross(); protected: - virtual V m_dsp(I n,S *const *in,S *const *out); - virtual V m_signal(I n,S *const *in,S *const *out); - - I blsz; - F smprt; - - F *_input1,*_input2; - F *_buffer1,*_buffer2; - F *_channel1,*_channel2; - F *_output; - F *_trigland; - I *_bitshuffle; - F *_Wanal,*_Wsyn,*_Hwin; - - I _inCount; - -private: - enum { _MULT_ = 2 }; - - V Clear(); - V Delete(); - - static V setup(t_classid c); + virtual V Transform(I _N2,S *const *in); }; FLEXT_LIB_DSP_V("fftease, cross~",cross) -V cross::setup(t_classid c) -{ -} - - cross::cross(I argc,const t_atom *argv): - blsz(0),smprt(0) + fftease(2,true,true,true) { - Clear(); - AddInSignal("Messages and driver signal"); AddInSignal("Filter signal"); AddInSignal("Threshold signal for cross synthesis"); AddOutSignal("Transformed signal"); } -cross::~cross() -{ - Delete(); -} - -V cross::Clear() +V cross::Transform(I _N2,S *const *in) { - _input1 = _input2 = NULL; - _buffer1 = _buffer2 = NULL; - _channel1 = _channel2 = NULL; - _output = NULL; - - _bitshuffle = NULL; - _trigland = NULL; - - _Hwin = NULL; - _Wanal = _Wsyn = NULL; -} - -V cross::Delete() -{ - if(_input1) delete[] _input1; - if(_input2) delete[] _input2; - if(_buffer1) delete[] _buffer1; - if(_buffer2) delete[] _buffer2; - if(_channel1) delete[] _channel1; - if(_channel2) delete[] _channel2; - if(_output) delete[] _output; - - if(_bitshuffle) delete[] _bitshuffle; - if(_trigland) delete[] _trigland; - - if(_Wanal) delete[] _Wanal; - if(_Wsyn) delete[] _Wsyn; - if(_Hwin) delete[] _Hwin; - - // --------------------------------------------- - -#if 0 - // T.G. These are not used - if(c_lastphase_in1) delete[] c_lastphase_in1; - if(c_lastphase_in2) delete[] c_lastphase_in2; - if(c_lastphase_out) delete[] c_lastphase_out; -#endif -} - - - -V cross::m_dsp(I n,S *const *,S *const *) -{ - const I _D = n; - const F _R = Samplerate(); - - if(_D != blsz || _R != smprt) { - blsz = _D; - smprt = _R; - - Delete(); - - const int _N = _D*_MULT_,_Nw = _N,_N2 = _N>>1,_Nw2 = _Nw>>1; - - _inCount = -_Nw; - - _input1 = new F[_Nw]; - _input2 = new F[_Nw]; - _buffer1 = new F[_N]; - _buffer2 = new F[_N]; - _channel1 = new F[_N+2]; - _channel2 = new F[_N+2]; - _output = new F[_Nw]; - - _bitshuffle = new I[_N*2]; - _trigland = new F[_N*2]; - - _Wanal = new F[_Nw]; - _Wsyn = new F[_Nw]; - _Hwin = new F[_Nw]; - - init_rdft( _N, _bitshuffle, _trigland); - - // makewindows( x->Hwin, x->Wanal, x->Wsyn, x->Nw, x->N, x->D, 0); - makehanning( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0,0); - - // --------------------------------------------- - -#if 0 - // T.G. These are not used - /* for convert */ - c_lastphase_in1 = new F[_N2+1]; - c_lastphase_in2 = new F[_N2+1]; - c_lastphase_out = new F[_N2+1]; - c_fundamental = _R/( _N2<<1 ); - c_factor_in = _R/(_D * __TWOPI); - c_factor_out = __TWOPI * _D/_R; -#endif - } -} - -V cross::m_signal(I n,S *const *in,S *const *out) -{ - /* declare working variables */ - I i, j; - const I _D = n,_N = _D*_MULT_,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; - - _inCount += _D; - - for ( j = 0 ; j < _N-_D ; j++ ) { - _input1[j] = _input1[j+_D]; - _input2[j] = _input2[j+_D]; - } - for (i = 0; j < _N; j++,i++ ) { - _input1[j] = in[0][i]; - _input2[j] = in[1][i]; - } - - fold( _input1, _Wanal, _Nw, _buffer1, _N, _inCount ); - fold( _input2, _Wanal, _Nw, _buffer2, _N, _inCount ); - - rdft( _N, 1, _buffer1, _bitshuffle, _trigland ); - rdft( _N, 1, _buffer2, _bitshuffle, _trigland ); - - - // ---- BEGIN -------------------------------- - // TG: filled only once per signal vector!! - float threshie = *in[2]; + float threshie = *in[0]; - for ( i = 0; i <= _N2; i++ ) { + for (I i = 0; i <= _N2; i++ ) { const I even = i<<1,odd = even+1; F a = ( i == _N2 ? _buffer1[1] : _buffer2[even] ); @@ -215,21 +63,6 @@ V cross::m_signal(I n,S *const *in,S *const *out) if ( i != _N2 ) _buffer1[odd] = -_channel1[even] * sin( _channel1[odd] ); } - - // ---- END -------------------------------- - - rdft( _N, -1, _buffer1, _bitshuffle, _trigland ); - - overlapadd( _buffer1, _N, _Wsyn, _output, _Nw, _inCount); - - const F mult = 1./_N; - for ( j = 0; j < _D; j++ ) - out[0][j] = _output[j] * mult; - - for ( j = 0; j < _N-_D; j++ ) - _output[j] = _output[j+_D]; - for (; j < _N; j++ ) - _output[j] = 0.; } diff --git a/externals/grill/fftease/src/dentist~.cpp b/externals/grill/fftease/src/dentist~.cpp index 808796bd..375006b9 100644 --- a/externals/grill/fftease/src/dentist~.cpp +++ b/externals/grill/fftease/src/dentist~.cpp @@ -13,33 +13,16 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include class dentist: - public flext_dsp + public fftease { - FLEXT_HEADER_S(dentist,flext_dsp,setup) + FLEXT_HEADER_S(dentist,fftease,setup) public: dentist(I argc,const t_atom *argv); - ~dentist(); protected: - virtual V m_dsp(I n,S *const *in,S *const *out); - virtual V m_signal(I n,S *const *in,S *const *out); - - I blsz; - F smprt; - - F *_input1,*_input2; - F *_buffer1,*_buffer2; - F *_channel1,*_channel2; - F *_output; - F *_trigland; - I *_bitshuffle; - F *_Wanal,*_Wsyn,*_Hwin; - - I _inCount; - - // ----------------------------- + virtual V Transform(I _N2,S *const *in); I *_bin_selection; I _tooth_count; @@ -49,10 +32,10 @@ protected: V reset_shuffle(); private: - enum { _MULT_ = 4 }; - V Clear(); - V Delete(); + virtual V Set(); + virtual V Clear(); + virtual V Delete(); V ms_knee(F knee); V ms_teeth(I teeth) { _tooth_count = teeth; reset_shuffle(); } @@ -80,7 +63,7 @@ V dentist::setup(t_classid c) dentist::dentist(I argc,const t_atom *argv): - blsz(0),smprt(0), + fftease(4,false,true,true), _knee(500),_tooth_count(10) { /* parse and set object's options given */ @@ -97,55 +80,20 @@ dentist::dentist(I argc,const t_atom *argv): post("%s - Teeth must be an integer value - set to %0i",thisName(),_tooth_count); } - Clear(); - AddInSignal("Messages and input signal"); AddOutSignal("Transformed signal"); } -dentist::~dentist() -{ - Delete(); -} - V dentist::Clear() { - _input1 = _input2 = NULL; - _buffer1 = _buffer2 = NULL; - _channel1 = _channel2 = NULL; - _output = NULL; - - _bitshuffle = NULL; - _trigland = NULL; - - _Hwin = NULL; - _Wanal = _Wsyn = NULL; - - // ----------------------------- + fftease::Clear(); _bin_selection = NULL; } V dentist::Delete() { - if(_input1) delete[] _input1; - if(_buffer1) delete[] _buffer1; - if(_channel1) delete[] _channel1; -/* - if(_input2) delete[] _input2; - if(_buffer2) delete[] _buffer2; - if(_channel2) delete[] _channel2; -*/ - if(_output) delete[] _output; - - if(_bitshuffle) delete[] _bitshuffle; - if(_trigland) delete[] _trigland; - - if(_Wanal) delete[] _Wanal; - if(_Wsyn) delete[] _Wsyn; - if(_Hwin) delete[] _Hwin; - - // ----------------------------- + fftease::Delete(); if(_bin_selection) delete[] _bin_selection; } @@ -155,7 +103,7 @@ V dentist::ms_knee(F f) { _knee = f; // store original - const F funda = Samplerate()/(2*_MULT_*Blocksize()); + const F funda = Samplerate()/(2*Mult()*Blocksize()); // TG: This is a different, but steady correction than in original fftease if( f < funda ) f = funda; @@ -166,97 +114,32 @@ V dentist::ms_knee(F f) } -V dentist::m_dsp(I n,S *const *,S *const *) +V dentist::Set() { - const I _D = n; - const F _R = Samplerate(); - if(_D != blsz || _R != smprt) { - blsz = _D; - smprt = _R; - - Delete(); - // --------------------------------------------- - - const int _N = _D*_MULT_,_Nw = _N,_Nw2 = _Nw>>1,_N2 = _N>>1; - - _inCount = -_Nw; - - _input1 = new F[_Nw]; - _buffer1 = new F[_N]; - _channel1 = new F[_N+2]; - /* - _input2 = new F[_Nw]; - _buffer2 = new F[_N]; - _channel2 = new F[_N+2]; - */ - - _output = new F[_Nw]; - - _bitshuffle = new I[_N*2]; - _trigland = new F[_N*2]; - - _Wanal = new F[_Nw]; - _Wsyn = new F[_Nw]; - _Hwin = new F[_Nw]; - - init_rdft( _N, _bitshuffle, _trigland); - makewindows( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0); - - // --------------------------------------------- - - // calculation of _max_bin - ms_knee(_knee); + fftease::Set(); + + // calculation of _max_bin + ms_knee(_knee); - _bin_selection = new I[_N2]; - reset_shuffle(); - } + _bin_selection = new I[(Blocksize()*Mult())>>1]; + reset_shuffle(); } -V dentist::m_signal(I n,S *const *in,S *const *out) +V dentist::Transform(I _N2,S *const *in) { - /* declare working variables */ - I i, j; - const I _D = n,_N = _D*_MULT_,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; - - _inCount += _D; - - for ( j = 0 ; j < _N-_D ; j++ ) - _input1[j] = _input1[j+_D]; - for (i = 0; j < _N; j++,i++ ) - _input1[j] = in[0][i]; - - fold( _input1, _Wanal, _Nw, _buffer1, _N, _inCount ); - rdft( _N, 1, _buffer1, _bitshuffle, _trigland ); - - // ---- BEGIN -------------------------------- - leanconvert( _buffer1, _channel1, _N2 ); - for( i = 0; i < _N2 ; i++){ + for(I i = 0; i < _N2 ; i++){ if( !_bin_selection[i] ) _channel1[i*2] = 0; } leanunconvert( _channel1, _buffer1, _N2 ); - - // ---- END -------------------------------- - - rdft( _N, -1, _buffer1, _bitshuffle, _trigland ); - overlapadd( _buffer1, _N, _Wsyn, _output, _Nw, _inCount); - - const F mult = 1./_N; - for ( j = 0; j < _D; j++ ) - out[0][j] = _output[j] * mult; - - for ( j = 0; j < _N-_D; j++ ) - _output[j] = _output[j+_D]; - for (; j < _N; j++ ) - _output[j] = 0.; } V dentist::reset_shuffle() { - const I _N2 = Blocksize()*_MULT_/2; + const I _N2 = Blocksize()*Mult()/2; I teeth = _tooth_count; // check number of teeth diff --git a/externals/grill/fftease/src/disarray~.cpp b/externals/grill/fftease/src/disarray~.cpp index 7ddc4333..8019fcdc 100644 --- a/externals/grill/fftease/src/disarray~.cpp +++ b/externals/grill/fftease/src/disarray~.cpp @@ -13,29 +13,16 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include class disarray: - public flext_dsp + public fftease { - FLEXT_HEADER_S(disarray,flext_dsp,setup) + FLEXT_HEADER_S(disarray,fftease,setup) public: disarray(I argc,const t_atom *argv); - ~disarray(); protected: - virtual V m_dsp(I n,S *const *in,S *const *out); - virtual V m_signal(I n,S *const *in,S *const *out); - - I blsz; - F smprt; - - F *_input1,*_input2; - F *_buffer1,*_buffer2; - F *_channel1,*_channel2; - F *_output; - F *_trigland; - I *_bitshuffle; - F *_Wanal,*_Wsyn,*_Hwin; + virtual V Transform(I _N2,S *const *in); I _inCount,_nmult; @@ -50,8 +37,9 @@ protected: V reset_shuffle(); private: - V Clear(); - V Delete(); + virtual V Set(); + virtual V Clear(); + virtual V Delete(); V ms_freq(F f); @@ -74,7 +62,7 @@ V disarray::setup(t_classid c) disarray::disarray(I argc,const t_atom *argv): - blsz(0),smprt(0), + fftease(2,false,true,true), _freq(1300),_qual(false),_shuffle_count(20) { /* parse and set object's options given */ @@ -97,62 +85,41 @@ disarray::disarray(I argc,const t_atom *argv): post("%s - Shufflecount must be an integer value - set to %0i",thisName(),_shuffle_count); } - _nmult = _qual?4:2; - - Clear(); + _mult = _qual?4:2; + _window = _qual; AddInSignal("Messages and input signal"); AddOutSignal("Transformed signal"); } -disarray::~disarray() -{ - Delete(); -} V disarray::Clear() { - _input1 = _input2 = NULL; - _buffer1 = _buffer2 = NULL; - _channel1 = _channel2 = NULL; - _output = NULL; - - _bitshuffle = NULL; - _trigland = NULL; - - _Hwin = NULL; - _Wanal = _Wsyn = NULL; - - // ----------------------------- - + fftease::Clear(); _shuffle_in = _shuffle_out = NULL; } V disarray::Delete() { - if(_input1) delete[] _input1; - if(_buffer1) delete[] _buffer1; - if(_channel1) delete[] _channel1; -/* - if(_input2) delete[] _input2; - if(_buffer2) delete[] _buffer2; - if(_channel2) delete[] _channel2; -*/ - if(_output) delete[] _output; + fftease::Delete(); + if(_shuffle_in) delete[] _shuffle_in; + if(_shuffle_out) delete[] _shuffle_out; +} - if(_bitshuffle) delete[] _bitshuffle; - if(_trigland) delete[] _trigland; +V disarray::Set() +{ + fftease::Set(); - if(_Wanal) delete[] _Wanal; - if(_Wsyn) delete[] _Wsyn; - if(_Hwin) delete[] _Hwin; + const I _N2 = Blocksize()*Mult()/2; - // ----------------------------- + _shuffle_in = new I[_N2]; + _shuffle_out = new I[_N2]; - if(_shuffle_in) delete[] _shuffle_in; - if(_shuffle_out) delete[] _shuffle_out; -} + // calculate _max_bin + ms_freq(_freq); + reset_shuffle(); +} V disarray::ms_freq(F f) { @@ -168,107 +135,23 @@ V disarray::ms_freq(F f) for(F curfreq = 0; curfreq < f; curfreq += funda) ++_max_bin; } - -V disarray::m_dsp(I n,S *const *,S *const *) -{ - const I _D = n; - const F _R = Samplerate(); - - if(_D != blsz || _R != smprt) { - blsz = _D; - smprt = _R; - - Delete(); - // --------------------------------------------- - - const int _N = _D*_nmult,_Nw = _N,_Nw2 = _Nw>>1,_N2 = _N>>1; - - _inCount = -_Nw; - - _input1 = new F[_Nw]; - _buffer1 = new F[_N]; - _channel1 = new F[_N+2]; - /* - _input2 = new F[_Nw]; - _buffer2 = new F[_N]; - _channel2 = new F[_N+2]; - */ - - _output = new F[_Nw]; - - _bitshuffle = new I[_N*2]; - _trigland = new F[_N*2]; - - _Wanal = new F[_Nw]; - _Wsyn = new F[_Nw]; - _Hwin = new F[_Nw]; - - init_rdft( _N, _bitshuffle, _trigland); - - if(_qual) - makewindows( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0); - else - makehanning( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0,0); - - // --------------------------------------------- - - _shuffle_in = new I[_N2]; - _shuffle_out = new I[_N2]; - - // calculate _max_bin - ms_freq(_freq); - - reset_shuffle(); - } -} - -V disarray::m_signal(I n,S *const *in,S *const *out) +V disarray::Transform(I _N2,S *const *in) { - /* declare working variables */ - I i, j; - const I _D = n,_N = _D*_nmult,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; - - _inCount += _D; - - for ( j = 0 ; j < _N-_D ; j++ ) - _input1[j] = _input1[j+_D]; - for (i = 0; j < _N; j++,i++ ) - _input1[j] = in[0][i]; - - fold( _input1, _Wanal, _Nw, _buffer1, _N, _inCount ); - rdft( _N, 1, _buffer1, _bitshuffle, _trigland ); - - // ---- BEGIN -------------------------------- - leanconvert( _buffer1, _channel1, _N2 ); - for( i = 0; i < _shuffle_count ; i++){ + for(I i = 0; i < _shuffle_count ; i++){ F tmp = _channel1[ _shuffle_in[ i ] * 2 ]; _channel1[ _shuffle_in[ i ] * 2] = _channel1[ _shuffle_out[ i ] * 2]; _channel1[ _shuffle_out[ i ] * 2] = tmp; } leanunconvert( _channel1, _buffer1, _N2 ); - - // ---- END -------------------------------- - - rdft( _N, -1, _buffer1, _bitshuffle, _trigland ); - overlapadd( _buffer1, _N, _Wsyn, _output, _Nw, _inCount); - - const F mult = 1./_N; - for ( j = 0; j < _D; j++ ) - out[0][j] = _output[j] * mult; - - for ( j = 0; j < _N-_D; j++ ) - _output[j] = _output[j+_D]; - for (; j < _N; j++ ) - _output[j] = 0.; } V disarray::reset_shuffle() { - const I _N2 = Blocksize()*_nmult/2; + const I _N2 = Blocksize()*Mult()/2; I i; for( i = 0; i < _N2; i++ ) diff --git a/externals/grill/fftease/src/drown~.cpp b/externals/grill/fftease/src/drown~.cpp index 7db3f4f0..336f9c8e 100644 --- a/externals/grill/fftease/src/drown~.cpp +++ b/externals/grill/fftease/src/drown~.cpp @@ -13,146 +13,30 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include class drown: - public flext_dsp + public fftease { - FLEXT_HEADER_S(drown,flext_dsp,setup) + FLEXT_HEADER(drown,fftease) public: drown(I argc,const t_atom *argv); - ~drown(); protected: - virtual V m_dsp(I n,S *const *in,S *const *out); - virtual V m_signal(I n,S *const *in,S *const *out); - - I blsz; - F smprt; - - F *_input1,*_input2; - F *_buffer1,*_buffer2; - F *_channel1,*_channel2; - F *_output; -// F *_trigland; - // I *_bitshuffle; - F *_Wanal,*_Wsyn,*_Hwin; - - I _inCount,_nmult; - - // ----------------------------- - -private: - V Clear(); - V Delete(); - - static V setup(t_classid c); + virtual V Transform(I n,S *const *in); }; FLEXT_LIB_DSP_V("fftease, drown~",drown) -V drown::setup(t_classid c) -{ -} - - drown::drown(I argc,const t_atom *argv): - blsz(0),smprt(0),_nmult(4) + fftease(4,false,true,false) { - Clear(); - AddInSignal("Messages and input signal"); AddInSignal("Threshold generator signal"); AddInSignal("Multiplier signal for weak bins"); AddOutSignal("Transformed signal"); } -drown::~drown() -{ - Delete(); -} - -V drown::Clear() -{ - _input1 = _input2 = NULL; - _buffer1 = _buffer2 = NULL; - _channel1 = _channel2 = NULL; - _output = NULL; -/* - _bitshuffle = NULL; - _trigland = NULL; -*/ - _Hwin = NULL; - _Wanal = _Wsyn = NULL; - - // ----------------------------- - -} - -V drown::Delete() -{ - if(_input1) delete[] _input1; - if(_buffer1) delete[] _buffer1; - if(_channel1) delete[] _channel1; -/* - if(_input2) delete[] _input2; - if(_buffer2) delete[] _buffer2; - if(_channel2) delete[] _channel2; -*/ - if(_output) delete[] _output; -/* - if(_bitshuffle) delete[] _bitshuffle; - if(_trigland) delete[] _trigland; -*/ - if(_Wanal) delete[] _Wanal; - if(_Wsyn) delete[] _Wsyn; - if(_Hwin) delete[] _Hwin; - - // ----------------------------- - -} - - -V drown::m_dsp(I n,S *const *,S *const *) -{ - const I _D = n; - const F _R = Samplerate(); - - if(_D != blsz || _R != smprt) { - blsz = _D; - smprt = _R; - - Delete(); - // --------------------------------------------- - - const int _N = _D*_nmult,_Nw = _N,_Nw2 = _Nw>>1,_N2 = _N>>1; - - _inCount = -_Nw; - - _input1 = new F[_Nw]; - _buffer1 = new F[_N]; - _channel1 = new F[_N+2]; - /* - _input2 = new F[_Nw]; - _buffer2 = new F[_N]; - _channel2 = new F[_N+2]; - */ - - _output = new F[_Nw]; - - /* - _bitshuffle = new I[_N*2]; - _trigland = new F[_N*2]; - init_rdft( _N, _bitshuffle, _trigland); - */ - - _Wanal = new F[_Nw]; - _Wsyn = new F[_Nw]; - _Hwin = new F[_Nw]; - makewindows( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0); - } -} - /* helper function */ static void nudist( float *_S, float *_C, float threshold, float fmult, int N2 ) @@ -180,48 +64,12 @@ static void nudist( float *_S, float *_C, float threshold, float fmult, int N2 ) } -V drown::m_signal(I n,S *const *in,S *const *out) +V drown::Transform(I _N2,S *const *in) { - /* declare working variables */ - I i, j; - const I _D = n,_N = _D*_nmult,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; - - _inCount += _D; - - for ( j = 0 ; j < _N-_D ; j++ ) - _input1[j] = _input1[j+_D]; - for (i = 0; j < _N; j++,i++ ) - _input1[j] = in[0][i]; - - fold( _input1, _Wanal, _Nw, _buffer1, _N, _inCount ); - -// rdft( _N, 1, _buffer1, _bitshuffle, _trigland ); - rfft( _buffer1, _N2, 1); - - // ---- BEGIN -------------------------------- - - { - // only first value of the signal vectors - const F thresh = in[1][0],mult = in[2][0]; - - nudist( _buffer1, _channel1, thresh, mult, _N2 ); - } - - // ---- END -------------------------------- - - rfft( _buffer1, _N2, 0); -// rdft( _N, -1, _buffer1, _bitshuffle, _trigland ); - - overlapadd( _buffer1, _N, _Wsyn, _output, _Nw, _inCount); - - const F mult = 1./_N; - for ( j = 0; j < _D; j++ ) - out[0][j] = _output[j] * mult; + // only first value of the signal vectors + const F thresh = in[1][0],mult = in[2][0]; - for ( j = 0; j < _N-_D; j++ ) - _output[j] = _output[j+_D]; - for (; j < _N; j++ ) - _output[j] = 0.; + nudist( _buffer1, _channel1, thresh, mult, _N2 ); } diff --git a/externals/grill/fftease/src/ether~.cpp b/externals/grill/fftease/src/ether~.cpp index 12a0d359..e04efaec 100644 --- a/externals/grill/fftease/src/ether~.cpp +++ b/externals/grill/fftease/src/ether~.cpp @@ -13,41 +13,21 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include class ether: - public flext_dsp + public fftease { - FLEXT_HEADER_S(ether,flext_dsp,setup) + FLEXT_HEADER_S(ether,fftease,setup) public: ether(I argc,const t_atom *argv); - ~ether(); protected: - virtual V m_dsp(I n,S *const *in,S *const *out); - virtual V m_signal(I n,S *const *in,S *const *out); - - I blsz; - F smprt; - - F *_input1,*_input2; - F *_buffer1,*_buffer2; - F *_channel1,*_channel2; - F *_output; - F *_trigland; - I *_bitshuffle; - F *_Wanal,*_Wsyn,*_Hwin; - - I _inCount,_nmult; - - // ----------------------------- + virtual V Transform(I n,S *const *in); BL _qual,_invert; F _threshMult; private: - V Clear(); - V Delete(); - static V setup(t_classid c); @@ -66,7 +46,7 @@ V ether::setup(t_classid c) ether::ether(I argc,const t_atom *argv): - blsz(0),smprt(0), + fftease(2,true,true,true), _qual(false),_threshMult(0),_invert(false) { /* parse and set object's options given */ @@ -77,131 +57,21 @@ ether::ether(I argc,const t_atom *argv): post("%s - Quality must be a boolean value - set to %0i",thisName(),_qual?1:0); } - _nmult = _qual?4:2; - - Clear(); + _mult = _qual?4:2; + _window = _qual; AddInSignal("Messages and input signal"); AddInSignal("Reference signal"); AddOutSignal("Transformed signal"); } -ether::~ether() -{ - Delete(); -} - -V ether::Clear() -{ - _input1 = _input2 = NULL; - _buffer1 = _buffer2 = NULL; - _channel1 = _channel2 = NULL; - _output = NULL; - - _bitshuffle = NULL; - _trigland = NULL; - - _Hwin = NULL; - _Wanal = _Wsyn = NULL; - - // ----------------------------- -} - -V ether::Delete() -{ - if(_input1) delete[] _input1; - if(_buffer1) delete[] _buffer1; - if(_channel1) delete[] _channel1; - - if(_input2) delete[] _input2; - if(_buffer2) delete[] _buffer2; - if(_channel2) delete[] _channel2; - - if(_output) delete[] _output; - - if(_bitshuffle) delete[] _bitshuffle; - if(_trigland) delete[] _trigland; - - if(_Wanal) delete[] _Wanal; - if(_Wsyn) delete[] _Wsyn; - if(_Hwin) delete[] _Hwin; - - // ----------------------------- - -} - - -V ether::m_dsp(I n,S *const *,S *const *) -{ - const I _D = n; - const F _R = Samplerate(); - - if(_D != blsz || _R != smprt) { - blsz = _D; - smprt = _R; - - Delete(); - // --------------------------------------------- - - const int _N = _D*_nmult,_Nw = _N,_Nw2 = _Nw>>1,_N2 = _N>>1; - - _inCount = -_Nw; - - _input1 = new F[_Nw]; - _buffer1 = new F[_N]; - _channel1 = new F[_N+2]; - - _input2 = new F[_Nw]; - _buffer2 = new F[_N]; - _channel2 = new F[_N+2]; - - _output = new F[_Nw]; - - _bitshuffle = new I[_N*2]; - _trigland = new F[_N*2]; - - _Wanal = new F[_Nw]; - _Wsyn = new F[_Nw]; - _Hwin = new F[_Nw]; - - init_rdft( _N, _bitshuffle, _trigland); - - if(_qual) - makewindows( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0); - else - makehanning( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0,0); - } -} -V ether::m_signal(I n,S *const *in,S *const *out) +V ether::Transform(I _N2,S *const *in) { - /* declare working variables */ - I i, j; - const I _D = n,_N = _D*_nmult,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; - - _inCount += _D; - - for ( j = 0 ; j < _N-_D ; j++ ) { - _input1[j] = _input1[j+_D]; - _input2[j] = _input2[j+_D]; - } - for (i = 0; j < _N; j++,i++ ) { - _input1[j] = in[0][i]; - _input2[j] = in[1][i]; - } - - fold( _input1, _Wanal, _Nw, _buffer1, _N, _inCount ); - fold( _input2, _Wanal, _Nw, _buffer2, _N, _inCount ); - - rdft( _N, 1, _buffer1, _bitshuffle, _trigland ); - rdft( _N, 1, _buffer2, _bitshuffle, _trigland ); - - // ---- BEGIN -------------------------------- - F threshMult = _threshMult; if (threshMult == 0. ) threshMult = 1; - for ( i = 0; i <= _N2; i++ ) { + for (I i = 0; i <= _N2; i++ ) { int even = i<<1,odd = even + 1; /* convert to polar coordinates from complex values */ @@ -233,19 +103,5 @@ V ether::m_signal(I n,S *const *in,S *const *out) if (i != _N2 ) _buffer1[odd] = -_channel1[even] * sin( _channel1[odd] ); } - - // ---- END -------------------------------- - - rdft( _N, -1, _buffer1, _bitshuffle, _trigland ); - overlapadd( _buffer1, _N, _Wsyn, _output, _Nw, _inCount); - - const F mult = 1./_N; - for ( j = 0; j < _D; j++ ) - out[0][j] = _output[j] * mult; - - for ( j = 0; j < _N-_D; j++ ) - _output[j] = _output[j+_D]; - for (; j < _N; j++ ) - _output[j] = 0.; } diff --git a/externals/grill/fftease/src/fftease.cpp b/externals/grill/fftease/src/fftease.cpp new file mode 100644 index 00000000..9e59faa1 --- /dev/null +++ b/externals/grill/fftease/src/fftease.cpp @@ -0,0 +1,185 @@ +/* + +FFTease - A set of Live Spectral Processors +Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform + +Copyright (c)Thomas Grill (xovo@gmx.net) +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "license.txt," in this distribution. + +*/ + +#include "main.h" + + +fftease::fftease(I mult,BL stereo,BL window,BL bitshuf): + _mult(mult),_stereo(stereo),_window(window),_bitshuf(bitshuf), + _inCount(0), + blsz(0),smprt(0) +{} + +fftease::~fftease() {} + +BL fftease::Init() +{ + BL ret = flext_dsp::Init(); + Clear(); + return ret; +} + +V fftease::Exit() +{ + Delete(); +} + +V fftease::m_dsp(I n,S *const *in,S *const *out) +{ + const I _D = n; + const F sr = Samplerate(); + if(_D != blsz || sr != smprt) { + blsz = _D; + smprt = sr; + + Delete(); + Set(); + } +} + +V fftease::m_signal(I n,S *const *in,S *const *out) +{ + /* declare working variables */ + I i; + const I _D = n,_N = _D*Mult(),_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; + + /* fill our retaining buffers */ + _inCount += _D; + + if(_stereo) { + for(i = 0; i < _N-_D ; i++ ) { + _input1[i] = _input1[i+_D]; + _input2[i] = _input2[i+_D]; + } + for(I j = 0; i < _N; i++,j++) { + _input1[i] = in[0][j]; + _input2[i] = in[1][j]; + } + } + else { + for (i = 0 ; i < _N-_D ; i++ ) + _input1[i] = _input1[i+_D]; + for (I j = 0; i < _N; i++,j++ ) + _input1[i] = in[0][j]; + } + + /* apply hamming window and fold our window buffer into the fft buffer */ + fold( _input1, _Wanal, _Nw, _buffer1, _N, _inCount ); + if(_stereo) fold( _input2, _Wanal, _Nw, _buffer2, _N, _inCount ); + + /* do an fft */ + if(_bitshuf) { + rdft( _N, 1, _buffer1, _bitshuffle, _trigland ); + if(_stereo) rdft( _N, 1, _buffer2, _bitshuffle, _trigland ); + } + else { + rfft( _buffer1, _N2, 1); + if(_stereo) rfft( _buffer2, _N2,1); + } + + + // ---- BEGIN -------------------------------- + + Transform(_N2,in+(_stereo?1:2)); + + // ---- END -------------------------------- + + + /* do an inverse fft */ + if(_bitshuf) + rdft( _N, -1, _buffer1, _bitshuffle, _trigland ); + else + rfft( _buffer1, _N2, 0); + + /* dewindow our result */ + overlapadd( _buffer1, _N, _Wsyn, _output, _Nw, _inCount); + + /* set our output and adjust our retaining output buffer */ + const F mult = 1./_N; + for ( i = 0; i < _D; i++ ) + out[0][i] = _output[i] * mult; + + for ( i = 0; i < _N-_D; i++ ) + _output[i] = _output[i+_D]; + for (; i < _N; i++ ) + _output[i] = 0.; +} + + +void fftease::Set() +{ + /* preset the objects data */ + const I _D = Blocksize(),_N = _D*Mult(),_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; + + _inCount = -_Nw; + + /* assign memory to the buffers */ + _input1 = new F[_Nw]; + _buffer1 = new F[_N]; + _channel1 = new F[_N+2]; + if(_stereo) { + _input2 = new F[_Nw]; + _buffer2 = new F[_N]; + _channel2 = new F[_N+2]; + } + _output = new F[_Nw]; + + if(_bitshuf) { + _bitshuffle = new I[_N*2]; + _trigland = new F[_N*2]; + init_rdft( _N, _bitshuffle, _trigland); + } + + _Hwin = new F[_Nw]; + _Wanal = new F[_Nw]; + _Wsyn = new F[_Nw]; + if(_window) + makewindows( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0); + else + makehanning( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0,0); +} + +void fftease::Clear() +{ + _bitshuffle = NULL; + _trigland = NULL; + _input1 = _input2 = NULL; + _Hwin = NULL; + _Wanal = _Wsyn = NULL; + _buffer1 = _buffer2 = NULL; + _channel1 = _channel2 = NULL; + _output = NULL; +} + +void fftease::Delete() +{ + if(_input1) delete[] _input1; + if(_buffer1) delete[] _buffer1; + if(_channel1) delete[] _channel1; + if(_stereo) { + if(_input2) delete[] _input2; + if(_buffer2) delete[] _buffer2; + if(_channel2) delete[] _channel2; + } + if(_output) delete[] _output; + + if(_bitshuf) { + if(_bitshuffle) delete[] _bitshuffle; + if(_trigland) delete[] _trigland; + } + + if(_Hwin) delete[] _Hwin; + if(_Wanal) delete[] _Wanal; + if(_Wsyn) delete[] _Wsyn; +} + + + diff --git a/externals/grill/fftease/src/main.h b/externals/grill/fftease/src/main.h index 6dbddf7e..d9746c71 100644 --- a/externals/grill/fftease/src/main.h +++ b/externals/grill/fftease/src/main.h @@ -37,4 +37,51 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define S t_sample + +class fftease: + public flext_dsp +{ + FLEXT_HEADER_S(fftease,flext_dsp,setup) + +public: + fftease(I mult,BL stereo,BL window,BL bitshuf); + virtual ~fftease(); + +protected: + + virtual BL Init(); + virtual V Exit(); + + virtual V m_dsp(I n,S *const *in,S *const *out); + virtual V m_signal(I n,S *const *in,S *const *out); + + virtual V Set(); + virtual V Clear(); + virtual V Delete(); + virtual V Transform(I _N2,S *const *in) = 0; + + I Mult() const { return _mult; } + + F *_input1,*_input2; + F *_buffer1,*_buffer2; + F *_channel1,*_channel2; + F *_output; + F *_trigland; + I *_bitshuffle; + F *_Wanal,*_Wsyn,*_Hwin; + + I _inCount; + + I _mult; + BL _stereo,_window,_bitshuf; + +private: + I blsz; + F smprt; + + static V setup(t_classid c) {} + +}; + + #endif diff --git a/externals/grill/flext/flext.cw b/externals/grill/flext/flext.cw index 982353fe..302b54b4 100644 Binary files a/externals/grill/flext/flext.cw and b/externals/grill/flext/flext.cw differ diff --git a/externals/grill/flext/flext.pbproj/project.pbxproj b/externals/grill/flext/flext.pbproj/project.pbxproj index 2f232c50..e4243f9f 100755 --- a/externals/grill/flext/flext.pbproj/project.pbxproj +++ b/externals/grill/flext/flext.pbproj/project.pbxproj @@ -13,6 +13,8 @@ F55CEE4C0383F59B01A80AC9, F5AAF632038683E801A80AC9, F59A5FAD0386DF3201A80AC9, + F5C2051103D403B401A80AC9, + F5C2062403D470B401A80AC9, ); isa = PBXGroup; name = Products; @@ -45,6 +47,8 @@ F55CEE300383F59B01A80AC9, F5AAF616038683E801A80AC9, F59A5F910386DF3201A80AC9, + F5C204ED03D403B401A80AC9, + F5C2060003D470B401A80AC9, ); }; 0867D691FE84028FC02AAC07 = { @@ -1633,7 +1637,7 @@ F55CEE560383F9A301A80AC9, ); isa = PBXAggregateTarget; - name = "PD@OSX"; + name = "all PD@OSX"; productName = "PD@OSX"; shouldUseHeadermap = 0; }; @@ -2121,6 +2125,570 @@ path = flext.max.a; refType = 3; }; + F5C204ED03D403B401A80AC9 = { + buildPhases = ( + F5C204EE03D403B401A80AC9, + F5C204FA03D403B401A80AC9, + F5C2050F03D403B401A80AC9, + F5C2051003D403B401A80AC9, + ); + buildSettings = { + DEBUGGING_SYMBOLS = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + HEADER_SEARCH_PATHS = "\"$(SYSTEM_APPS_DIR)/audio/jMax/include\""; + LIBRARY_STYLE = STATIC; + OPTIMIZATION_CFLAGS = "-O3"; + OTHER_CFLAGS = "-D FLEXT_SYS_JMAX -fno-exceptions -Wno-switch"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOL_FLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = flext.a; + REZ_EXECUTABLE = YES; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; + }; + comments = "flext for PD running on OS X (darwin)\nmulti-threaded performance version"; + dependencies = ( + ); + isa = PBXLibraryTarget; + name = "jMax@OSX single"; + productName = "PD@OSX"; + productReference = F5C2051103D403B401A80AC9; + shouldUseHeadermap = 0; + }; + F5C204EE03D403B401A80AC9 = { + buildActionMask = 2147483647; + files = ( + F5C204EF03D403B401A80AC9, + F5C204F003D403B401A80AC9, + F5C204F103D403B401A80AC9, + F5C204F203D403B401A80AC9, + F5C204F303D403B401A80AC9, + F5C204F403D403B401A80AC9, + F5C204F503D403B401A80AC9, + F5C204F603D403B401A80AC9, + F5C204F703D403B401A80AC9, + F5C204F803D403B401A80AC9, + F5C204F903D403B401A80AC9, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + F5C204EF03D403B401A80AC9 = { + fileRef = F55CED7F0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204F003D403B401A80AC9 = { + fileRef = F55CED810383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204F103D403B401A80AC9 = { + fileRef = F55CED860383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204F203D403B401A80AC9 = { + fileRef = F55CED870383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204F303D403B401A80AC9 = { + fileRef = F55CED890383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204F403D403B401A80AC9 = { + fileRef = F55CED8B0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204F503D403B401A80AC9 = { + fileRef = F55CED8C0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204F603D403B401A80AC9 = { + fileRef = F55CED8E0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204F703D403B401A80AC9 = { + fileRef = F55CED920383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204F803D403B401A80AC9 = { + fileRef = F55CED940383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204F903D403B401A80AC9 = { + fileRef = F504A67003CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204FA03D403B401A80AC9 = { + buildActionMask = 2147483647; + files = ( + F5C204FB03D403B401A80AC9, + F5C204FC03D403B401A80AC9, + F5C204FD03D403B401A80AC9, + F5C204FE03D403B401A80AC9, + F5C204FF03D403B401A80AC9, + F5C2050003D403B401A80AC9, + F5C2050103D403B401A80AC9, + F5C2050203D403B401A80AC9, + F5C2050303D403B401A80AC9, + F5C2050403D403B401A80AC9, + F5C2050503D403B401A80AC9, + F5C2050603D403B401A80AC9, + F5C2050703D403B401A80AC9, + F5C2050803D403B401A80AC9, + F5C2050903D403B401A80AC9, + F5C2050A03D403B401A80AC9, + F5C2050B03D403B401A80AC9, + F5C2050C03D403B401A80AC9, + F5C2050D03D403B401A80AC9, + F5C2050E03D403B401A80AC9, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + F5C204FB03D403B401A80AC9 = { + fileRef = F55CED7B0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204FC03D403B401A80AC9 = { + fileRef = F55CED7C0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204FD03D403B401A80AC9 = { + fileRef = F55CED7D0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204FE03D403B401A80AC9 = { + fileRef = F55CED7E0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C204FF03D403B401A80AC9 = { + fileRef = F55CED800383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050003D403B401A80AC9 = { + fileRef = F55CED880383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050103D403B401A80AC9 = { + fileRef = F55CED8A0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050203D403B401A80AC9 = { + fileRef = F55CED8D0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050303D403B401A80AC9 = { + fileRef = F55CED8F0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050403D403B401A80AC9 = { + fileRef = F55CED930383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050503D403B401A80AC9 = { + fileRef = F55CED950383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050603D403B401A80AC9 = { + fileRef = F55CED960383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050703D403B401A80AC9 = { + fileRef = F55CED970383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050803D403B401A80AC9 = { + fileRef = F504A66B03CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050903D403B401A80AC9 = { + fileRef = F504A66C03CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050A03D403B401A80AC9 = { + fileRef = F504A66D03CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050B03D403B401A80AC9 = { + fileRef = F504A66E03CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050C03D403B401A80AC9 = { + fileRef = F504A66F03CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050D03D403B401A80AC9 = { + fileRef = F504A67103CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050E03D403B401A80AC9 = { + fileRef = F504A67203CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2050F03D403B401A80AC9 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + F5C2051003D403B401A80AC9 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXRezBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + F5C2051103D403B401A80AC9 = { + isa = PBXLibraryReference; + path = flext.a; + refType = 3; + }; + F5C2060003D470B401A80AC9 = { + buildPhases = ( + F5C2060103D470B401A80AC9, + F5C2060D03D470B401A80AC9, + F5C2062203D470B401A80AC9, + F5C2062303D470B401A80AC9, + ); + buildSettings = { + DEBUGGING_SYMBOLS = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + HEADER_SEARCH_PATHS = "\"$(SYSTEM_APPS_DIR)/audio/jMax/include\""; + LIBRARY_STYLE = STATIC; + OPTIMIZATION_CFLAGS = "-O3"; + OTHER_CFLAGS = "-D FLEXT_SYS_JMAX -D FLEXT_THREADS -fno-exceptions -Wno-switch"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOL_FLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = flext_t.a; + REZ_EXECUTABLE = YES; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; + }; + comments = "flext for PD running on OS X (darwin)\nmulti-threaded performance version"; + dependencies = ( + ); + isa = PBXLibraryTarget; + name = "jMax@OSX threaded"; + productName = "PD@OSX"; + productReference = F5C2062403D470B401A80AC9; + shouldUseHeadermap = 0; + }; + F5C2060103D470B401A80AC9 = { + buildActionMask = 2147483647; + files = ( + F5C2060203D470B401A80AC9, + F5C2060303D470B401A80AC9, + F5C2060403D470B401A80AC9, + F5C2060503D470B401A80AC9, + F5C2060603D470B401A80AC9, + F5C2060703D470B401A80AC9, + F5C2060803D470B401A80AC9, + F5C2060903D470B401A80AC9, + F5C2060A03D470B401A80AC9, + F5C2060B03D470B401A80AC9, + F5C2060C03D470B401A80AC9, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + F5C2060203D470B401A80AC9 = { + fileRef = F55CED7F0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2060303D470B401A80AC9 = { + fileRef = F55CED810383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2060403D470B401A80AC9 = { + fileRef = F55CED860383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2060503D470B401A80AC9 = { + fileRef = F55CED870383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2060603D470B401A80AC9 = { + fileRef = F55CED890383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2060703D470B401A80AC9 = { + fileRef = F55CED8B0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2060803D470B401A80AC9 = { + fileRef = F55CED8C0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2060903D470B401A80AC9 = { + fileRef = F55CED8E0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2060A03D470B401A80AC9 = { + fileRef = F55CED920383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2060B03D470B401A80AC9 = { + fileRef = F55CED940383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2060C03D470B401A80AC9 = { + fileRef = F504A67003CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2060D03D470B401A80AC9 = { + buildActionMask = 2147483647; + files = ( + F5C2060E03D470B401A80AC9, + F5C2060F03D470B401A80AC9, + F5C2061003D470B401A80AC9, + F5C2061103D470B401A80AC9, + F5C2061203D470B401A80AC9, + F5C2061303D470B401A80AC9, + F5C2061403D470B401A80AC9, + F5C2061503D470B401A80AC9, + F5C2061603D470B401A80AC9, + F5C2061703D470B401A80AC9, + F5C2061803D470B401A80AC9, + F5C2061903D470B401A80AC9, + F5C2061A03D470B401A80AC9, + F5C2061B03D470B401A80AC9, + F5C2061C03D470B401A80AC9, + F5C2061D03D470B401A80AC9, + F5C2061E03D470B401A80AC9, + F5C2061F03D470B401A80AC9, + F5C2062003D470B401A80AC9, + F5C2062103D470B401A80AC9, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + F5C2060E03D470B401A80AC9 = { + fileRef = F55CED7B0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2060F03D470B401A80AC9 = { + fileRef = F55CED7C0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061003D470B401A80AC9 = { + fileRef = F55CED7D0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061103D470B401A80AC9 = { + fileRef = F55CED7E0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061203D470B401A80AC9 = { + fileRef = F55CED800383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061303D470B401A80AC9 = { + fileRef = F55CED880383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061403D470B401A80AC9 = { + fileRef = F55CED8A0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061503D470B401A80AC9 = { + fileRef = F55CED8D0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061603D470B401A80AC9 = { + fileRef = F55CED8F0383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061703D470B401A80AC9 = { + fileRef = F55CED930383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061803D470B401A80AC9 = { + fileRef = F55CED950383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061903D470B401A80AC9 = { + fileRef = F55CED960383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061A03D470B401A80AC9 = { + fileRef = F55CED970383E50201A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061B03D470B401A80AC9 = { + fileRef = F504A66B03CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061C03D470B401A80AC9 = { + fileRef = F504A66C03CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061D03D470B401A80AC9 = { + fileRef = F504A66D03CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061E03D470B401A80AC9 = { + fileRef = F504A66E03CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2061F03D470B401A80AC9 = { + fileRef = F504A66F03CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2062003D470B401A80AC9 = { + fileRef = F504A67103CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2062103D470B401A80AC9 = { + fileRef = F504A67203CE39F501A80AC9; + isa = PBXBuildFile; + settings = { + }; + }; + F5C2062203D470B401A80AC9 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + F5C2062303D470B401A80AC9 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXRezBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + F5C2062403D470B401A80AC9 = { + isa = PBXLibraryReference; + path = flext_t.a; + refType = 3; + }; }; rootObject = 0867D690FE84028FC02AAC07; } diff --git a/externals/grill/flext/readme.txt b/externals/grill/flext/readme.txt index 587bc57b..c6526610 100644 --- a/externals/grill/flext/readme.txt +++ b/externals/grill/flext/readme.txt @@ -107,6 +107,7 @@ see flext.h, fldefs.h and flclass.h for the documented base definitions and clas Version history: 0.4.2: +- port for jMax - moved CLASS_MAINSIGNALIN to class scope (fixed "float method overwritten" warning) - unix makefiles: CXX should be commented out if standard (to enable environmental settings) - introduced default returns for the different flext::GetA* functions diff --git a/externals/grill/flext/source/flatom.cpp b/externals/grill/flext/source/flatom.cpp index 9f905d7b..0e7eb544 100644 --- a/externals/grill/flext/source/flatom.cpp +++ b/externals/grill/flext/source/flatom.cpp @@ -53,10 +53,12 @@ flext::AtomList &flext::AtomList::Set(int argc,const t_atom *argv,int offs,bool } - +#if FLEXT_SYS != FLEXT_SYS_JMAX +// not for jmax as long as t_symbol * == char * flext::AtomAnything::AtomAnything(const t_symbol *h,int argc,const t_atom *argv): AtomList(argc,argv),hdr(h?h:MakeSymbol("")) {} +#endif flext::AtomAnything::AtomAnything(const char *h,int argc,const t_atom *argv): AtomList(argc,argv),hdr(MakeSymbol(h)) diff --git a/externals/grill/flext/source/flatom_pr.cpp b/externals/grill/flext/source/flatom_pr.cpp index d6f030b5..7eeada93 100644 --- a/externals/grill/flext/source/flatom_pr.cpp +++ b/externals/grill/flext/source/flatom_pr.cpp @@ -26,35 +26,25 @@ WARRANTIES, see the file, "license.txt," in this distribution. void flext::PrintAtom(const t_atom &a,char *buf) { - switch(a.a_type) { - case A_NULL: - break; - case A_FLOAT: + if(IsFloat(a)) { #if FLEXT_SYS == FLEXT_SYS_PD if(a.a_w.w_float == (int)a.a_w.w_float) STD::sprintf(buf,"%i",(int)GetFloat(a)); else #endif STD::sprintf(buf,"%f",GetFloat(a)); - break; -#if FLEXT_SYS == FLEXT_SYS_MAX - case A_LONG: + } + else if(IsInt(a)) STD::sprintf(buf,"%i",GetInt(a)); - break; -#endif -#if FLEXT_SYS == FLEXT_SYS_PD - case A_POINTER: + else if(IsPointer(a)) STD::sprintf(buf,"%p",GetPointer(a)); - break; -#endif - case A_SYMBOL: + else if(IsSymbol(a)) strcpy(buf,GetString(a)); - break; + else if(IsNothing(a)) {} #ifdef FLEXT_DEBUG - default: + else ERRINTERNAL(); #endif - } } bool flext::ScanAtom(t_atom &a,const char *buf) diff --git a/externals/grill/flext/source/flattr.cpp b/externals/grill/flext/source/flattr.cpp index ffb6b6fd..f55fe0ee 100644 --- a/externals/grill/flext/source/flattr.cpp +++ b/externals/grill/flext/source/flattr.cpp @@ -141,10 +141,10 @@ bool flext_base::InitAttrib(int argc,const t_atom *argv) bool flext_base::ListAttrib() { - if(outattr) { + if(procattr) { AtomList la; int c = ListAttr(la); - ToOutAnything(outattr,MakeSymbol("attributes"),c,la.Atoms()); + ToOutAnything(GetOutAttr(),MakeSymbol("attributes"),c,la.Atoms()); return true; } else @@ -274,7 +274,7 @@ bool flext_base::GetAttrib(attritem *a) default: ERRINTERNAL(); } - ToOutAnything(outattr,a->tag,la.Count(),la.Atoms()); + ToOutAnything(GetOutAttr(),a->tag,la.Count(),la.Atoms()); } else post("%s - attribute %s has no set method",thisName(),GetString(a->tag)); diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h index ea682077..d72466c5 100644 --- a/externals/grill/flext/source/flbase.h +++ b/externals/grill/flext/source/flbase.h @@ -146,20 +146,25 @@ class FLEXT_SHARE flext_obj: const t_symbol *thisNameSym() const { return m_name; } -#if FLEXT_SYS == FLEXT_SYS_PD //! Get the class pointer +#if FLEXT_SYS == FLEXT_SYS_PD t_class *thisClass() const { return (t_class *)((t_object *)(x_obj))->te_g.g_pd; } +#elif FLEXT_SYS == FLEXT_SYS_MAX + t_class *thisClass() const { return (t_class *)(((t_tinyobject *)x_obj)->t_messlist-1); } +#elif FLEXT_SYS == FLEXT_SYS_JMAX + t_class *thisClass() const { return fts_object_get_class((fts_object_t *)thisHdr()); } +#else +#error +#endif +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_JMAX //! Typedef for unique class identifier typedef t_class *t_classid; //! Get unique id for object class t_classid thisClassId() const { return thisClass(); } //! Get class pointer from class id static t_class *getClass(t_classid c) { return c; } -#elif FLEXT_SYS == FLEXT_SYS_MAX - //! Get the class pointer - t_class *thisClass() const { return (t_class *)(((t_tinyobject *)x_obj)->t_messlist-1); } - +#else //! Typedef for unique class identifier typedef void *t_classid; //! Get unique id for object class (for Max/MSP library object share the same (t_class *)!) @@ -239,9 +244,13 @@ class FLEXT_SHARE flext_obj: // Definitions for library objects static void lib_init(const char *name,void setupfun(),bool attr); static void obj_add(bool lib,bool dsp,bool attr,const char *idname,const char *names,void setupfun(t_classid),flext_obj *(*newfun)(int,t_atom *),void (*freefun)(flext_hdr *),int argtp1,...); +#if FLEXT_SYS == FLEXT_SYS_JMAX + static void obj_new(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at); + static void obj_free(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at); +#else static flext_hdr *obj_new(const t_symbol *s,int argc,t_atom *argv); static void obj_free(flext_hdr *o); - +#endif //! @} FLEXT_O_INTERNAL //! @} FLEXT_OBJCLASS @@ -306,10 +315,15 @@ static void __setup__(t_classid classid) \ protected: \ static inline NEW_CLASS *thisObject(void *c) { return FLEXT_CAST(((flext_hdr *)c)->data); } - // generate name of dsp/non-dsp setup function -#define FLEXT_STPF_0(NAME) NAME##_setup -#define FLEXT_STPF_1(NAME) NAME##_tilde_setup +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX + #define FLEXT_STPF_0(NAME) NAME##_setup + #define FLEXT_STPF_1(NAME) NAME##_tilde_setup +#else + #define FLEXT_STPF_0(NAME) NAME##_config + #define FLEXT_STPF_1(NAME) signal_##NAME##_config +#endif + #define FLEXT_STPF_(DSP) FLEXT_STPF_##DSP #define FLEXT_STPF(NAME,DSP) FLEXT_STPF_(DSP)(NAME) @@ -322,13 +336,19 @@ static inline NEW_CLASS *thisObject(void *c) { return FLEXT_CAST((( // these can be used in library setup functions // to register the individual objects in the library -#define REAL_SETUP_0(cl) \ -extern void cl##_setup(); \ -cl##_setup() - -#define REAL_SETUP_1(cl) \ -extern void cl##_tilde_setup(); \ -cl##_tilde_setup() +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX + #define REAL_SETUP_0(cl) \ + extern void cl##_setup(); cl##_setup() + + #define REAL_SETUP_1(cl) \ + extern void cl##_tilde_setup(); cl##_tilde_setup() +#else + #define REAL_SETUP_0(cl) \ + extern void cl##_config(); cl##_config() + + #define REAL_SETUP_1(cl) \ + extern void signal_##cl##_config(); signal_##cl##_config() +#endif #define REAL_SETUP(cl,DSP) REAL_SETUP_##DSP(cl) @@ -338,6 +358,10 @@ cl##_tilde_setup() #define REAL_LIB_SETUP(NAME,SETUPFUN) extern "C" FLEXT_EXT void NAME##_setup() { flext_obj::lib_init(#NAME,SETUPFUN,FLEXT_ATTRIBUTES); } #elif FLEXT_SYS == FLEXT_SYS_MAX #define REAL_LIB_SETUP(NAME,SETUPFUN) extern "C" FLEXT_EXT int main() { flext_obj::lib_init(#NAME,SETUPFUN,FLEXT_ATTRIBUTES); return 0; } +#elif FLEXT_SYS == FLEXT_SYS_JMAX +#define REAL_LIB_SETUP(NAME,SETUPFUN) \ +static void __##NAME##_initfun() { flext_obj::lib_init(#NAME,SETUPFUN,FLEXT_ATTRIBUTES); } \ +fts_module_t __##NAME##_module = {#NAME,#NAME,__##NAME##_initfun,0,0}; #else #error #endif @@ -350,12 +374,12 @@ cl##_tilde_setup() #define FLEXT_EXP_1 #define FLEXT_EXP(LIB) FLEXT_EXP_##LIB -#if FLEXT_SYS == FLEXT_SYS_PD +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_JMAX #define FLEXT_OBJ_SETUP_0(NEW_CLASS,DSP) #elif FLEXT_SYS == FLEXT_SYS_MAX #define FLEXT_OBJ_SETUP_0(NEW_CLASS,DSP) extern "C" FLEXT_EXT int main() { FLEXT_STPF(NEW_CLASS,DSP)(); return 0; } #else -#error +#error not implemented #endif #define FLEXT_OBJ_SETUP_1(NEW_CLASS,DSP) @@ -368,29 +392,49 @@ cl##_tilde_setup() // These definitions are used below // ---------------------------------------- +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX + // maybe that's not necessary + #define FLEXTTPN_NULL A_NULL + #if FLEXT_SYS == FLEXT_SYS_PD + #define FLEXTTPN_PTR A_POINTER + #else + #define FLEXTTPN_INT A_INT + #endif + #define FLEXTTPN_FLOAT A_FLOAT + #define FLEXTTPN_SYM A_SYMBOL + #define FLEXTTPN_VAR A_GIMME +#else + #define FLEXTTPN_NULL 0 + #define FLEXTTPN_PTR 1 + #define FLEXTTPN_INT 2 + #define FLEXTTPN_FLOAT 3 + #define FLEXTTPN_SYM 4 + #define FLEXTTPN_VAR 5 +#endif + // Shortcuts for PD/Max type arguments -#define FLEXTTYPE_void A_NULL +#define FLEXTTYPE_void FLEXTTPN_NULL #define CALLBTYPE_void void -#define FLEXTTYPE_float A_FLOAT +#define FLEXTTYPE_float FLEXTTPN_FLOAT #define CALLBTYPE_float float -#define FLEXTTYPE_t_float A_FLOAT +#define FLEXTTYPE_t_float FLEXTTPN_FLOAT #define CALLBTYPE_t_float t_float #if FLEXT_SYS == FLEXT_SYS_PD -#define FLEXTTYPE_int A_FLOAT +#define FLEXTTYPE_int FLEXTTPN_FLOAT #define CALLBTYPE_int float -#elif FLEXT_SYS == FLEXT_SYS_MAX -#define FLEXTTYPE_int A_INT +#elif FLEXT_SYS == FLEXT_SYS_MAX || FLEXT_SYS == FLEXT_SYS_JMAX +#define FLEXTTYPE_int FLEXTTPN_INT #define CALLBTYPE_int int #else #error #endif -#define FLEXTTYPE_t_symptr A_SYMBOL +#define FLEXTTYPE_t_symptr FLEXTTPN_SYM #define CALLBTYPE_t_symptr t_symptr -#define FLEXTTYPE_t_symtype A_SYMBOL +#define FLEXTTYPE_t_symtype FLEXTTPN_SYM #define CALLBTYPE_t_symtype t_symptr -#define FLEXTTYPE_t_ptrtype A_POINTER +#define FLEXTTYPE_t_ptrtype FLEXTTPN_PTR #define CALLBTYPE_t_ptrtype t_ptrtype #define FLEXTTP(TP) FLEXTTYPE_ ## TP @@ -411,7 +455,7 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ } \ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \ { \ - flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,&NEW_CLASS::__free__,A_NULL); \ + flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,&NEW_CLASS::__free__,FLEXTTPN_NULL); \ } \ FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB) @@ -422,7 +466,7 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ } \ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \ { \ - flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,&NEW_CLASS::__free__,A_GIMME,A_NULL); \ + flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,&NEW_CLASS::__free__,FLEXTTPN_VAR,FLEXTTPN_NULL); \ } \ FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB) @@ -433,7 +477,7 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ } \ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \ { \ - flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),A_NULL); \ + flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTPN_NULL); \ } \ FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB) @@ -444,7 +488,7 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ } \ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \ { \ - flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),A_NULL); \ + flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),FLEXTTPN_NULL); \ } \ FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB) @@ -455,7 +499,7 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ } \ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \ { \ - flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),FLEXTTP(TYPE3),A_NULL); \ + flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),FLEXTTP(TYPE3),FLEXTTPN_NULL); \ } \ FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB) @@ -466,7 +510,7 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ } \ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \ { \ - flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),FLEXTTP(TYPE3),FLEXTTP(TYPE4),A_NULL); \ + flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),FLEXTTP(TYPE3),FLEXTTP(TYPE4),FLEXTTPN_NULL); \ } \ FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB) diff --git a/externals/grill/flext/source/flbuf.cpp b/externals/grill/flext/source/flbuf.cpp index 7a2a21b6..4b4da40a 100644 --- a/externals/grill/flext/source/flbuf.cpp +++ b/externals/grill/flext/source/flbuf.cpp @@ -14,6 +14,8 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "flext.h" +#if FLEXT_SYS != FLEXT_SYS_JMAX + #if FLEXT_SYS == FLEXT_SYS_MAX #include "flmspbuffer.h" // include inofficial buffer.h #endif @@ -58,7 +60,7 @@ int flext::buffer::Set(const t_symbol *s,bool nameonly) chns = 0; } - if(s && *s->s_name) sym = s; + if(s && *GetString(s)) sym = s; if(!sym) { if(valid) ret = -1; @@ -110,7 +112,7 @@ int flext::buffer::Set(const t_symbol *s,bool nameonly) if(valid) ret = -1; } #else -#error +#error not implemented #endif } @@ -152,7 +154,7 @@ bool flext::buffer::Update() return false; } #else -#error +#error not implemented #endif } @@ -263,3 +265,5 @@ void flext::buffer::cb_tick(buffer *b) } #endif + +#endif // Jmax diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index 33c125f0..bfae95c6 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -183,16 +183,22 @@ public: //! Get number of signal outlets int CntOutSig() const { return outsigs; } - class outlet; - //! Retrieve currently processed message tag (NULL if no message processing) const t_symbol *thisTag() const { return curtag; } - //! Get pointer to outlet (not in the constructor!) - outlet *GetOut(int ix) const { return (outlets && ix < outcnt)?outlets[ix]:NULL; } +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX + class outlet; - //! Get pointer to attribute outlet - outlet *GetOutAttr() const { return outattr; } + //! Get pointer to outlet (not in the constructor!) + outlet *GetOut(int ix) const { +#ifdef FLEXT_DEBUG + return (outlets && ix < (procattr?outcnt+1:outcnt))?outlets[ix]:NULL; +#else + return outlets[ix]; +#endif + } +#endif + int GetOutAttr() const { return procattr?CntOut():0; } //! @} FLEXT_C_IO_MISC @@ -203,40 +209,40 @@ public: // output messages //! Output bang (to appointed outlet) - void ToOutBang(outlet *o) const; +// void ToOutBang(outlet *o) const; //! Output bang (index n starts with 0) - void ToOutBang(int n) const { outlet *o = GetOut(n); if(o) ToOutBang(o); } + void ToOutBang(int n) const; // { outlet *o = GetOut(n); if(o) ToOutBang(o); } //! Output float (to appointed outlet) - void ToOutFloat(outlet *o,float f) const; +// void ToOutFloat(outlet *o,float f) const; //! Output float (index n starts with 0) - void ToOutFloat(int n,float f) const { outlet *o = GetOut(n); if(o) ToOutFloat(o,f); } + void ToOutFloat(int n,float f) const; // { outlet *o = GetOut(n); if(o) ToOutFloat(o,f); } //! Output integer (to appointed outlet) - void ToOutInt(outlet *o,int f) const; +// void ToOutInt(outlet *o,int f) const; //! Output integer (index n starts with 0) - void ToOutInt(int n,int f) const { outlet *o = GetOut(n); if(o) ToOutInt(o,f); } + void ToOutInt(int n,int f) const; // { outlet *o = GetOut(n); if(o) ToOutInt(o,f); } //! Output symbol (to appointed outlet) - void ToOutSymbol(outlet *o,const t_symbol *s) const; +// void ToOutSymbol(outlet *o,const t_symbol *s) const; //! Output symbol (index n starts with 0) - void ToOutSymbol(int n,const t_symbol *s) const { outlet *o = GetOut(n); if(o) ToOutSymbol(o,s); } + void ToOutSymbol(int n,const t_symbol *s) const; // { outlet *o = GetOut(n); if(o) ToOutSymbol(o,s); } //! Output string aka symbol (to appointed outlet) - void ToOutString(outlet *o,const char *s) const { ToOutSymbol(o,MakeSymbol(s)); } +// void ToOutString(outlet *o,const char *s) const { ToOutSymbol(o,MakeSymbol(s)); } //! Output string aka symbol (index n starts with 0) - void ToOutString(int n,const char *s) const { outlet *o = GetOut(n); if(o) ToOutString(o,s); } + void ToOutString(int n,const char *s) const { ToOutSymbol(n,MakeSymbol(s)); } //! Output list (to appointed outlet) - void ToOutList(outlet *o,int argc,const t_atom *argv) const; +// void ToOutList(outlet *o,int argc,const t_atom *argv) const; //! Output list (index n starts with 0) - void ToOutList(int n,int argc,const t_atom *argv) const { outlet *o = GetOut(n); if(o) ToOutList(o,argc,argv); } + void ToOutList(int n,int argc,const t_atom *argv) const; // { outlet *o = GetOut(n); if(o) ToOutList(o,argc,argv); } //! Output list (index n starts with 0) void ToOutList(int n,const AtomList &list) const { ToOutList(n,list.Count(),list.Atoms()); } //! Output anything (to appointed outlet) void ToOutAnything(outlet *o,const t_symbol *s,int argc,const t_atom *argv) const; //! Output anything (index n starts with 0) - void ToOutAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { outlet *o = GetOut(n); if(o) ToOutAnything(o,const_cast(s),argc,argv); } + void ToOutAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const; // { outlet *o = GetOut(n); if(o) ToOutAnything(o,const_cast(s),argc,argv); } //! Output anything (index n starts with 0) void ToOutAnything(int n,const AtomAnything &any) const { ToOutAnything(n,any.Header(),any.Count(),any.Atoms()); } @@ -247,44 +253,44 @@ public: */ //! Output bang (to appointed outlet) - void ToQueueBang(outlet *o) const; +// void ToQueueBang(outlet *o) const; //! Output bang (index n starts with 0) - void ToQueueBang(int n) const { outlet *o = GetOut(n); if(o) ToQueueBang(o); } + void ToQueueBang(int n) const; // { outlet *o = GetOut(n); if(o) ToQueueBang(o); } //! Output float (to appointed outlet) - void ToQueueFloat(outlet *o,float f) const; +// void ToQueueFloat(outlet *o,float f) const; //! Output float (index n starts with 0) - void ToQueueFloat(int n,float f) const { outlet *o = GetOut(n); if(o) ToQueueFloat(o,f); } + void ToQueueFloat(int n,float f) const; // { outlet *o = GetOut(n); if(o) ToQueueFloat(o,f); } //! Output integer (to appointed outlet) - void ToQueueInt(outlet *o,int f) const; +// void ToQueueInt(outlet *o,int f) const; //! Output integer (index n starts with 0) - void ToQueueInt(int n,int f) const { outlet *o = GetOut(n); if(o) ToQueueInt(o,f); } + void ToQueueInt(int n,int f) const; // { outlet *o = GetOut(n); if(o) ToQueueInt(o,f); } //! Output symbol (to appointed outlet) - void ToQueueSymbol(outlet *o,const t_symbol *s) const; +// void ToQueueSymbol(outlet *o,const t_symbol *s) const; //! Output symbol (index n starts with 0) - void ToQueueSymbol(int n,const t_symbol *s) const { outlet *o = GetOut(n); if(o) ToQueueSymbol(o,s); } + void ToQueueSymbol(int n,const t_symbol *s) const; // { outlet *o = GetOut(n); if(o) ToQueueSymbol(o,s); } //! Output string aka symbol (to appointed outlet) - void ToQueueString(outlet *o,const char *s) const { ToQueueSymbol(o,MakeSymbol(s)); } +// void ToQueueString(outlet *o,const char *s) const { ToQueueSymbol(o,MakeSymbol(s)); } //! Output string aka symbol (to appointed outlet) - void ToQueueString(int n,const char *s) const { ToQueueSymbol(n,MakeSymbol(s)); } + void ToQueueString(int n,const char *s) const; // { ToQueueSymbol(n,MakeSymbol(s)); } //! Output list (to appointed outlet) - void ToQueueList(outlet *o,int argc,const t_atom *argv) const; +// void ToQueueList(outlet *o,int argc,const t_atom *argv) const; //! Output list (to appointed outlet) - void ToQueueList(outlet *o,const AtomList &list) const { ToQueueList(o,list.Count(),list.Atoms()); } +// void ToQueueList(outlet *o,const AtomList &list) const { ToQueueList(o,list.Count(),list.Atoms()); } //! Output list (index n starts with 0) - void ToQueueList(int n,int argc,const t_atom *argv) const { outlet *o = GetOut(n); if(o) ToQueueList(o,argc,argv); } + void ToQueueList(int n,int argc,const t_atom *argv) const; // { outlet *o = GetOut(n); if(o) ToQueueList(o,argc,argv); } //! Output list (index n starts with 0) void ToQueueList(int n,const AtomList &list) const { ToQueueList(n,list.Count(),list.Atoms()); } //! Output anything (to appointed outlet) - void ToQueueAnything(outlet *o,const t_symbol *s,int argc,const t_atom *argv) const; +// void ToQueueAnything(outlet *o,const t_symbol *s,int argc,const t_atom *argv) const; //! Output anything (to appointed outlet) - void ToQueueAnything(outlet *o,const AtomAnything &any) const { ToQueueAnything(o,any.Header(),any.Count(),any.Atoms()); } +// void ToQueueAnything(outlet *o,const AtomAnything &any) const { ToQueueAnything(o,any.Header(),any.Count(),any.Atoms()); } //! Output anything (index n starts with 0) - void ToQueueAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { outlet *o = GetOut(n); if(o) ToQueueAnything(o,s,argc,argv); } + void ToQueueAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const; // { outlet *o = GetOut(n); if(o) ToQueueAnything(o,s,argc,argv); } //! Output anything (index n starts with 0) void ToQueueAnything(int n,const AtomAnything &any) const { ToQueueAnything(n,any.Header(),any.Count(),any.Atoms()); } @@ -324,7 +330,7 @@ public: void AddMethod(int inlet,bool (*m)(flext_base *,float &,float &,float &)) { AddMethod(ThMeths(),inlet,"list",(methfun)m,a_float,a_float,a_float,a_null); } // list of 3 floats #if FLEXT_SYS == FLEXT_SYS_PD void AddMethod(int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ThMeths(),inlet,"float",(methfun)m,a_int,a_null); } // single float -#elif FLEXT_SYS == FLEXT_SYS_MAX +#elif FLEXT_SYS == FLEXT_SYS_MAX || FLEXT_SYS == FLEXT_SYS_JMAX void AddMethod(int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ThMeths(),inlet,"int",(methfun)m,a_int,a_null); } // single float #else #error @@ -361,9 +367,9 @@ public: static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,float &,float &)) { AddMethod(ClMeths(c),inlet,"list",(methfun)m,a_float,a_float,a_null); } // list of 2 floats static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,float &,float &,float &)) { AddMethod(ClMeths(c),inlet,"list",(methfun)m,a_float,a_float,a_float,a_null); } // list of 3 floats #if FLEXT_SYS == FLEXT_SYS_PD - static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ClMeths(c),inlet,"float",(methfun)m,a_int,a_null); } // single float -#elif FLEXT_SYS == FLEXT_SYS_MAX - static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ClMeths(c),inlet,"int",(methfun)m,a_int,a_null); } // single float + static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ClMeths(c),inlet,"float",(methfun)m,a_int,a_null); } // single integer +#elif FLEXT_SYS == FLEXT_SYS_MAX || FLEXT_SYS == FLEXT_SYS_JMAX + static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ClMeths(c),inlet,"int",(methfun)m,a_int,a_null); } // single integer #else #error #endif @@ -392,16 +398,24 @@ public: bool Bind(const t_symbol *s) { pd_bind(&thisHdr()->ob_pd,const_cast(s)); return true; } //! Unbind object from a symbol bool Unbind(const t_symbol *s) { pd_unbind(&thisHdr()->ob_pd,const_cast(s)); return true; } -#else +#elif FLEXT_SYS == FLEXT_SYS_MAX //! Bind object to a symbol bool Bind(const t_symbol *s) { if(s->s_thing) return false; else { const_cast(s)->s_thing = (t_object *)thisHdr(); return true; } } //! Unbind object from a symbol bool Unbind(const t_symbol *s) { if(s->s_thing != (t_object *)thisHdr()) return false; else { const_cast(s)->s_thing = NULL; return true; } } #endif + +#if FLEXT_SYS == FLEXT_SYS_JMAX + //! Bind object to a symbol (as string) + bool Bind(const char *c); // ** TODO ** + //! Unbind object from a symbol (as string) + bool Unbind(const char *c); // ** TODO ** +#else //! Bind object to a symbol (as string) bool Bind(const char *c) { return Bind(MakeSymbol(c)); } //! Unbind object from a symbol (as string) bool Unbind(const char *c) { return Unbind(MakeSymbol(c)); } +#endif /* // Low level @@ -619,8 +633,10 @@ private: xlet *inlist,*outlist; const t_symbol *curtag; int incnt,outcnt,insigs,outsigs; - outlet **outlets,*outattr; bool distmsgs; +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX + outlet **outlets; +#endif void AddXlet(xlet::type tp,int mult,const char *desc,xlet *&root); void DescXlet(int ix,const char *desc,xlet *&root); @@ -673,8 +689,12 @@ private: class qmsg; qmsg *qhead,*qtail; +#if FLEXT_SYS == FLEXT_SYS_JMAX + static void QTick(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at); +#else t_qelem *qclk; static void QTick(flext_base *th); +#endif void Queue(qmsg *m); #ifdef FLEXT_THREADS ThrMutex qmutex; @@ -711,9 +731,9 @@ private: static void cb_px_in7(t_class *c,int v); static void cb_px_in8(t_class *c,int v); static void cb_px_in9(t_class *c,int v); -#else -#error #endif + +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX static void cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv); static void cb_px_ft1(t_class *c,float f); @@ -727,6 +747,9 @@ private: static void cb_px_ft9(t_class *c,float f); px_object **inlets; +#elif FLEXT_SYS == FLEXT_SYS_JMAX + static void jmax_proxy(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at); +#endif static void SetProxies(t_class *c); @@ -735,9 +758,13 @@ private: // callback functions +#if FLEXT_SYS == FLEXT_SYS_JMAX + static void cb_help(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at); +#else static void cb_help(t_class *c); - static void cb_loadbang(t_class *c); +#endif + #if FLEXT_SYS == FLEXT_SYS_MAX char **indesc,**outdesc; diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp index 7f845074..13eab25d 100644 --- a/externals/grill/flext/source/fldsp.cpp +++ b/externals/grill/flext/source/fldsp.cpp @@ -20,6 +20,10 @@ WARRANTIES, see the file, "license.txt," in this distribution. // === flext_dsp ============================================== +#if FLEXT_SYS == FLEXT_SYS_JMAX +const t_symbol *flext_dsp::dspsym = MakeSymbol("__flext_dspfun__"); +#endif + void flext_dsp::Setup(t_classid id) { t_class *c = getClass(id); @@ -27,27 +31,35 @@ void flext_dsp::Setup(t_classid id) #if FLEXT_SYS == FLEXT_SYS_MAX // dsp_initclass(); dsp_initboxclass(); -#endif - -#if FLEXT_SYS == FLEXT_SYS_PD - CLASS_MAINSIGNALIN(c,flext_hdr,defsig); -#endif - add_dsp(c,cb_dsp); -#if FLEXT_SYS != FLEXT_SYS_MAX +#elif FLEXT_SYS == FLEXT_SYS_PD + CLASS_MAINSIGNALIN(c,flext_hdr,defsig); // float messages going into the left inlet are converted to signal + add_dsp(c,cb_dsp); add_method1(c,cb_enable,"enable",A_FLOAT); +#elif FLEXT_SYS == FLEXT_SYS_JMAX + fts_dsp_declare_function(dspsym,dspmeth); + fts_class_message_varargs(c, fts_s_put, cb_dsp); + fts_class_message_varargs(c, MakeSymbol("enable"), cb_enable); #endif } flext_dsp::flext_dsp(): +#if FLEXT_SYS == FLEXT_SYS_JMAX + srate(fts_dsp_get_sample_rate()), // should we set it? + blksz(fts_dsp_get_tick_size()), +#else srate(sys_getsr()), // should we set it? blksz(sys_getblksize()), +#endif #if FLEXT_SYS == FLEXT_SYS_PD chnsin(sys_get_inchannels()), chnsout(sys_get_outchannels()), #elif FLEXT_SYS == FLEXT_SYS_MAX chnsin(sys_getch()), chnsout(sys_getch()), +#elif FLEXT_SYS == FLEXT_SYS_JMAX + #pragma message("not implemented") + chnsin(0),chnsout(0), #else #error #endif @@ -55,16 +67,27 @@ flext_dsp::flext_dsp(): dspon(true), #endif invecs(NULL),outvecs(NULL) -{} +{ +#if FLEXT_SYS == FLEXT_SYS_JMAX + fts_dsp_object_init(thisHdr()); +#endif +} flext_dsp::~flext_dsp() { +#if FLEXT_SYS == FLEXT_SYS_JMAX + fts_dsp_object_delete(thisHdr()); +#endif if(invecs) delete[] invecs; if(outvecs) delete[] outvecs; } - +#if FLEXT_SYS == FLEXT_SYS_JMAX +void flext_dsp::dspmeth(fts_word_t *w) +{ +} +#else t_int *flext_dsp::dspmeth(t_int *w) { flext_dsp *obj = (flext_dsp *)w[1]; @@ -76,30 +99,35 @@ t_int *flext_dsp::dspmeth(t_int *w) obj->m_signal((int)w[2],obj->invecs,obj->outvecs); return w+3; } +#endif -void flext_dsp::m_dsp(int /*n*/,t_sample *const * /*insigs*/,t_sample *const * /*outsigs*/) {} - -void flext_dsp::m_signal(int n,t_sample *const * /*insigs*/,t_sample *const *outs) -{ - for(int i = 0; i < CntOutSig(); ++i) - memset(outs[i],0,n*sizeof(*outs[i])); -} - +#if FLEXT_SYS == FLEXT_SYS_JMAX +void flext_dsp::cb_dsp(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at) +#else void flext_dsp::cb_dsp(t_class *c,t_signal **sp) +#endif { flext_dsp *obj = thisObject(c); if(obj->CntInSig()+obj->CntOutSig() == 0) return; // store current dsp parameters +#if FLEXT_SYS == FLEXT_SYS_JMAX + fts_dsp_descr_t *dsp = (fts_dsp_descr_t *)fts_get_pointer(at+0); + obj->srate = fts_dsp_get_input_srate(dsp,0); + obj->blksz = fts_dsp_get_input_size(dsp,0); // is this guaranteed to be the same as sys_getblksize() ? +#else obj->srate = sp[0]->s_sr; obj->blksz = sp[0]->s_n; // is this guaranteed to be the same as sys_getblksize() ? +#endif #if FLEXT_SYS == FLEXT_SYS_PD obj->chnsin = sys_get_inchannels(); obj->chnsout = sys_get_outchannels(); #elif FLEXT_SYS == FLEXT_SYS_MAX obj->chnsin = obj->chnsout = sys_getch(); +#elif FLEXT_SYS == FLEXT_SYS_JMAX + #pragma message ("How to query the channels?") #else #error #endif @@ -107,22 +135,70 @@ void flext_dsp::cb_dsp(t_class *c,t_signal **sp) // store in and out signal vectors int i,in = obj->CntInSig(),out = obj->CntOutSig(); if(obj->invecs) delete[] obj->invecs; - obj->invecs = new t_sample *[in]; - for(i = 0; i < in; ++i) obj->invecs[i] = sp[i]->s_vec; + obj->invecs = new t_signalvec[in]; + for(i = 0; i < in; ++i) + obj->invecs[i] = +#if FLEXT_SYS == FLEXT_SYS_JMAX + fts_dsp_get_input_name(dsp,i); +#else + sp[i]->s_vec; +#endif if(obj->outvecs) delete[] obj->outvecs; - obj->outvecs = new t_sample *[out]; - for(i = 0; i < out; ++i) obj->outvecs[i] = sp[in+i]->s_vec; + obj->outvecs = new t_signalvec[out]; + for(i = 0; i < out; ++i) + obj->outvecs[i] = +#if FLEXT_SYS == FLEXT_SYS_JMAX + fts_dsp_get_output_name(dsp,i); +#else + sp[in+i]->s_vec; +#endif // with the following call derived classes can do their eventual DSP setup - obj->m_dsp(sp[0]->s_n,obj->invecs,obj->outvecs); + obj->m_dsp(obj->blksz,obj->invecs,obj->outvecs); // set the DSP function - dsp_add((t_dspmethod)dspmeth,2,obj,sp[0]->s_n); +#if FLEXT_SYS == FLEXT_SYS_JMAX + fts_atom_t args[2]; + fts_set_pointer(args+0,obj); + fts_set_int(args+1,obj->blksz); + fts_dsp_add_function(dspsym,2,args); +#else + dsp_add((t_dspmethod)dspmeth,2,obj,obj->blksz); +#endif +} + +/* +#if FLEXT_SYS == FLEXT_SYS_JMAX +void flext_dsp::cb_dsp_init(fts_object_t *c, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at) +{ + fts_dsp_add_object(c); +} + +void flext_dsp::cb_dsp_delete(fts_object_t *c, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at) +{ + fts_dsp_remove_object(c); +} +#endif +*/ + +void flext_dsp::m_dsp(int /*n*/,t_signalvec const * /*insigs*/,t_signalvec const * /*outsigs*/) {} + +void flext_dsp::m_signal(int n,t_sample *const * /*insigs*/,t_sample *const *outs) +{ + for(int i = 0; i < CntOutSig(); ++i) + memset(outs[i],0,n*sizeof(*outs[i])); } #if FLEXT_SYS != FLEXT_SYS_MAX + +#if FLEXT_SYS == FLEXT_SYS_PD void flext_dsp::cb_enable(t_class *c,t_float on) { thisObject(c)->m_enable(on != 0); } +#elif FLEXT_SYS == FLEXT_SYS_JMAX +void flext_dsp::cb_enable(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at) +{ thisObject(c)->m_enable(fts_get_int(at+0) != 0); } +#endif + void flext_dsp::m_enable(bool en) { dspon = en; } #endif diff --git a/externals/grill/flext/source/fldsp.h b/externals/grill/flext/source/fldsp.h index b0cb7f01..80631531 100644 --- a/externals/grill/flext/source/fldsp.h +++ b/externals/grill/flext/source/fldsp.h @@ -57,8 +57,14 @@ public: */ int ChannelsOut() const { return chnsout; } -//! @} + //! typedef describing a signal vector +#if FLEXT_SYS == FLEXT_SYS_JMAX + typedef fts_symbol_t t_signalvec; +#else + typedef t_sample *t_signalvec; +#endif +//! @} // --- inheritable virtual methods -------------------------------- @@ -73,7 +79,7 @@ public: \param insigs: array of input vectors (get number with function CntInSig()) \param outsigs: array of output vectors (get number with function CntOutSig()) */ - virtual void m_dsp(int n,t_sample *const *insigs,t_sample *const *outsigs); + virtual void m_dsp(int n,t_signalvec const *insigs,t_signalvec const *outsigs); /*! \brief Called with every signal vector - here you do the dsp calculation @@ -141,16 +147,32 @@ private: // callback functions +#if FLEXT_SYS == FLEXT_SYS_JMAX + static void cb_dsp(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at); +// static void cb_dsp_init(fts_object_t *o, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at); +// static void cb_dsp_delete(fts_object_t *o, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at); +#else static void cb_dsp(t_class *c,t_signal **s); +#endif + #if FLEXT_SYS != FLEXT_SYS_MAX +#if FLEXT_SYS == FLEXT_SYS_JMAX + static void cb_enable(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at); +#else static void cb_enable(t_class *c,t_float on); +#endif bool dspon; #endif // dsp stuff +#if FLEXT_SYS == FLEXT_SYS_JMAX + static void dspmeth(fts_word_t *); + static const t_symbol *dspsym; +#else static t_int *dspmeth(t_int *w); - t_sample **invecs,**outvecs; +#endif + t_signalvec *invecs,*outvecs; }; #endif diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index baf33c42..c2cd59c4 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -25,9 +25,10 @@ flext_base::flext_base(): curtag(NULL), incnt(0),outcnt(0), insigs(0),outsigs(0), - outlets(NULL),outattr(NULL), - distmsgs(false), - inlets(NULL) + distmsgs(false) +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX + ,outlets(NULL),inlets(NULL) +#endif #if FLEXT_SYS == FLEXT_SYS_MAX ,indesc(NULL),outdesc(NULL) #endif @@ -48,7 +49,9 @@ flext_base::flext_base(): // message queue ticker qhead = qtail = NULL; +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX qclk = (t_qelem *)(qelem_new(this,(t_method)QTick)); +#endif } flext_base::~flext_base() @@ -58,8 +61,14 @@ flext_base::~flext_base() #endif // send remaining pending messages and destroy queue ticker +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX while(qhead) QTick(this); qelem_free((t_qelem *)qclk); +#elif FLEXT_SYS == FLEXT_SYS_JMAX + while(qhead) QTick((fts_object_t *)thisHdr(),0,NULL,0,NULL); + // this is dangerous because there may be other timers on this object! + fts_timebase_remove_object(fts_get_timebase(), (fts_object_t *)thisHdr()); +#endif // delete message lists if(methhead) delete methhead; @@ -68,6 +77,8 @@ flext_base::~flext_base() // destroy inlets and outlets and their proxy objects if(inlist) delete inlist; if(outlist) delete outlist; + +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX if(outlets) delete[] outlets; if(inlets) { @@ -82,6 +93,7 @@ flext_base::~flext_base() } delete[] inlets; } +#endif #if FLEXT_SYS == FLEXT_SYS_MAX if(indesc) { @@ -139,11 +151,16 @@ void flext_base::Setup(t_classid id) { t_class *c = getClass(id); +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX add_method(c,cb_help,"help"); add_loadbang(c,cb_loadbang); #if FLEXT_SYS == FLEXT_SYS_MAX add_assist(c,cb_assist); #endif +#else + fts_class_message_varargs(c,MakeSymbol("help"),cb_help); + #pragma message ("no implementation of loadbang or assist") +#endif if(process_attributes) AddMethod(id,0,"getattributes",(methfun)cb_ListAttrib); @@ -156,9 +173,12 @@ void flext_base::Setup(t_classid id) #endif } +#if FLEXT_SYS == FLEXT_SYS_JMAX +void flext_base::cb_help(fts_object_t *c,int, fts_symbol_t, int, const fts_atom_t *) { thisObject(c)->m_help(); } +#else void flext_base::cb_help(t_class *c) { thisObject(c)->m_help(); } - void flext_base::cb_loadbang(t_class *c) { thisObject(c)->m_loadbang(); } +#endif void flext_base::m_help() { diff --git a/externals/grill/flext/source/flinternal.h b/externals/grill/flext/source/flinternal.h index 016a0bd7..af88cbca 100644 --- a/externals/grill/flext/source/flinternal.h +++ b/externals/grill/flext/source/flinternal.h @@ -112,6 +112,9 @@ typedef t_perfroutine t_dspmethod; #define CRITON() short state = lockout_set(1) #define CRITOFF() lockout_set(state) +#elif FLEXT_SYS == FLEXT_SYS_JMAX + + #endif diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp index 2d3aaa4c..998cbae3 100755 --- a/externals/grill/flext/source/fllib.cpp +++ b/externals/grill/flext/source/fllib.cpp @@ -78,7 +78,7 @@ static const char *extract(const char *name,int ix = 0) //! Check if object's name ends with a tilde -static bool chktilde(const char *objname) +bool flext::chktilde(const char *objname) { // int stplen = strlen(setupfun); bool tilde = true; //!strncmp(setupfun,"_tilde",6); @@ -202,6 +202,13 @@ void flext_obj::lib_init(const char *name,void setupfun(),bool attr) setupfun(); } +#if FLEXT_SYS == FLEXT_SYS_JMAX +static void jmax_class_inst(t_class *cl) +{ + fts_class_init(cl, sizeof(flext_hdr),flext_obj::obj_new,flext_obj::obj_free); +} +#endif + void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const char *names,void setupfun(t_classid),flext_obj *(*newfun)(int,t_atom *),void (*freefun)(flext_hdr *),int argtp1,...) { // get first possible object name @@ -235,6 +242,8 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha // attention: in Max/MSP the *cl variable is not initialized after that call. // just the address is stored, the initialization then occurs with the first object instance! } +#elif FLEXT_SYS == FLEXT_SYS_JMAX + *cl = fts_class_install(nsym, jmax_class_inst); #else #error #endif @@ -248,7 +257,7 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha // post("ADDCLASS %p -> LIBOBJ %p -> %p",*cl,lo,lo->clss); // parse the argument type list and store it with the object - if(argtp1 == A_GIMME) + if(argtp1 == FLEXTTPN_VAR) lo->argc = -1; else { int argtp,i; @@ -256,7 +265,7 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha // parse a first time and count only va_start(marker,argtp1); - for(argtp = argtp1; argtp != A_NULL; ++lo->argc) argtp = (int)va_arg(marker,int); + for(argtp = argtp1; argtp != FLEXTTPN_NULL; ++lo->argc) argtp = (int)va_arg(marker,int); va_end(marker); lo->argv = new int[lo->argc]; @@ -271,7 +280,7 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha } // get unique class id -#if FLEXT_SYS == FLEXT_SYS_PD +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_JMAX t_classid clid = lo->clss; #else // in Max/MSP the t_class *value can't be used because it's possible that's it's not yet set!! @@ -299,6 +308,8 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha // in Max/MSP the first alias gets its name from the name of the object file, // unless it is a library (then the name can be different) ::alias(const_cast(c)); +#elif FLEXT_SYS == FLEXT_SYS_JMAX + if(ix > 0) fts_class_alias(lo->clss,l->name); #else #error #endif @@ -311,9 +322,15 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha typedef flext_obj *(*libfun)(int,t_atom *); +#if FLEXT_SYS == FLEXT_SYS_JMAX +void flext_obj::obj_new(fts_object_t *o, int, fts_symbol_t s, int _argc_, const fts_atom_t *argv) +{ + flext_hdr *obj = (flext_hdr *)o; +#else flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv) { flext_hdr *obj = NULL; +#endif libname *l = libname::Find(s); if(l) { bool ok = true; @@ -333,19 +350,19 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv) if(argc == lo->argc) { for(int i = 0; /*ok &&*/ i < lo->argc; ++i) { switch(lo->argv[i]) { -#if FLEXT_SYS == FLEXT_SYS_MAX - case A_INT: +#if FLEXT_SYS != FLEXT_SYS_PD + case FLEXTTPN_INT: if(flext::IsInt(argv[i])) args[i] = argv[i]; else if(flext::IsFloat(argv[i])) flext::SetInt(args[i],(int)flext::GetFloat(argv[i])); else ok = false; break; #endif - case A_FLOAT: + case FLEXTTPN_FLOAT: if(flext::IsInt(argv[i])) flext::SetFloat(args[i],(float)flext::GetInt(argv[i])); else if(flext::IsFloat(argv[i])) args[i] = argv[i]; else ok = false; break; - case A_SYMBOL: + case FLEXTTPN_SYM: if(flext::IsSymbol(argv[i])) args[i] = argv[i]; else ok = false; break; @@ -353,10 +370,10 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv) } if(!ok) - post("%s: Creation arguments do not match",s->s_name); + post("%s: Creation arguments do not match",GetString(s)); } else { - error("%s: %s creation arguments",s->s_name,argc < lo->argc?"Not enough":"Too many"); + error("%s: %s creation arguments",GetString(s),argc < lo->argc?"Not enough":"Too many"); ok = false; } } @@ -370,6 +387,8 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv) #elif FLEXT_SYS == FLEXT_SYS_MAX clid = lo; obj = (flext_hdr *)::newobject(lo->clss); +#elif FLEXT_SYS == FLEXT_SYS_JMAX + clid = lo->clss; #else #error #endif @@ -384,7 +403,7 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv) // for interpreted arguments obj->data = lo->newfun(lo->argc,args); else - obj->data = lo->newfun(argc,argv); + obj->data = lo->newfun(argc,(t_atom *)argv); flext_obj::m_holder = NULL; flext_obj::m_holdname = NULL; @@ -426,11 +445,18 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv) error("Class %s not found in library!",s->s_name); #endif +#if FLEXT_SYS != FLEXT_SYS_JMAX return obj; +#endif } -void flext_obj::obj_free(flext_hdr *hdr) +#if FLEXT_SYS == FLEXT_SYS_JMAX +void flext_obj::obj_free(fts_object_t *h, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at) +#else +void flext_obj::obj_free(flext_hdr *h) +#endif { + flext_hdr *hdr = (flext_hdr *)h; const t_symbol *name = hdr->data->thisNameSym(); libname *l = libname::Find(name); diff --git a/externals/grill/flext/source/flout.cpp b/externals/grill/flext/source/flout.cpp index f8fb1fe1..c745924c 100644 --- a/externals/grill/flext/source/flout.cpp +++ b/externals/grill/flext/source/flout.cpp @@ -16,22 +16,43 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "flinternal.h" #include +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX + +#ifndef FLEXT_THREADS +void flext_base::ToOutBang(int n) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_bang((t_outlet *)o); CRITOFF(); } } +void flext_base::ToOutFloat(int n,float f) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_float((t_outlet *)o,f); CRITOFF(); } } +void flext_base::ToOutInt(int n,int f) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_flint((t_outlet *)o,f); CRITOFF(); } } +void flext_base::ToOutSymbol(int n,const t_symbol *s) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_symbol((t_outlet *)o,const_cast(s)); CRITOFF(); } } +void flext_base::ToOutList(int n,int argc,const t_atom *argv) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_list((t_outlet *)o,const_cast(sym_list),argc,(t_atom *)argv); CRITOFF(); } } +void flext_base::ToOutAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_anything((t_outlet *)o,const_cast(s),argc,(t_atom *)argv); CRITOFF(); } } +#else +void flext_base::ToOutBang(int n) const { if(IsSystemThread()) { outlet *o = GetOut(n); if(o) { CRITON(); outlet_bang((t_outlet *)o); CRITOFF(); } } else ToQueueBang(n); } +void flext_base::ToOutFloat(int n,float f) const { if(IsSystemThread()) { outlet *o = GetOut(n); if(o) { CRITON(); outlet_float((t_outlet *)o,f); CRITOFF(); } } else ToQueueFloat(n,f); } +void flext_base::ToOutInt(int n,int f) const { if(IsSystemThread()) { outlet *o = GetOut(n); if(o) { CRITON(); outlet_flint((t_outlet *)o,f); CRITOFF(); } } else ToQueueInt(n,f); } +void flext_base::ToOutSymbol(int n,const t_symbol *s) const { if(IsSystemThread()) { outlet *o = GetOut(n); if(o) { CRITON(); outlet_symbol((t_outlet *)o,const_cast(s)); CRITOFF(); } } else ToQueueSymbol(n,s); } +void flext_base::ToOutList(int n,int argc,const t_atom *argv) const { if(IsSystemThread()) { outlet *o = GetOut(n); if(o) { CRITON(); outlet_list((t_outlet *)o,const_cast(sym_list),argc,(t_atom *)argv); CRITOFF(); } } else ToQueueList(n,argc,(t_atom *)argv); } +void flext_base::ToOutAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { if(IsSystemThread()) { outlet *o = GetOut(n); if(o) { CRITON(); outlet_anything((t_outlet *)o,const_cast(s),argc,(t_atom *)argv); CRITOFF(); } } else ToQueueAnything(n,s,argc,(t_atom *)argv); } +#endif + +#elif FLEXT_SYS == FLEXT_SYS_JMAX + #ifndef FLEXT_THREADS -void flext_base::ToOutBang(outlet *o) const { CRITON(); outlet_bang((t_outlet *)o); CRITOFF(); } -void flext_base::ToOutFloat(outlet *o,float f) const { CRITON(); outlet_float((t_outlet *)o,f); CRITOFF(); } -void flext_base::ToOutInt(outlet *o,int f) const { CRITON(); outlet_flint((t_outlet *)o,f); CRITOFF(); } -void flext_base::ToOutSymbol(outlet *o,const t_symbol *s) const { CRITON(); outlet_symbol((t_outlet *)o,const_cast(s)); CRITOFF(); } -void flext_base::ToOutList(outlet *o,int argc,const t_atom *argv) const { CRITON(); outlet_list((t_outlet *)o,gensym("list"),argc,(t_atom *)argv); CRITOFF(); } -void flext_base::ToOutAnything(outlet *o,const t_symbol *s,int argc,const t_atom *argv) const { CRITON(); outlet_anything((t_outlet *)o,const_cast(s),argc,(t_atom *)argv); CRITOFF(); } +void flext_base::ToOutBang(int n) const { fts_outlet_bang((fts_object *)thisHdr(),n); } +void flext_base::ToOutFloat(int n,float f) const { fts_outlet_float((fts_object *)thisHdr(),n,f); } +void flext_base::ToOutInt(int n,int f) const { fts_outlet_int((fts_object *)thisHdr(),n,f); } +void flext_base::ToOutSymbol(int n,const t_symbol *s) const { fts_outlet_symbol((fts_object *)thisHdr(),n,s); } +void flext_base::ToOutList(int n,int argc,const t_atom *argv) const { fts_outlet_send((fts_object *)thisHdr(),n,sym_list,argc,(t_atom *)argv); } +void flext_base::ToOutAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { fts_outlet_send((fts_object *)thisHdr(),n,const_cast(s),argc,(t_atom *)argv); } #else -void flext_base::ToOutBang(outlet *o) const { if(IsSystemThread()) { CRITON(); outlet_bang((t_outlet *)o); CRITOFF(); } else ToQueueBang(o); } -void flext_base::ToOutFloat(outlet *o,float f) const { if(IsSystemThread()) { CRITON(); outlet_float((t_outlet *)o,f); CRITOFF(); } else ToQueueFloat(o,f); } -void flext_base::ToOutInt(outlet *o,int f) const { if(IsSystemThread()) { CRITON(); outlet_flint((t_outlet *)o,f); CRITOFF(); } else ToQueueInt(o,f); } -void flext_base::ToOutSymbol(outlet *o,const t_symbol *s) const { if(IsSystemThread()) { CRITON(); outlet_symbol((t_outlet *)o,const_cast(s)); CRITOFF(); } else ToQueueSymbol(o,s); } -void flext_base::ToOutList(outlet *o,int argc,const t_atom *argv) const { if(IsSystemThread()) { CRITON(); outlet_list((t_outlet *)o,gensym("list"),argc,(t_atom *)argv); CRITOFF(); } else ToQueueList(o,argc,(t_atom *)argv); } -void flext_base::ToOutAnything(outlet *o,const t_symbol *s,int argc,const t_atom *argv) const { if(IsSystemThread()) { CRITON(); outlet_anything((t_outlet *)o,const_cast(s),argc,(t_atom *)argv); CRITOFF(); } else ToQueueAnything(o,s,argc,(t_atom *)argv); } +void flext_base::ToOutBang(int n) const { if(IsSystemThread()) fts_outlet_bang((fts_object *)thisHdr(),n); else ToQueueBang(n); } +void flext_base::ToOutFloat(int n,float f) const { if(IsSystemThread()) fts_outlet_float((fts_object *)thisHdr(),n,f); else ToQueueFloat(n,f); } +void flext_base::ToOutInt(int n,int f) const { if(IsSystemThread()) fts_outlet_int((fts_object *)thisHdr(),n,f); else ToQueueInt(n,f); } +void flext_base::ToOutSymbol(int n,const t_symbol *s) const { if(IsSystemThread()) fts_outlet_symbol((fts_object *)thisHdr(),n,s); else ToQueueSymbol(n,s); } +void flext_base::ToOutList(int n,int argc,const t_atom *argv) const { if(IsSystemThread()) fts_outlet_send((fts_object *)thisHdr(),n,sym_list,argc,(t_atom *)argv); else ToQueueList(n,argc,(t_atom *)argv); } +void flext_base::ToOutAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { if(IsSystemThread()) fts_outlet_send((fts_object *)thisHdr(),n,const_cast(s),argc,(t_atom *)argv); else ToQueueAnything(n,s,argc,(t_atom *)argv); } #endif +#endif bool flext_base::InitInlets() { @@ -68,8 +89,10 @@ bool flext_base::InitInlets() delete inlist; inlist = NULL; +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX inlets = new px_object *[incnt]; for(i = 0; i < incnt; ++i) inlets[i] = NULL; +#endif // type info is now in list array #if FLEXT_SYS == FLEXT_SYS_PD @@ -195,6 +218,43 @@ bool flext_base::InitInlets() // dsp_setup(thisHdr(),insigs); // signal inlets dsp_setupbox(thisHdr(),insigs); // signal inlets } +#elif FLEXT_SYS == FLEXT_SYS_JMAX + { + t_class *cl = thisClass(); + int cnt = 0; + for(int ix = 0; ix < incnt; ++ix,++cnt) { + switch(list[ix]) { + case xlet::tp_float: + case xlet::tp_int: +// fts_class_inlet_number(cl, ix, jmax_proxy); + break; + case xlet::tp_sym: +// fts_class_inlet_symbol(cl, ix, jmax_proxy); + break; + case xlet::tp_sig: + if(compatibility && list[ix-1] != xlet::tp_sig) { + post("%s: All signal inlets must be left-aligned in compatibility mode",thisName()); + ok = false; + } + else { + if(!insigs) fts_dsp_declare_inlet(cl,0); + ++insigs; + } + // no break -> let a signal inlet also accept any messages + case xlet::tp_list: + case xlet::tp_any: +// fts_class_inlet_varargs(cl,ix, jmax_proxy); + break; + default: + error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]); + ok = false; + } + } + + incnt = cnt; + + fts_object_set_inlets_number((fts_object_t *)thisHdr(), incnt); + } #else #error #endif @@ -217,8 +277,9 @@ bool flext_base::InitOutlets() #if FLEXT_SYS == FLEXT_SYS_MAX // for Max/MSP the rightmost outlet has to be created first + outlet *attrtmp = NULL; if(procattr) - outattr = (outlet *)newout_anything(&x_obj->obj); + attrtmp = (outlet *)newout_anything(thisHdr()); #endif if(outlist) { @@ -249,7 +310,8 @@ bool flext_base::InitOutlets() delete outlist; outlist = NULL; - outlets = new outlet *[outcnt]; +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX + outlets = new outlet *[outcnt+(procattr?1:0)]; // type info is now in list array #if FLEXT_SYS == FLEXT_SYS_PD @@ -284,17 +346,50 @@ bool flext_base::InitOutlets() default: ERRINTERNAL(); ok = false; +#endif + } + } +#elif FLEXT_SYS == FLEXT_SYS_JMAX + t_class *cl = thisClass(); + for(int ix = 0; ix < outcnt; ++ix) { + switch(list[ix]) { + case xlet::tp_float: + case xlet::tp_int: +// fts_class_outlet_number(cl, ix); + break; + case xlet::tp_sym: +// fts_class_outlet_symbol(cl, ix); + break; + case xlet::tp_list: + case xlet::tp_any: +// fts_class_outlet_anything(cl, ix); + break; + case xlet::tp_sig: + if(!outsigs) fts_dsp_declare_outlet(cl,0); + ++outsigs; + break; +#ifdef FLEXT_DEBUG + default: + ERRINTERNAL(); + ok = false; #endif } } + fts_object_set_outlets_number((fts_object_t *)thisHdr(), outcnt); +#endif + delete[] list; } if(procattr) { + // attribute dump outlet is the last one + outlets[outcnt] = #if FLEXT_SYS == FLEXT_SYS_PD // attribute dump outlet is the last one - outattr = (outlet *)newout_anything(&x_obj->obj); + (outlet *)newout_anything(&x_obj->obj); +#elif FLEXT_SYS == FLEXT_SYS_MAX + attrtmp; #endif } diff --git a/externals/grill/flext/source/flproxy.cpp b/externals/grill/flext/source/flproxy.cpp index 185700a5..75bbc897 100755 --- a/externals/grill/flext/source/flproxy.cpp +++ b/externals/grill/flext/source/flproxy.cpp @@ -84,10 +84,9 @@ void flext_base::cb_px_ft ## IX(t_class *c,float v) { long &ci = ((flext_hdr *)t add_method1(c,cb_px_in ## IX,"in" #IX,A_INT); \ add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT) -#else -#error // Other system #endif +#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX DEF_IN_FT(1) DEF_IN_FT(2) @@ -99,7 +98,6 @@ DEF_IN_FT(7) DEF_IN_FT(8) DEF_IN_FT(9) - void flext_base::SetProxies(t_class *c) { // proxy for extra inlets @@ -129,4 +127,18 @@ void flext_base::SetProxies(t_class *c) ADD_IN_FT(9); } +#elif FLEXT_SYS == FLEXT_SYS_JMAX +void flext_base::jmax_proxy(fts_object_t *c, int winlet, fts_symbol_t s, int argc, const fts_atom_t *argv) +{ + flext_base *o = thisObject(c); + o->m_methodmain(winlet,s,argc,argv); +} + +void flext_base::SetProxies(t_class *c) +{ + fts_class_set_default_handler(c, jmax_proxy); +} + +#endif + diff --git a/externals/grill/flext/source/flqueue.cpp b/externals/grill/flext/source/flqueue.cpp index 8c3be318..13cada78 100755 --- a/externals/grill/flext/source/flqueue.cpp +++ b/externals/grill/flext/source/flqueue.cpp @@ -25,14 +25,14 @@ public: void Clear(); - void SetBang(outlet *o) { Clear(); out = o; tp = tp_bang; } - void SetFloat(outlet *o,float f) { Clear(); out = o; tp = tp_float; _float = f; } - void SetInt(outlet *o,int i) { Clear(); out = o; tp = tp_int; _int = i; } - void SetSymbol(outlet *o,const t_symbol *s) { Clear(); out = o; tp = tp_sym; _sym = s; } - void SetList(outlet *o,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_list; _list.argc = argc,_list.argv = CopyList(argc,argv); } - void SetAny(outlet *o,const t_symbol *s,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_any; _any.s = s,_any.argc = argc,_any.argv = CopyList(argc,argv); } - - outlet *out; + void SetBang(int o) { Clear(); out = o; tp = tp_bang; } + void SetFloat(int o,float f) { Clear(); out = o; tp = tp_float; _float = f; } + void SetInt(int o,int i) { Clear(); out = o; tp = tp_int; _int = i; } + void SetSymbol(int o,const t_symbol *s) { Clear(); out = o; tp = tp_sym; _sym = s; } + void SetList(int o,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_list; _list.argc = argc,_list.argv = CopyList(argc,argv); } + void SetAny(int o,const t_symbol *s,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_any; _any.s = s,_any.argc = argc,_any.argv = CopyList(argc,argv); } + + int out; enum { tp_none,tp_bang,tp_float,tp_int,tp_sym,tp_list,tp_any } tp; union { float _float; @@ -56,8 +56,14 @@ void flext_base::qmsg::Clear() tp = tp_none; } +#if FLEXT_SYS == FLEXT_SYS_JMAX +void flext_base::QTick(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at) +{ + flext_base *th = thisObject(c); +#else void flext_base::QTick(flext_base *th) { +#endif // post("qtick"); #if defined(FLEXT_THREADS) && defined(FLEXT_DEBUG) if(!th->IsSystemThread()) { @@ -73,8 +79,6 @@ void flext_base::QTick(flext_base *th) qmsg *m = th->qhead; if(!m) break; - CRITON(); - switch(m->tp) { case qmsg::tp_bang: th->ToOutBang(m->out); break; case qmsg::tp_float: th->ToOutFloat(m->out,m->_float); break; @@ -87,8 +91,6 @@ void flext_base::QTick(flext_base *th) #endif } - CRITOFF(); - th->qhead = m->nxt; if(!th->qhead) th->qtail = NULL; m->nxt = NULL; @@ -117,48 +119,50 @@ void flext_base::Queue(qmsg *m) clock_delay(qclk,0); #elif FLEXT_SYS == FLEXT_SYS_MAX qelem_set(qclk); +#elif FLEXT_SYS == FLEXT_SYS_JMAX + // this is dangerous because there may be other timers on this object! + fts_timebase_add_call(fts_get_timebase(), (fts_object_t *)thisHdr(), QTick, NULL, 0); #else -#error +#error #endif - } -void flext_base::ToQueueBang(outlet *o) const +void flext_base::ToQueueBang(int o) const { qmsg *m = new qmsg(); m->SetBang(o); const_cast(*this).Queue(m); } -void flext_base::ToQueueFloat(outlet *o,float f) const +void flext_base::ToQueueFloat(int o,float f) const { qmsg *m = new qmsg; m->SetFloat(o,f); const_cast(*this).Queue(m); } -void flext_base::ToQueueInt(outlet *o,int f) const +void flext_base::ToQueueInt(int o,int f) const { qmsg *m = new qmsg; m->SetInt(o,f); const_cast(*this).Queue(m); } -void flext_base::ToQueueSymbol(outlet *o,const t_symbol *s) const +void flext_base::ToQueueSymbol(int o,const t_symbol *s) const { qmsg *m = new qmsg; m->SetSymbol(o,s); const_cast(*this).Queue(m); } -void flext_base::ToQueueList(outlet *o,int argc,const t_atom *argv) const +void flext_base::ToQueueList(int o,int argc,const t_atom *argv) const { qmsg *m = new qmsg; m->SetList(o,argc,argv); const_cast(*this).Queue(m); } -void flext_base::ToQueueAnything(outlet *o,const t_symbol *s,int argc,const t_atom *argv) const +void flext_base::ToQueueAnything(int o,const t_symbol *s,int argc,const t_atom *argv) const { qmsg *m = new qmsg; m->SetAny(o,s,argc,argv); diff --git a/externals/grill/flext/source/flstdc.h b/externals/grill/flext/source/flstdc.h index aedcdf83..e36ec4e4 100644 --- a/externals/grill/flext/source/flstdc.h +++ b/externals/grill/flext/source/flstdc.h @@ -54,7 +54,6 @@ typedef t_object t_sigobj; typedef t_gpointer *t_ptrtype; typedef t_float t_flint; -typedef t_symbol *t_symptr; typedef t_symbol *t_symtype; typedef t_class **t_thing; @@ -97,7 +96,6 @@ typedef t_pxbox t_sigobj; // that's the all-in-one object type of Max/MSP (not typedef t_patcher t_canvas; typedef t_int t_flint; -typedef t_symbol *t_symptr; typedef t_symbol *t_symtype; typedef t_object *t_thing; @@ -124,8 +122,46 @@ typedef void t_binbuf; #define A_SYMBOL A_SYM #endif -#endif +#elif FLEXT_SYS == FLEXT_SYS_JMAX + +extern "C" { + // Wow, the jMax developers made excessive use of C++ reserved words + // good hit! + #define typeid c_typeid_ + #define template c_template_ + #define this c_this_ + #define class c_class_ + + #include + + // undefine them again + #undef typeid + #undef template + #undef this + #undef class +} + +typedef fts_dsp_object t_sigobj; +typedef void t_canvas; // decide type later on + +typedef char t_symbol; +typedef fts_atom_t t_atom; +typedef fts_class_t t_class; +typedef float t_sample; // is there no sample type in jMax? + +typedef fts_timebase_entry_t t_clock; +typedef fts_timebase_entry_t t_qelem; + +#endif // FLEXT_SYS + + +// general definitions + +typedef t_symbol *t_symptr; + + +// ------------------------- #ifdef _LOG diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp index ecc39153..3c6ab8f3 100644 --- a/externals/grill/flext/source/flsupport.cpp +++ b/externals/grill/flext/source/flsupport.cpp @@ -18,10 +18,13 @@ const t_symbol *flext::sym_float = NULL; const t_symbol *flext::sym_symbol = NULL; const t_symbol *flext::sym_bang = NULL; const t_symbol *flext::sym_list = NULL; -const t_symbol *flext::sym_anything = NULL; const t_symbol *flext::sym_pointer = NULL; const t_symbol *flext::sym_int = NULL; +#if FLEXT_SYS != FLEXT_SYS_JMAX +const t_symbol *flext::sym_anything = NULL; +#endif + #if FLEXT_SYS == FLEXT_SYS_PD const t_symbol *flext::sym_signal = NULL; #endif @@ -43,8 +46,14 @@ void flext::Setup() sym_bang = gensym("bang"); sym_list = gensym("list"); sym_anything = gensym("anything"); +#elif FLEXT_SYS == FLEXT_SYS_JMAX + sym_int = fts_s_int; + sym_float = fts_s_float; + sym_symbol = fts_s_symbol; + sym_bang = fts_s_bang; + sym_list = fts_s_list; + sym_pointer = fts_s_pointer; #else -#error #endif } @@ -69,10 +78,10 @@ void *flext::operator new(size_t bytes) void flext::operator delete(void *blk) { char *ori = (char *)blk-sizeof(size_t); - size_t bytes = *(size_t *)ori; #if FLEXT_SYS == FLEXT_SYS_JMAX - ::fts_free(ori); + fts_free(ori); #else + size_t bytes = *(size_t *)ori; ::freebytes(ori,bytes); #endif } @@ -96,11 +105,11 @@ void *flext::NewAligned(size_t bytes,int bitalign) void flext::FreeAligned(void *blk) { char *ori = *(char **)((char *)blk-sizeof(size_t)-sizeof(char *)); - size_t bytes = *(size_t *)((char *)blk-sizeof(size_t)); #if FLEXT_SYS == FLEXT_SYS_JMAX - ::fts_free(ori); + fts_free(ori); #else + size_t bytes = *(size_t *)((char *)blk-sizeof(size_t)); ::freebytes(ori,bytes); #endif } diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index 56c43bc6..3f771ea0 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -33,16 +33,13 @@ class FLEXT_SHARE flext { */ public: -// --- types ------------------------------------------------------- +// --- console output ----------------------------------------------- #if FLEXT_SYS == FLEXT_SYS_JMAX - typedef fts_symbol_t t_symbol; - typedef fts_atom_t t_atom; - typedef fts_class_t t_class; -#else -// typedef t_symbol t_symbol; -// typedef t_atom t_atom; -// typedef t_class t_class; + //! post message to console + static void post(const char *s,...); + //! post error message to console + static void error(const char *s,...); #endif // --- memory ------------------------------------------------------- @@ -76,6 +73,9 @@ public: @{ */ +// not for Jmax at the moment +#if FLEXT_SYS != FLEXT_SYS_JMAX + //! Class for platform independent buffer handling class FLEXT_SHARE buffer { @@ -112,7 +112,7 @@ public: t_symbol *Symbol() const { return const_cast(sym); } //! Get literal name of buffer - const char *Name() const { return sym?sym->s_name:""; } + const char *Name() const { return sym?GetString(sym):""; } /*! \brief Get pointer to buffer, channel and frame count. \remark Channels are interleaved @@ -144,6 +144,8 @@ public: #endif }; +#endif // jmax + //! @} FLEXT_S_BUFFER // --- utilities -------------------------------------------------- @@ -235,15 +237,15 @@ public: #if FLEXT_SYS == FLEXT_SYS_JMAX //! Set atom from another atom - static int GetType(const t_atom &a) // ** TODO ** + static int GetType(const t_atom &a); // ** TODO ** //! Check whether the atom is nothing - static bool IsNothing(const t_atom &a) // ** TODO ** + static bool IsNothing(const t_atom &a) { return fts_is_a(&a,fts_void_class); } //! Set the atom to represent nothing - static void SetNothing(t_atom &a) // ** TODO ** + static void SetNothing(t_atom &a) { fts_set_void(&a); } //! Check whether the atom is a float - static bool IsFloat(const t_atom &a) // ** TODO ** + static bool IsFloat(const t_atom &a) { return fts_is_a(&a,fts_float_class); } #else //! Set atom from another atom static int GetType(const t_atom &a) { return a.a_type; } @@ -262,12 +264,12 @@ public: #if FLEXT_SYS == FLEXT_SYS_JMAX //! Access the float value (without type check) - static float GetFloat(const t_atom &a); // ** TODO ** + static float GetFloat(const t_atom &a) { return fts_get_float(&a); } //! Set the atom to represent a float - static void SetFloat(t_atom &a,float v) // ** TODO ** + static void SetFloat(t_atom &a,float v) { fts_set_float(&a,v); } //! Check whether the atom is a symbol - static bool IsSymbol(const t_atom &a) // ** TODO ** + static bool IsSymbol(const t_atom &a) { return fts_is_a(&a,fts_symbol_class); } #else //! Access the float value (without type check) static float GetFloat(const t_atom &a) { return a.a_w.w_float; } @@ -292,7 +294,7 @@ public: //! Access the symbol value (without type check) static t_symbol *GetSymbol(const t_atom &a); // ** TODO ** //! Set the atom to represent a symbol - static void SetSymbol(t_atom &a,const t_symbol *s) { ::fts_set_symbol(&a,s); } + static void SetSymbol(t_atom &a,const t_symbol *s) { fts_set_symbol(&a,s); } #else #error #endif @@ -306,7 +308,7 @@ public: //! Check for a string and get its value static void GetAString(const t_atom &a,char *buf,int szbuf); //! Set the atom to represent a string - static void SetString(t_atom &a,const char *c) { SetSymbol(a,gensym(const_cast(c))); } + static void SetString(t_atom &a,const char *c) { SetSymbol(a,MakeSymbol(c)); } //! Check whether the atom can be represented as an integer static bool CanbeInt(const t_atom &a) { return IsFloat(a) || IsInt(a); } @@ -370,24 +372,24 @@ public: static float GetAFloat(const t_atom &a,float def = 0) { return IsFloat(a)?GetFloat(a):(IsInt(a)?GetInt(a):def); } //! Check whether the atom is an int - static bool IsInt(const t_atom &a); // ** TODO ** + static bool IsInt(const t_atom &a) { return fts_is_a(&a,fts_int_class); } //! Access the integer value (without type check) - static int GetInt(const t_atom &a); // ** TODO ** + static int GetInt(const t_atom &a) { return fts_get_int(&a); } //! Check for an integer and get its value static int GetAInt(const t_atom &a,int def = 0) { return IsInt(a)?GetInt(a):(IsFloat(a)?(int)GetFloat(a):def); } //! Set the atom to represent an integer - static void SetInt(t_atom &a,int v) { ::fts_set_long(&a,v); } + static void SetInt(t_atom &a,int v) { fts_set_int(&a,v); } //! Check whether the atom strictly is a pointer - static bool IsPointer(const t_atom &); // ** TODO ** + static bool IsPointer(const t_atom &a) { return fts_is_a(&a,fts_pointer_class); } //! Check whether the atom can be a pointer static bool CanbePointer(const t_atom &a) { return IsPointer(a); } //! Access the pointer value (without type check) - static void *GetPointer(const t_atom &a) { return ::fts_get_ptr(&a,NULL); } + static void *GetPointer(const t_atom &a) { return fts_get_pointer(&a); } //! Check for a pointer and get its value - static void *GetAPointer(const t_atom &a,void *def = NULL) { return ::fts_get_ptr(&a,def); } + static void *GetAPointer(const t_atom &a,void *def = NULL) { return IsPointer(a)?GetPointer(a):def; } //! Set the atom to represent a pointer - static void SetPointer(t_atom &a,void *p) { ::fts_set_ptr(&a,p); } + static void SetPointer(t_atom &a,void *p) { fts_set_pointer(&a,p); } #else #error "Platform not supported" #endif @@ -459,8 +461,10 @@ public: public AtomList { public: +#if FLEXT_SYS != FLEXT_SYS_JMAX //! Construct anything AtomAnything(const t_symbol *h = NULL,int argc = 0,const t_atom *argv = NULL); +#endif //! Construct anything AtomAnything(const char *h,int argc = 0,const t_atom *argv = NULL); //! Construct anything @@ -803,6 +807,8 @@ protected: friend class flext_obj; #endif static void Setup(); + + static bool chktilde(const char *objname); }; #endif diff --git a/externals/grill/vasp/vasp.cw b/externals/grill/vasp/vasp.cw index f45bff31..d9bf60d3 100644 Binary files a/externals/grill/vasp/vasp.cw and b/externals/grill/vasp/vasp.cw differ diff --git a/externals/grill/xsample/source/groove.cpp b/externals/grill/xsample/source/groove.cpp index 241146c6..e35f71dc 100644 --- a/externals/grill/xsample/source/groove.cpp +++ b/externals/grill/xsample/source/groove.cpp @@ -72,10 +72,8 @@ protected: S *znpos,*znmul,*znidx; I pblksz; - outlet *outmin,*outmax; // float outlets - - inline V outputmin() { ToOutFloat(outmin,curmin*s2u); } - inline V outputmax() { ToOutFloat(outmax,curmax*s2u); } + inline V outputmin() { ToOutFloat(outchns+1,curmin*s2u); } + inline V outputmax() { ToOutFloat(outchns+2,curmax*s2u); } inline V setpos(F pos) { @@ -220,9 +218,6 @@ xgroove::~xgroove() BL xgroove::Init() { if(xinter::Init()) { - outmin = GetOut(outchns+1); - outmax = GetOut(outchns+2); - m_reset(); return true; } diff --git a/externals/grill/xsample/source/record.cpp b/externals/grill/xsample/source/record.cpp index c9faef65..ce169e9a 100644 --- a/externals/grill/xsample/source/record.cpp +++ b/externals/grill/xsample/source/record.cpp @@ -54,10 +54,8 @@ protected: BL dorec,doloop,mixmode; L curpos; // in samples - outlet *outmin,*outmax; // float outlets - - inline V outputmin() { ToOutFloat(outmin,curmin*s2u); } - inline V outputmax() { ToOutFloat(outmax,curmax*s2u); } + inline V outputmin() { ToOutFloat(1,curmin*s2u); } + inline V outputmax() { ToOutFloat(2,curmax*s2u); } inline V mg_pos(F &v) const { v = curpos*s2u; } @@ -164,9 +162,6 @@ xrecord::xrecord(I argc,const t_atom *argv): BL xrecord::Init() { if(xsample::Init()) { - outmin = GetOut(1); - outmax = GetOut(2); - m_reset(); return true; } diff --git a/externals/grill/xsample/xsample.cw b/externals/grill/xsample/xsample.cw index d6db1838..88559b7b 100755 Binary files a/externals/grill/xsample/xsample.cw and b/externals/grill/xsample/xsample.cw differ -- cgit v1.2.1