diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bbe619..79bd49f 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/include/fdNRTBase.hpp b/include/fdNRTBase.hpp index 258adb1..7e55385 100644 --- a/include/fdNRTBase.hpp +++ b/include/fdNRTBase.hpp @@ -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; diff --git a/src/FluidBufCompose/FluidBufCompose.cpp b/src/FluidBufCompose/FluidBufCompose.cpp index dc9cb6e..997da3d 100644 --- a/src/FluidBufCompose/FluidBufCompose.cpp +++ b/src/FluidBufCompose/FluidBufCompose.cpp @@ -50,7 +50,11 @@ namespace fluid { return true; } - bool postComplete(World* w) { return true; } + bool postComplete(World* w) { + static_cast(mModel.dst)->cleanUp(); + return true; + } + std::vector& parameters() { return bufferCompose.getParams();