diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2003-03-19 04:36:44 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2003-03-19 04:36:44 +0000 |
commit | 6a2cccf403ac6045d987eb771b5ac904a33b122a (patch) | |
tree | 7a53ad5250738c0258c59995a4312685fbcf6689 /externals/grill/flext/source/flbuf.cpp | |
parent | 6b266723cb82ec38bfc0a1681bddf42e0eac8096 (diff) |
""
svn path=/trunk/; revision=482
Diffstat (limited to 'externals/grill/flext/source/flbuf.cpp')
-rw-r--r-- | externals/grill/flext/source/flbuf.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/externals/grill/flext/source/flbuf.cpp b/externals/grill/flext/source/flbuf.cpp index 633f0d45..f7672b75 100644 --- a/externals/grill/flext/source/flbuf.cpp +++ b/externals/grill/flext/source/flbuf.cpp @@ -176,20 +176,21 @@ bool flext::buffer::Update() #endif } -void flext::buffer::Frames(int fr,bool keep) +void flext::buffer::Frames(int fr,bool keep,bool zero) { #if FLEXT_SYS == FLEXT_SYS_PD + // is this function guaranteed to keep memory and set rest to zero? ::garray_resize(arr,(float)fr); Update(); #elif FLEXT_SYS == FLEXT_SYS_MAX t_sample *tmp = NULL; - int sz = frames; + int sz = frames; if(fr < sz) sz = fr; if(keep) { // copy buffer data to tmp storage tmp = new t_sample[sz]; - if(tmp) + if(tmp) CopySamples(data,tmp,sz); else error("flext::buffer - not enough memory for keeping buffer~ contents"); @@ -210,7 +211,10 @@ void flext::buffer::Frames(int fr,bool keep) // copy data back CopySamples(tmp,data,sz); delete[] tmp; + if(zero && sz < fr) ZeroSamples(data+sz,fr-sz); } + else + if(zero) ZeroSamples(data,fr); #else #error #endif |