Update DSP / Object / Memory to improve integer types

This commit is contained in:
Alex Harker
2019-06-16 17:18:57 +01:00
parent 3ecb810d5f
commit 831ee2f712
3 changed files with 14 additions and 11 deletions
+6 -6
View File
@@ -288,7 +288,7 @@ double *FrameLib_DSP::getOutput(unsigned long idx, unsigned long *size) const
{
if (mOutputs[0].mMemory && mOutputs[idx].mCurrentType == kFrameNormal)
{
*size = static_cast<unsigned long>(mOutputs[idx].mCurrentSize);
*size = mOutputs[idx].mCurrentSize;
return (double *) mOutputs[idx].mMemory;
}
@@ -432,7 +432,7 @@ void FrameLib_DSP::dependenciesReady()
{
if (scheduleInfo.mNewFrame || mOutputDone)
{
setOutputDependencyCount();
resetOutputDependencyCount();
mFrameTime = mValidTime;
}
@@ -470,7 +470,7 @@ void FrameLib_DSP::dependenciesReady()
{
mFrameTime = prevValidTime;
process();
setOutputDependencyCount();
resetOutputDependencyCount();
if (mInputDependencies.size() == 1)
(*mInputDependencies.begin())->releaseOutputMemory();
}
@@ -513,7 +513,7 @@ void FrameLib_DSP::dependenciesReady()
// Update dependency count for outputs and updating input state starting
mDependencyCount += ((timeUpdated ? mOutputDependencies.size() : 0)) + ((mUpdatingInputs > prevUpdatingInputs) ? 1 : 0);
mDependencyCount += ((timeUpdated ? getNumOuputDependencies() : 0)) + ((mUpdatingInputs > prevUpdatingInputs) ? 1 : 0);
// Notify input dependencies that can be released as they are up to date (releasing memory where relevant for objects with more than one input dependency)
@@ -556,9 +556,9 @@ void FrameLib_DSP::dependenciesReady()
assert(mFrameTime <= mInputTime && "Output is ahead of input dependencies");
}
void FrameLib_DSP::setOutputDependencyCount()
void FrameLib_DSP::resetOutputDependencyCount()
{
mOutputMemoryCount = static_cast<long>(mOutputDependencies.size());
mOutputMemoryCount = getNumOuputDependencies();
}
// Manage Output Memory
+4 -3
View File
@@ -106,8 +106,8 @@ private:
FrameType mCurrentType;
FrameType mRequestedType;
size_t mCurrentSize;
size_t mRequestedSize;
unsigned long mCurrentSize;
unsigned long mRequestedSize;
size_t mPointerOffset;
};
@@ -289,8 +289,9 @@ private:
inline void dependencyNotify(bool releaseMemory, bool fromInput);
void dependenciesReady();
void setOutputDependencyCount();
void incrementInputDependency();
void resetOutputDependencyCount();
long getNumOuputDependencies() { return static_cast<long>(mOutputDependencies.size()); }
// Connections
+4 -2
View File
@@ -411,12 +411,14 @@ protected:
// Memory Allocation
template <class U> U *alloc(unsigned long N)
template <class U>
U *alloc(size_t N)
{
return reinterpret_cast<U *>(mAllocator->alloc(sizeof(U) * N));
}
template <class U> void dealloc(U *& ptr)
template <class U>
void dealloc(U *& ptr)
{
mAllocator->dealloc(ptr);
ptr = nullptr;