From 186ea5003a98b72666f451120785c4845ad5c163 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Fri, 3 Oct 2003 02:37:22 +0000 Subject: "" svn path=/trunk/; revision=1063 --- externals/grill/flext/config-pd-linux.txt | 1 - externals/grill/xsample/pd/xrecord~.pd | 70 +++++++++++++++-------------- externals/grill/xsample/readme.txt | 1 + externals/grill/xsample/source/main.h | 2 +- externals/grill/xsample/source/record.cpp | 73 ++++++++++++++++++++++++------- 5 files changed, 96 insertions(+), 51 deletions(-) diff --git a/externals/grill/flext/config-pd-linux.txt b/externals/grill/flext/config-pd-linux.txt index 2a07f2eb..6962affc 100644 --- a/externals/grill/flext/config-pd-linux.txt +++ b/externals/grill/flext/config-pd-linux.txt @@ -4,7 +4,6 @@ # your c++ compiler (define only if it's different than g++) # CXX=g++ -CXX=icc # where are the PD header files? (m_pd.h, m_imp.h, g_canvas.h) # if it is a system include path (like /usr/local/include) diff --git a/externals/grill/xsample/pd/xrecord~.pd b/externals/grill/xsample/pd/xrecord~.pd index c9bfc7ce..e5ad866b 100644 --- a/externals/grill/xsample/pd/xrecord~.pd +++ b/externals/grill/xsample/pd/xrecord~.pd @@ -1,4 +1,4 @@ -#N canvas 134 12 859 612 12; +#N canvas 134 12 861 614 12; #X obj 14 15 bng 15 250 50 0 empty empty empty 20 8 0 8 -258699 -1 -1; #X msg 13 35 stop; @@ -43,12 +43,10 @@ 1; #X msg 556 263 sigmode \$1; #X msg 409 360 print; -#X obj 581 353 hsl 128 15 -0.001 1 0 1 empty empty empty 20 8 0 8 -225271 +#X obj 563 368 hsl 128 15 -0.001 1 0 1 empty empty empty 20 8 0 8 -225271 -1 -1 3200 1; -#X obj 537 291 tgl 15 0 empty empty empty 20 8 0 8 -225271 -1 -1 1 -1; -#X msg 557 288 mixmode \$1; -#X floatatom 629 381 8 0 0 0 - - -; +#X msg 585 290 mixmode \$1; +#X floatatom 629 386 8 0 0 0 - - -; #X obj 411 473 metro 30; #X obj 18 247 metro 30; #X obj 640 21 osc~ 10; @@ -71,13 +69,12 @@ #X text 26 270 position signal; #X text 619 238 looping on/off; #X text 644 264 signal mode on/off; -#X text 700 381 trigger signal; +#X text 698 379 trigger signal; #X text 379 121 <----- message triggered; #X text 173 368 signal triggered ------->; #X text 493 185 click to activate auto update; #X text 432 271 start; #X text 450 295 stop; -#X text 538 307 mix-in by trigger signal on/off; #X msg 153 170 all; #X msg 488 206 100; #X obj 521 426 line~; @@ -89,6 +86,11 @@ #X obj 541 28 tgl 15 1 empty empty empty 20 8 0 8 -225271 -1 -1 0 1 ; #X obj 561 24 noise~; +#X obj 538 292 hradio 15 1 0 3 empty empty empty 0 -6 0 8 -262144 -1 +-1 0; +#X text 559 309 mixmode (off \, mix-in \, add); +#X text 566 339 by the trigger signal; +#X text 565 326 the amount of mixing-in is given; #X connect 0 0 7 0; #X connect 1 0 7 0; #X connect 4 0 7 2; @@ -96,10 +98,10 @@ #X connect 7 0 9 0; #X connect 7 1 2 0; #X connect 7 2 3 0; -#X connect 7 4 72 0; +#X connect 7 4 70 0; #X connect 8 0 7 0; #X connect 9 0 10 0; -#X connect 11 0 41 0; +#X connect 11 0 40 0; #X connect 12 0 7 0; #X connect 13 0 14 0; #X connect 14 0 7 0; @@ -115,7 +117,7 @@ #X connect 24 2 21 0; #X connect 25 0 24 0; #X connect 26 0 27 0; -#X connect 28 0 40 0; +#X connect 28 0 39 0; #X connect 29 0 30 0; #X connect 30 0 24 0; #X connect 31 0 32 0; @@ -123,27 +125,27 @@ #X connect 33 0 34 0; #X connect 34 0 24 0; #X connect 35 0 24 0; -#X connect 36 0 39 0; -#X connect 36 0 70 0; -#X connect 37 0 38 0; -#X connect 38 0 24 0; -#X connect 40 0 26 0; -#X connect 41 0 9 0; -#X connect 42 0 46 0; -#X connect 43 0 7 0; -#X connect 44 0 24 0; -#X connect 46 0 45 0; -#X connect 47 0 46 1; -#X connect 48 0 45 0; -#X connect 49 0 48 1; -#X connect 50 0 48 0; -#X connect 50 1 48 0; -#X connect 67 0 7 0; -#X connect 68 0 32 0; -#X connect 69 0 24 1; -#X connect 70 0 69 0; +#X connect 36 0 38 0; +#X connect 36 0 68 0; +#X connect 37 0 24 0; +#X connect 39 0 26 0; +#X connect 40 0 9 0; +#X connect 41 0 45 0; +#X connect 42 0 7 0; +#X connect 43 0 24 0; +#X connect 45 0 44 0; +#X connect 46 0 45 1; +#X connect 47 0 44 0; +#X connect 48 0 47 1; +#X connect 49 0 47 0; +#X connect 49 1 47 0; +#X connect 65 0 7 0; +#X connect 66 0 32 0; +#X connect 67 0 24 1; +#X connect 68 0 67 0; +#X connect 69 0 7 0; #X connect 71 0 7 0; -#X connect 73 0 7 0; -#X connect 74 0 45 0; -#X connect 75 0 74 1; -#X connect 76 0 74 0; +#X connect 72 0 44 0; +#X connect 73 0 72 1; +#X connect 74 0 72 0; +#X connect 75 0 37 0; diff --git a/externals/grill/xsample/readme.txt b/externals/grill/xsample/readme.txt index b2fe3ebf..21c005c0 100644 --- a/externals/grill/xsample/readme.txt +++ b/externals/grill/xsample/readme.txt @@ -123,6 +123,7 @@ Version history: - makefiles for command line MSVC++, BCC, cygwin GCC - better handling of non-existent buffers - fixed flext-related error on setting buffers +- xrecord~: mixmode has now 3 states (off, mix-in, add) 0.2.4: - according to flext 0.2.3 changed sample type to t_sample (S) diff --git a/externals/grill/xsample/source/main.h b/externals/grill/xsample/source/main.h index 367632d6..d3ff0017 100644 --- a/externals/grill/xsample/source/main.h +++ b/externals/grill/xsample/source/main.h @@ -12,7 +12,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define __XSAMPLE_H -#define XSAMPLE_VERSION "0.3.0pre15" +#define XSAMPLE_VERSION "0.3.0pre16" #define FLEXT_ATTRIBUTES 1 diff --git a/externals/grill/xsample/source/record.cpp b/externals/grill/xsample/source/record.cpp index 2f16a746..51fd56fc 100644 --- a/externals/grill/xsample/source/record.cpp +++ b/externals/grill/xsample/source/record.cpp @@ -51,7 +51,8 @@ protected: BL sigmode,appmode; F drintv; - BL dorec,doloop,mixmode; + BL dorec,doloop; + I mixmode; L curpos; // in samples inline V outputmin() { ToOutFloat(1,curmin*s2u); } @@ -77,7 +78,7 @@ private: FLEXT_CALLBACK_F(m_max) FLEXT_ATTRVAR_B(doloop) - FLEXT_ATTRVAR_B(mixmode) + FLEXT_ATTRVAR_I(mixmode) FLEXT_ATTRVAR_B(sigmode) FLEXT_CALLSET_B(m_append) FLEXT_ATTRGET_B(appmode) @@ -108,7 +109,7 @@ V xrecord::setup(t_classid c) xrecord::xrecord(I argc,const t_atom *argv): dorec(false), - sigmode(false),mixmode(false), + sigmode(false),mixmode(0), appmode(true),doloop(false), drintv(0), inchns(1) @@ -291,7 +292,8 @@ TMPLDEF V xrecord::s_rec(I n,S *const *invecs,S *const *outvecs) if(appmode) { // append to current position - if(!mixmode) { + switch(mixmode) { + case 0: for(i = 0; i < ncur; ++i,++si) { if(*(on++) >= 0) { for(int ci = 0; ci < ICHNS; ++ci) @@ -302,8 +304,8 @@ TMPLDEF V xrecord::s_rec(I n,S *const *invecs,S *const *outvecs) else *(pos++) = p; } - } - else { + break; + case 1: for(i = 0; i < ncur; ++i,++si) { register const S g = *(on++); if(g >= 0) { @@ -315,11 +317,25 @@ TMPLDEF V xrecord::s_rec(I n,S *const *invecs,S *const *outvecs) else *(pos++) = p; } - } + break; + case 2: + for(i = 0; i < ncur; ++i,++si) { + if(*(on++) >= 0) { + for(int ci = 0; ci < ICHNS; ++ci) + bf[ci] += sig[ci][si]; + bf += BCHNS; + *(pos++) = p,p += pf,++o; + } + else + *(pos++) = p; + } + break; + } } else { // don't append - if(!mixmode) { + switch(mixmode) { + case 0: for(i = 0; i < ncur; ++i,++si) { if(*(on++) >= 0) { @@ -333,8 +349,8 @@ TMPLDEF V xrecord::s_rec(I n,S *const *invecs,S *const *outvecs) bf = buf->Data(); } } - } - else { + break; + case 1: for(i = 0; i < ncur; ++i,++si) { register const S g = *(on++); if(g >= 0) { @@ -348,6 +364,22 @@ TMPLDEF V xrecord::s_rec(I n,S *const *invecs,S *const *outvecs) bf = buf->Data(); } } + break; + case 2: + for(i = 0; i < ncur; ++i,++si) { + if(*(on++) >= 0) + { + for(int ci = 0; ci < ICHNS; ++ci) + bf[ci] += sig[ci][si]; + bf += BCHNS; + *(pos++) = p,p += pf,++o; + } + else { + *(pos++) = p = scale(o = 0); + bf = buf->Data(); + } + } + break; } } } @@ -355,22 +387,33 @@ TMPLDEF V xrecord::s_rec(I n,S *const *invecs,S *const *outvecs) // message mode // Altivec optimization for that! - if(!mixmode) { + switch(mixmode) { + case 0: for(int ci = 0; ci < ICHNS; ++ci) { register S *b = bf+ci; register const F *s = sig[ci]; for(i = 0; i < ncur; ++i,b += BCHNS,++s) *b = *s; } si += ncur; - } - else { + break; + case 1: for(i = 0; i < ncur; ++i,++si) { register const S w = *(on++); for(int ci = 0; ci < ICHNS; ++ci) bf[ci] = bf[ci]*(1.-w)+sig[ci][si]*w; bf += BCHNS; } + break; + case 2: + for(int ci = 0; ci < ICHNS; ++ci) { + register S *b = bf+ci; + register const F *s = sig[ci]; + for(i = 0; i < ncur; ++i,b += BCHNS,++s) *b += *s; + } + si += ncur; + break; } + for(i = 0; i < ncur; ++i) { *(pos++) = p,p += pf,++o; } @@ -442,7 +485,7 @@ V xrecord::m_help() post("\t@sigmode 0/1: specify message or signal triggered recording"); post("\t@append 0/1: reset recording position or append to current position"); post("\t@loop 0/1: switches looping off/on"); - post("\t@mixmode 0/1: specify if audio signal should be mixed in"); + post("\t@mixmode 0/1/2: specify how audio signal should be mixed in (none,mixed,added)"); post("\tmin {unit}: set minimum recording point"); post("\tmax {unit}: set maximum recording point"); post("\tall: select entire buffer length"); @@ -464,7 +507,7 @@ V xrecord::m_print() post("%s - current settings:",thisName()); post("bufname = '%s', length = %.3f, channels = %i",buf->Name(),(F)(buf->Frames()*s2u),buf->Channels()); post("in channels = %i, frames/unit = %.3f, scale mode = %s",inchns,(F)(1./s2u),sclmode_txt[sclmode]); - post("sigmode = %s, append = %s, loop = %s, mixmode = %s",sigmode?"yes":"no",appmode?"yes":"no",doloop?"yes":"no",mixmode?"yes":"no"); + post("sigmode = %s, append = %s, loop = %s, mixmode = %i",sigmode?"yes":"no",appmode?"yes":"no",doloop?"yes":"no",mixmode); post(""); } -- cgit v1.2.1