aboutsummaryrefslogtreecommitdiff
path: root/externals/grill
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-11-19 03:37:40 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-11-19 03:37:40 +0000
commitd5c627a611f9b9801d40c3345446c789c9900c5d (patch)
treefab502304d9513eb56ef595255a1357912c69b28 /externals/grill
parent5aa36d82aa1122e4cda553006dd55cb3ac6afd79 (diff)
""
svn path=/trunk/; revision=1195
Diffstat (limited to 'externals/grill')
-rw-r--r--externals/grill/flext/flext.cwbin880367 -> 880367 bytes
-rw-r--r--externals/grill/flext/source/flsupport.cpp41
-rw-r--r--externals/grill/xsample/config-pd-msvc.txt3
-rw-r--r--externals/grill/xsample/makefile.pd-msvc2
-rw-r--r--externals/grill/xsample/source/record.cpp146
5 files changed, 95 insertions, 97 deletions
diff --git a/externals/grill/flext/flext.cw b/externals/grill/flext/flext.cw
index 5810f001..157b04d7 100644
--- a/externals/grill/flext/flext.cw
+++ b/externals/grill/flext/flext.cw
Binary files differ
diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp
index 7b30a2b8..f8c6fac2 100644
--- a/externals/grill/flext/source/flsupport.cpp
+++ b/externals/grill/flext/source/flsupport.cpp
@@ -74,6 +74,15 @@ void flext::Setup()
}
+#if defined(FLEXT_THREADED) && defined(FLEXT_PDLOCK)
+#define SYSLOCK() sys_lock()
+#define SYSUNLOCK() sys_unlock()
+#else
+#define SYSLOCK(on) (void)0
+#define SYSUNLOCK(on) (void)0
+#endif
+
+
/////////////////////////////////////////////////////////
// overloaded new/delete memory allocation methods
//
@@ -101,6 +110,7 @@ void *flext_root::operator new(size_t bytes)
void flext_root::operator delete(void *blk)
{
char *ori = (char *)blk-sizeof(size_t);
+
#if FLEXT_SYS == FLEXT_SYS_JMAX
fts_free(ori);
#else
@@ -114,11 +124,13 @@ void *flext_root::NewAligned(size_t bytes,int bitalign)
const size_t ovh = sizeof(size_t)+sizeof(char *);
const unsigned long alignovh = bitalign/8-1;
bytes += ovh+alignovh;
+
#if FLEXT_SYS == FLEXT_SYS_JMAX
char *blk = (char *)::fts_malloc(bytes);
#else
char *blk = (char *)::getbytes(bytes);
#endif
+
char *ablk = reinterpret_cast<char *>((reinterpret_cast<unsigned long>(blk)+ovh+alignovh) & ~alignovh);
*(char **)(ablk-sizeof(size_t)-sizeof(char *)) = blk;
*(size_t *)(ablk-sizeof(size_t)) = bytes;
@@ -184,46 +196,25 @@ int flext::Int2Bits(unsigned long n)
void flext_root::post(const char *fmt, ...)
{
-#ifdef FLEXT_THREADS
- static flext::ThrMutex mutex;
- mutex.Lock();
-#endif
va_list ap;
va_start(ap, fmt);
-#if FLEXT_SYS == FLEXT_SYS_MAX
+
char buf[1024]; // \TODO this is quite unsafe.....
vsprintf(buf, fmt, ap);
::post(buf);
-#else
- vfprintf(stderr, fmt, ap);
- ::post("");
-#endif
+
va_end(ap);
-#ifdef FLEXT_THREADS
- mutex.Unlock();
-#endif
}
void flext_root::error(const char *fmt,...)
{
-#ifdef FLEXT_THREADS
- static flext::ThrMutex mutex;
- mutex.Lock();
-#endif
va_list ap;
va_start(ap, fmt);
-#if FLEXT_SYS == FLEXT_SYS_MAX
+
char buf[1024]; // \TODO this is quite unsafe.....
STD::sprintf(buf,"error: ");
vsprintf(buf+7, fmt, ap);
::post(buf);
-#else
- fprintf(stderr, "error: ");
- vfprintf(stderr, fmt, ap);
- ::post("");
-#endif
+
va_end(ap);
-#ifdef FLEXT_THREADS
- mutex.Unlock();
-#endif
}
diff --git a/externals/grill/xsample/config-pd-msvc.txt b/externals/grill/xsample/config-pd-msvc.txt
index e69617a7..26aeb5ab 100644
--- a/externals/grill/xsample/config-pd-msvc.txt
+++ b/externals/grill/xsample/config-pd-msvc.txt
@@ -9,7 +9,8 @@ PDPATH=c:\programme\audio\pd
FLEXTPATH=$(PDPATH)\flext
# where is MS VC++?
-MSVCPATH=c:\programme\prog\microsoft visual studio\VC98
+# (not necessary if the build started with the compiler environment)
+# MSVCPATH=c:\programme\prog\microsoft visual studio\VC98
# where should the external be built?
OUTPATH=pd-msvc
diff --git a/externals/grill/xsample/makefile.pd-msvc b/externals/grill/xsample/makefile.pd-msvc
index 2f0ebc52..8b82928b 100644
--- a/externals/grill/xsample/makefile.pd-msvc
+++ b/externals/grill/xsample/makefile.pd-msvc
@@ -17,7 +17,7 @@ LIBS=pd.lib pthreadVC.lib flext-pdwin.lib
# compiler definitions and flags
DEFS=/DFLEXT_SYS=2
-CFLAGS=/GR- /GX- /GD /G6 /Ox /ML
+CFLAGS=/GR- /GX- /GD /G6 /Ox /EHsc /ML
# the rest can stay untouched
# ----------------------------------------------
diff --git a/externals/grill/xsample/source/record.cpp b/externals/grill/xsample/source/record.cpp
index 51fd56fc..cc9e074b 100644
--- a/externals/grill/xsample/source/record.cpp
+++ b/externals/grill/xsample/source/record.cpp
@@ -335,52 +335,55 @@ TMPLDEF V xrecord::s_rec(I n,S *const *invecs,S *const *outvecs)
else {
// don't append
switch(mixmode) {
- case 0:
- 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;
- case 1:
- for(i = 0; i < ncur; ++i,++si) {
- register const S g = *(on++);
- if(g >= 0) {
- for(int ci = 0; ci < ICHNS; ++ci)
- bf[ci] = bf[ci]*(1.-g)+sig[ci][si]*g;
- bf += BCHNS;
- *(pos++) = p,p += pf,++o;
- }
- else {
- *(pos++) = p = scale(o = 0);
- 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;
- }
+ case 0: {
+ 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;
+ }
+ case 1: {
+ for(i = 0; i < ncur; ++i,++si) {
+ register const S g = *(on++);
+ if(g >= 0) {
+ for(int ci = 0; ci < ICHNS; ++ci)
+ bf[ci] = bf[ci]*(1.-g)+sig[ci][si]*g;
+ bf += BCHNS;
+ *(pos++) = p,p += pf,++o;
+ }
+ else {
+ *(pos++) = p = scale(o = 0);
+ 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;
+ }
+ }
}
}
else {
@@ -388,30 +391,33 @@ TMPLDEF V xrecord::s_rec(I n,S *const *invecs,S *const *outvecs)
// Altivec optimization for that!
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;
- 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;
+ 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;
+ 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) {