* Fix failure to remember that we have constructed an interpolator
window already (#25). Also avoid using alloca for substantial buffers * Lose FFT::getFloatTimeBuffer and getDoubleTimeBuffer -- it's too unclear when it's safe to use them and it's safer to control sizes externally. In RB with smoothing on, these buffers were incorrectly being used for window-si zed calculations (larger than FFT-sized). * Fix some incorrect buffer resize sizes * Build fixes for OS/X
This commit is contained in:
@@ -69,7 +69,8 @@ void deallocate(T *ptr)
|
||||
if (ptr) free((void *)ptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Reallocate preserving contents but leaving additional memory uninitialised
|
||||
template <typename T>
|
||||
T *reallocate(T *ptr, size_t oldcount, size_t count)
|
||||
{
|
||||
@@ -86,7 +87,8 @@ T *reallocate(T *ptr, size_t oldcount, size_t count)
|
||||
if (ptr) deallocate<T>(ptr);
|
||||
return newptr;
|
||||
}
|
||||
|
||||
|
||||
/// Reallocate, zeroing all contents
|
||||
template <typename T>
|
||||
T *reallocate_and_zero(T *ptr, size_t oldcount, size_t count)
|
||||
{
|
||||
@@ -94,6 +96,15 @@ T *reallocate_and_zero(T *ptr, size_t oldcount, size_t count)
|
||||
v_zero(ptr, count);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/// Reallocate preserving contents and zeroing any additional memory
|
||||
template <typename T>
|
||||
T *reallocate_and_zero_extension(T *ptr, size_t oldcount, size_t count)
|
||||
{
|
||||
ptr = reallocate(ptr, oldcount, count);
|
||||
if (count > oldcount) v_zero(ptr + oldcount, count - oldcount);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T **allocate_channels(size_t channels, size_t count)
|
||||
|
||||
@@ -99,26 +99,26 @@ private:
|
||||
Mutex *m_mutex;
|
||||
};
|
||||
|
||||
/**
|
||||
The Condition class bundles a condition variable and mutex.
|
||||
|
||||
To wait on a condition, call lock(), test the termination condition
|
||||
if desired, then wait(). The condition will be unlocked during the
|
||||
wait and re-locked when wait() returns (which will happen when the
|
||||
condition is signalled or the timer times out).
|
||||
|
||||
To signal a condition, call signal(). If the condition is signalled
|
||||
between lock() and wait(), the signal may be missed by the waiting
|
||||
thread. To avoid this, the signalling thread should also lock the
|
||||
condition before calling signal() and unlock it afterwards.
|
||||
*/
|
||||
|
||||
class Condition
|
||||
{
|
||||
public:
|
||||
Condition(std::string name);
|
||||
~Condition();
|
||||
|
||||
// The Condition class bundles a condition variable and mutex.
|
||||
|
||||
// To wait on a condition, call lock(), test the termination
|
||||
// condition if desired, then wait(). The condition will be
|
||||
// unlocked during the wait and re-locked when wait() returns
|
||||
// (which will happen when the condition is signalled or the timer
|
||||
// times out).
|
||||
|
||||
// To signal a condition, call signal(). If the condition is
|
||||
// signalled between lock() and wait(), the signal may be missed
|
||||
// by the waiting thread. To avoid this, the signalling thread
|
||||
// should also lock the condition before calling signal() and
|
||||
// unlock it afterwards.
|
||||
|
||||
void lock();
|
||||
void unlock();
|
||||
void wait(int us = 0);
|
||||
|
||||
Reference in New Issue
Block a user