Update of /cvsroot/pure-data/externals/grill/xsample/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8085/source
Modified Files:
groove.cpp main.cpp main.h
Log Message:
""
Index: groove.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/xsample/source/groove.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** groove.cpp 8 Feb 2004 03:40:47 -0000 1.23
--- groove.cpp 23 Mar 2004 03:27:37 -0000 1.24
***************
*** 40,44 ****
virtual V m_pos(F pos);
! V m_posmod(F pos);
virtual V m_all();
virtual V m_min(F mn);
--- 40,44 ----
virtual V m_pos(F pos);
! inline V m_posmod(F pos) { setposmod(pos?pos/s2u:0); } // motivated by Tim Blechmann
virtual V m_all();
virtual V m_min(F mn);
***************
*** 67,74 ****
F _xzone,xzone,xsymm;
! I znsmin,znsmax;
I xshape;
F xshparam;
! F znmin,znmax;
BL xkeep;
S **znbuf;
--- 67,74 ----
F _xzone,xzone,xsymm;
! L znsmin,znsmax;
I xshape;
F xshparam;
! D znmin,znmax;
BL xkeep;
S **znbuf;
***************
*** 79,83 ****
inline V outputmax() { ToOutFloat(outchns+2,curmax*s2u); }
! inline V setpos(F pos)
{
if(pos < znsmin) curpos = znsmin;
--- 79,83 ----
inline V outputmax() { ToOutFloat(outchns+2,curmax*s2u); }
! inline V setpos(D pos)
{
if(pos < znsmin) curpos = znsmin;
***************
*** 86,92 ****
}
! inline V setposmod(F pos)
{
! F p = pos-znsmin;
if(p >= 0) curpos = znsmin+fmod(p,znsmax-znsmin);
else curpos = znsmax+fmod(p,znsmax-znsmin);
--- 86,92 ----
}
! inline V setposmod(D pos)
{
! D p = pos-znsmin;
if(p >= 0) curpos = znsmin+fmod(p,znsmax-znsmin);
else curpos = znsmax+fmod(p,znsmax-znsmin);
***************
*** 219,223 ****
znbuf = new S *[outchns];
for(I i = 0; i < outchns; ++i) znbuf[i] = new S[0];
! znpos = new S[0]; // don't know vector size yet -> m_dsp
znidx = new S[0];
znmul = new S[XZONE_TABLE+1];
--- 219,223 ----
znbuf = new S *[outchns];
for(I i = 0; i < outchns; ++i) znbuf[i] = new S[0];
! znpos = new S[0]; // don't know vector size yet -> wait for m_dsp
znidx = new S[0];
znmul = new S[XZONE_TABLE+1];
***************
*** 249,255 ****
V xgroove::m_units(xs_unit mode)
{
! xsample::m_units(mode);
! m_sclmode();
outputmin();
outputmax();
--- 249,255 ----
V xgroove::m_units(xs_unit mode)
{
! xsample::m_units(mode); // calls bufchk()
! m_sclmode(); // calls bufchk() again.... \todo optimize that!!
outputmin();
outputmax();
***************
*** 277,286 ****
}
- // motivated by Tim Blechmann
- V xgroove::m_posmod(F pos)
- {
- setposmod(pos?pos/s2u:0);
- }
-
V xgroove::m_all()
{
--- 277,280 ----
***************
*** 390,394 ****
znmin = znsmin+xzone*xsymm,znmax = znsmax+xzone*(xsymm-1);
// extra space at beginning and end
! F o1 = znmin-xzone,o2 = buf->Frames()-(znmax+xzone);
if(o1 < 0 || o2 < 0) { // or (o1*o2 < 0)
--- 384,388 ----
znmin = znsmin+xzone*xsymm,znmax = znsmax+xzone*(xsymm-1);
// extra space at beginning and end
! D o1 = znmin-xzone,o2 = buf->Frames()-(znmax+xzone);
if(o1 < 0 || o2 < 0) { // or (o1*o2 < 0)
***************
*** 622,627 ****
BL lpbang = false;
! const F xz = xzone,lmin = znmin,lmax = znmax,lsh = lmax+xz-lmin;
! const F xf = (F)XZONE_TABLE/xz;
// adapt the playing bounds to the current cross-fade zone
--- 616,621 ----
BL lpbang = false;
! const F xz = xzone,xf = (F)XZONE_TABLE/xz;
! const D lmin = znmin,lmax = znmax,lsh = lmax+xz-lmin;
// adapt the playing bounds to the current cross-fade zone
***************
*** 658,662 ****
if(o < lmin) {
// in early cross-fade zone
! register F inp = xz-(lmin-o); // 0 <= inp < xz
znidx[i] = inp*xf;
znpos[i] = lmax+inp;
--- 652,656 ----
if(o < lmin) {
// in early cross-fade zone
! register F inp = xz-(F)(lmin-o); // 0 <= inp < xz
znidx[i] = inp*xf;
znpos[i] = lmax+inp;
Index: main.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/xsample/source/main.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** main.cpp 8 Feb 2004 03:40:47 -0000 1.15
--- main.cpp 23 Mar 2004 03:27:37 -0000 1.16
***************
*** 102,111 ****
BL xsample::m_refresh()
{
- // bufchk();
-
BL ret;
if(buf->Set()) { s_dsp(); ret = true; } // channel count may have changed
else ret = false;
m_min((F)curmin*s2u); // also checks pos
m_max((F)curmax*s2u); // also checks pos
--- 102,110 ----
BL xsample::m_refresh()
{
BL ret;
if(buf->Set()) { s_dsp(); ret = true; } // channel count may have changed
else ret = false;
+ // realize positions... 2 times bufchk()!!
m_min((F)curmin*s2u); // also checks pos
m_max((F)curmax*s2u); // also checks pos
***************
*** 116,125 ****
BL xsample::m_reset()
{
- // bufchk();
-
BL ret;
if(buf->Set()) { s_dsp(); ret = true; } // channel count may have changed
else ret = false;
m_units();
m_sclmode();
--- 115,123 ----
BL xsample::m_reset()
{
BL ret;
if(buf->Set()) { s_dsp(); ret = true; } // channel count may have changed
else ret = false;
+ // now... 4 times bufchk()!! \todo get rid of that
m_units();
m_sclmode();
***************
*** 137,183 ****
V xsample::m_units(xs_unit mode)
{
- if(!bufchk()) return; // if invalid do nothing (actually, it should be delayed)
-
if(mode != xsu__) unitmode = mode;
! switch(unitmode) {
! case xsu_sample: // samples
! s2u = 1;
! break;
! case xsu_buffer: // buffer size
! s2u = 1.f/buf->Frames();
! break;
! case xsu_ms: // ms
! s2u = 1000.f/Samplerate();
! break;
! case xsu_s: // s
! s2u = 1.f/Samplerate();
! break;
! default:
! post("%s: Unknown unit mode",thisName());
! }
}
V xsample::m_sclmode(xs_sclmd mode)
{
- if(!bufchk()) return; // if invalid do nothing (actually, it should be delayed)
-
if(mode != xss__) sclmode = mode;
! switch(sclmode) {
! case 0: // samples/units
! sclmin = 0; sclmul = s2u;
! break;
! case 1: // samples/units from recmin to recmax
! sclmin = curmin; sclmul = s2u;
! break;
! case 2: // unity between 0 and buffer size
! sclmin = 0; sclmul = buf->Frames()?1.f/buf->Frames():0;
! break;
! case 3: // unity between recmin and recmax
! // sclmin = curmin; sclmul = curlen?1.f/curlen:0;
! sclmin = curmin; sclmul = curmin != curmax?1.f/(curmax-curmin):0;
! break;
! default:
! post("%s: Unknown scale mode",thisName());
! }
}
--- 135,180 ----
V xsample::m_units(xs_unit mode)
{
if(mode != xsu__) unitmode = mode;
!
! if(bufchk())
! switch(unitmode) {
! case xsu_sample: // samples
! s2u = 1;
! break;
! case xsu_buffer: // buffer size
! s2u = 1.f/buf->Frames();
! break;
! case xsu_ms: // ms
! s2u = 1000.f/Samplerate();
! break;
! case xsu_s: // s
! s2u = 1.f/Samplerate();
! break;
! default:
! post("%s: Unknown unit mode",thisName());
! }
}
V xsample::m_sclmode(xs_sclmd mode)
{
if(mode != xss__) sclmode = mode;
!
! if(bufchk())
! switch(sclmode) {
! case 0: // samples/units
! sclmin = 0; sclmul = s2u;
! break;
! case 1: // samples/units from recmin to recmax
! sclmin = curmin; sclmul = s2u;
! break;
! case 2: // unity between 0 and buffer size
! sclmin = 0; sclmul = buf->Frames()?1.f/buf->Frames():0;
! break;
! case 3: // unity between recmin and recmax
! sclmin = curmin; sclmul = curmin != curmax?1.f/(curmax-curmin):0;
! break;
! default:
! post("%s: Unknown scale mode",thisName());
! }
}
***************
*** 190,194 ****
else if(mn > curmax) mn = (F)curmax;
curmin = (I)(mn+.5);
- // curlen = curmax-curmin;
m_sclmode();
--- 187,190 ----
***************
*** 203,207 ****
else if(mx < curmin) mx = (F)curmin;
curmax = (I)(mx+.5);
- // curlen = curmax-curmin;
m_sclmode();
--- 199,202 ----
***************
*** 212,216 ****
if(!bufchk()) return; // if invalid do nothing (actually, it should be delayed)
- // curlen = (curmax = buf->Frames())-(curmin = 0);
curmin = 0; curmax = buf->Frames();
m_sclmode();
--- 207,210 ----
Index: main.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/xsample/source/main.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** main.h 8 Feb 2004 03:40:47 -0000 1.26
--- main.h 23 Mar 2004 03:27:37 -0000 1.27
***************
*** 13,17 ****
! #define XSAMPLE_VERSION "0.3.0pre17"
--- 13,17 ----
! #define XSAMPLE_VERSION "0.3.0pre18"