From 97926eb08cf74f277e522ffb8c7f985457822de3 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 11 Feb 2003 04:37:35 +0000 Subject: "" svn path=/trunk/; revision=388 --- externals/grill/flext/source/flbuf.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'externals/grill/flext/source/flbuf.cpp') diff --git a/externals/grill/flext/source/flbuf.cpp b/externals/grill/flext/source/flbuf.cpp index ebfe2abf..633f0d45 100644 --- a/externals/grill/flext/source/flbuf.cpp +++ b/externals/grill/flext/source/flbuf.cpp @@ -119,6 +119,24 @@ int flext::buffer::Set(const t_symbol *s,bool nameonly) return ret; } +bool flext::buffer::Valid() const +{ + if(sym) { +#if FLEXT_SYS == FLEXT_SYS_PD + int frames1; + t_sample *data1; + return garray_getfloatarray(arr, &frames1, &data1) != 0; +#elif FLEXT_SYS == FLEXT_SYS_MAX + const _buffer *p = (const _buffer *)sym->s_thing; + return p && p->b_valid; +#else +#error +#endif + } + else return false; +} + + bool flext::buffer::Update() { if(!Ok()) return false; @@ -172,7 +190,7 @@ void flext::buffer::Frames(int fr,bool keep) // copy buffer data to tmp storage tmp = new t_sample[sz]; if(tmp) - BlockMoveData(data,tmp,sizeof(t_sample)*sz); + CopySamples(data,tmp,sz); else error("flext::buffer - not enough memory for keeping buffer~ contents"); } @@ -190,7 +208,7 @@ void flext::buffer::Frames(int fr,bool keep) if(tmp) { // copy data back - BlockMoveData(tmp,data,sizeof(t_sample)*sz); + CopySamples(tmp,data,sz); delete[] tmp; } #else -- cgit v1.2.1