fdNRTBase: Fix memory mismanagement (move data deallocation to after hand off with RT thread, in 'stage 4')

FdCompose: Add call to buffer cleanup per above
CMakeLists: Copy audio files from fluid decomp on configure
nix
Owen Green 7 years ago
parent 235cc09806
commit 004bd4f9fc

@ -41,6 +41,13 @@ if (NOT (EXISTS "${FLUID_ABS_PATH}/build/fluid_decomposition-exports.cmake"))
message(FATAL_ERROR "Can't find the fluid_decomposition CMake targets file at ${FLUID_ABS_PATH}/build/fluid_decomposition-expors.cmake. Please go to ${FLUID_ABS_PATH}/build and run CMake")
endif()
if (NOT (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/release-packaging/AudioFiles/))
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/release-packaging/AudioFiles/)
endif()
file(COPY ${FLUID_ABS_PATH}/AudioFiles/ DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/release-packaging/AudioFiles/)
include("${FLUID_ABS_PATH}/build/fluid_decomposition-exports.cmake")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/release-packaging/plugins")

@ -75,9 +75,20 @@ namespace sc{
*rtBuf = *mBuffer;
rtWorld->mSndBufUpdates[mBufnum].writes++;
}
void cleanUp()
{
if(mOldData)
boost::alignment::aligned_free(mOldData);
}
//No locks in (vanilla) SC, so no-ops for these
void acquire() override {}
void release() override {}
void acquire() override {
// NRTLock(mWorld);
}
void release() override {
// NRTUnlock(mWorld);
}
//Validity is based on whether this buffer is within the range the server knows about
bool valid() const override {
@ -121,11 +132,9 @@ namespace sc{
void resize(size_t frames, size_t channels, size_t rank) override {
SndBuf* thisThing = mBuffer;
float* oldData = thisThing->data;
mOldData = thisThing->data;
mRank = rank;
mWorld->ft->fBufAlloc(mBuffer, channels * rank, frames, thisThing->samplerate);
if(oldData)
boost::alignment::aligned_free(oldData);
}
protected:
bool equal(BufferAdaptor* rhs) const override
@ -138,6 +147,7 @@ namespace sc{
return false;
}
float* mOldData = 0;
long mBufnum;
World* mWorld;
size_t mRank = 1;

@ -50,7 +50,11 @@ namespace fluid {
return true;
}
bool postComplete(World* w) { return true; }
bool postComplete(World* w) {
static_cast<SCBufferView*>(mModel.dst)->cleanUp();
return true;
}
std::vector<parameter::Instance>& parameters()
{
return bufferCompose.getParams();

Loading…
Cancel
Save