Commit 239032d2 authored by thomas's avatar thomas
Browse files

64-bit fixes

git-svn-id: https://svn.grrrr.org/ext/trunk/flext@3715 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent 9ba7a348
......@@ -101,7 +101,7 @@ int flext::buffer::Set(const t_symbol *s,bool nameonly)
else if(!nameonly) {
#if FLEXT_SYS == FLEXT_SYS_PD
int frames1;
t_sample *data1;
FLEXT_ARRAYTYPE *data1;
arr = (t_garray *)pd_findbyclass(const_cast<t_symbol *>(sym), garray_class);
if(!arr)
......@@ -110,7 +110,7 @@ int flext::buffer::Set(const t_symbol *s,bool nameonly)
// sym = NULL;
if(valid) ret = -1;
}
else if(!garray_getfloatarray(arr, &frames1, &data1))
else if(!FLEXT_ARRAYGRAB(arr, &frames1, &data1))
{
error("buffer: bad template '%s'",GetString(sym));
data = NULL;
......@@ -165,8 +165,8 @@ bool flext::buffer::Update()
if(!arr) return data == NULL;
int frames1;
t_sample *data1;
if(!garray_getfloatarray(arr, &frames1, &data1)) {
FLEXT_ARRAYTYPE *data1;
if(!FLEXT_ARRAYGRAB(arr, &frames1, &data1)) {
data = NULL;
chns = 0;
frames = 0;
......
......@@ -2,7 +2,7 @@
flext - C++ layer for Max/MSP and pd (pure data) externals
Copyright (c) 2001-2009 Thomas Grill (gr@grrrr.org)
Copyright (c) 2001-2010 Thomas Grill (gr@grrrr.org)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
......@@ -29,7 +29,7 @@ $LastChangedBy$
#define FLEXT_VERSION 502
//! \brief flext version string
#define FLEXT_VERSTR "0.5.2"
#define FLEXT_VERSTR "0.5.2 beta"
//! @}
......
......@@ -2,7 +2,7 @@
flext - C++ layer for Max/MSP and pd (pure data) externals
Copyright (c) 2001-2009 Thomas Grill (gr@grrrr.org)
Copyright (c) 2001-2010 Thomas Grill (gr@grrrr.org)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
......@@ -203,7 +203,27 @@ public:
#else
#error Not implemented
#endif
// PD 64-bit buffer handling macros
#if FLEXT_SYS == FLEXT_SYS_PD
# if PD_MINOR_VERSION >= 41
/* use new garray support that is 64-bit safe */
# define FLEXT_PD_ARRAYGRAB garray_getfloatwords
# define FLEXT_ARRAYTYPE t_word
# define FLEXT_GETELEMENT(arr,x) (arr)[x].w_float
# else
/* use old garray support, not 64-bit safe */
# define FLEXT_PD_ARRAYGRAB garray_getfloatarray
# define FLEXT_ARRAYTYPE t_sample
# define FLEXT_GETELEMENT(arr,x) (arr)[x]
# endif
#elif FLEXT_SYS == FLEXT_SYS_MAX
# define FLEXT_ARRAYTYPE t_sample
# define FLEXT_GETELEMENT(arr,x) (arr)[x]
#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
......@@ -287,7 +307,7 @@ public:
/*! \brief Get pointer to buffer, channel and frame count.
\remark Channels are interleaved
*/
t_sample *Data() { return data; }
FLEXT_ARRAYTYPE *Data() { return data; }
//! Get channel count
int Channels() const { return chns; }
......@@ -295,6 +315,12 @@ public:
int Frames() const { return frames; }
//! Set frame count
void Frames(int fr,bool keep = false,bool zero = true);
//! Get data value in a platform-independent way
inline t_sample operator [](int index) const { return FLEXT_GETELEMENT(data,index); }
//! Reference data value in a platform-independent way
inline t_sample &operator [](int index) { return FLEXT_GETELEMENT(data,index); }
//! Graphic auto refresh interval
void SetRefrIntv(float intv);
......@@ -314,7 +340,7 @@ public:
//! buffer name
const t_symbol *sym;
//! array holding audio data
t_sample *data;
FLEXT_ARRAYTYPE *data;
//! number of audio channels
int chns;
//! number of frames (multiplied by chns for the number of samples)
......
/*
flext tutorial - buffer 1
Copyright (c) 2003 Thomas Grill (xovo@gmx.net)
Copyright (c) 2003-2010 Thomas Grill (xovo@gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
......@@ -215,8 +215,9 @@ void buffer1::m_poke(int argc,const t_atom *argv)
ok = false;
if(ok) {
// correct syntax, set sample
buf->Data()[ix] = val;
// correct syntax, set sample and trigger display
(*buf)[ix] = val;
buf->Dirty(true);
}
else
post("%s (%s) - syntax error - use \"poke index value [channel]\"",thisName(),GetString(thisTag()));
......@@ -246,8 +247,8 @@ void buffer1::m_peek(int argc,const t_atom *argv)
ok = false;
if(ok)
// correct syntax, output value
ToOutFloat(0,buf->Data()[ix]);
// correct syntax, output value
ToOutFloat(0,(*buf)[ix]);
else
post("%s (%s) - syntax error - use \"peek index [channel]\"",thisName(),GetString(thisTag()));
}
......
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