Move BufferPool::clear to MixHelpers and rewrite

* Move out of BufferPool because it's not related to memory allocation
* Rewrite because memset() is not portable because it sets all bytes to
  zero which depends on the platform's float representation of 0.0 to be
  all zero bytes
This commit is contained in:
Lukas W
2019-08-25 23:47:03 +02:00
parent 5349be6a63
commit d35df8ee7b
11 changed files with 40 additions and 38 deletions

View File

@@ -34,12 +34,5 @@ class LMMS_EXPORT BufferPool
public:
static void init( fpp_t framesPerPeriod );
static sampleFrame * acquire();
// audio-buffer-mgm
static void clear( sampleFrame * ab, const f_cnt_t frames,
const f_cnt_t offset = 0 );
#ifndef LMMS_DISABLE_SURROUND
static void clear( surroundSampleFrame * ab, const f_cnt_t frames,
const f_cnt_t offset = 0 );
#endif
static void release( sampleFrame * buf );
};

View File

@@ -37,6 +37,11 @@ bool useNaNHandler();
void setNaNHandler( bool use );
void clear(sampleFrame * src, int frames);
#ifndef LMMS_DISABLE_SURROUND
void clear(surroundSampleFrame * src, int frames);
#endif
bool sanitize( sampleFrame * src, int frames );
/*! \brief Add samples from src to dst */