Commit 9b3554b0 authored by thomas's avatar thomas
Browse files

64 bit fixes

git-svn-id: https://svn.grrrr.org/ext/trunk/flext@3735 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent 559e4a54
......@@ -140,7 +140,7 @@ int flext::buffer::Set(const t_symbol *s,bool nameonly)
#ifdef FLEXT_DEBUG
// post("flext: buffer object '%s' - valid:%i samples:%i channels:%i frames:%i",GetString(sym),p->b_valid,p->b_frames,p->b_nchans,p->b_frames);
#endif
Element *data1 = static_cast<Element *>(p->b_samples);
Element *data1 = reinterpret_cast<Element *>(p->b_samples);
if(data != data1) { data = data1; if(!ret) ret = 1; }
if(chns != p->b_nchans) { chns = p->b_nchans; if(!ret) ret = 1; }
if(frames != p->b_frames) { frames = p->b_frames; if(!ret) ret = 1; }
......@@ -188,7 +188,7 @@ bool flext::buffer::Update()
if(p) {
FLEXT_ASSERT(!NOGOOD(p) && ob_sym(p) == sym_buffer);
Element *data1 = static_cast<Element *>(p->b_samples);
Element *data1 = reinterpret_cast<Element *>(p->b_samples);
if(data != data1 || chns != p->b_nchans || frames != p->b_frames) {
data = data1;
chns = p->b_nchans;
......@@ -268,13 +268,13 @@ void flext::buffer::Frames(int fr,bool keep,bool zero)
::garray_resize(arr,(float)fr);
Update();
#elif FLEXT_SYS == FLEXT_SYS_MAX
t_sample *tmp = NULL;
Element *tmp = NULL;
int sz = frames;
if(fr < sz) sz = fr;
if(keep) {
// copy buffer data to tmp storage
tmp = (t_sample *)NewAligned(sz*sizeof(t_sample));
tmp = (Element *)NewAligned(sz*sizeof(Element));
FLEXT_ASSERT(tmp);
CopySamples(tmp,data,sz);
}
......
......@@ -220,6 +220,11 @@ public:
# define FLEXT_GETSAMPLE(x) (x)
# endif
#elif FLEXT_SYS == FLEXT_SYS_MAX
# define FLEXT_ARRAYTYPE t_sample
# define FLEXT_GETSAMPLE(x) (x)
#endif
class Element {
public:
Element() {}
......@@ -230,13 +235,6 @@ public:
FLEXT_ARRAYTYPE el;
};
#elif FLEXT_SYS == FLEXT_SYS_MAX
# define FLEXT_ARRAYTYPE t_sample
# define FLEXT_GETSAMPLE(x) (x)
typedef FLEXT_ARRAYTYPE Element;
#endif
/*! \brief Construct buffer.
\param s: symbol name, can be NULL
\param delayed = true: only sets name, needs another Set(NULL) to really initialize the buffer
......@@ -423,12 +421,15 @@ public:
static void CopyMem(void *dst,const void *src,int bytes);
//! Copy a sample array
static void CopySamples(t_sample *dst,const t_sample *src,int cnt);
static void CopySamples(buffer::Element *dst,const buffer::Element *src,int cnt) { CopyMem(dst,src,sizeof(*src)*cnt); }
//! Set a memory region
static void ZeroMem(void *dst,int bytes);
//! Set a sample array to a fixed value
static void SetSamples(t_sample *dst,int cnt,t_sample s);
static void SetSamples(buffer::Element *dst,int cnt,t_sample s) { for(int i = 0; i < cnt; ++i) dst[i] = s; }
//! Set a sample array to 0
static void ZeroSamples(t_sample *dst,int cnt) { SetSamples(dst,cnt,0); }
static void ZeroSamples(buffer::Element *dst,int cnt) { ZeroMem(dst,sizeof(*dst)*cnt); }
//! Get a 32 bit hash value from an atom
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment