From 26d637ca986b3d38941fd6f28fab5e715847614c Mon Sep 17 00:00:00 2001 From: Owen Green Date: Tue, 4 Sep 2018 15:44:23 +0100 Subject: [PATCH] fdNMF and fdNRTBase: Refactor for changed buffer adaptor interface and FFTSize default --- fdNMF/fdNMF.cpp | 2 +- include/fdNRTBase.hpp | 39 +++++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/fdNMF/fdNMF.cpp b/fdNMF/fdNMF.cpp index 9092952..ce68119 100644 --- a/fdNMF/fdNMF.cpp +++ b/fdNMF/fdNMF.cpp @@ -7,7 +7,7 @@ #include "data/FluidTensor.hpp" #include "clients/nrt/NMFClient.hpp" #include "clients/common/FluidParams.hpp" -#include "util/TupleUtils.hpp" + #include "SC_PlugIn.h" diff --git a/include/fdNRTBase.hpp b/include/fdNRTBase.hpp index e2cc2e5..73b6612 100644 --- a/include/fdNRTBase.hpp +++ b/include/fdNRTBase.hpp @@ -53,7 +53,7 @@ namespace sc{ SCBufferView(long bufnum,World* world): NRTBuf(world,bufnum), - BufferAdaptor({0,{static_cast(frames),static_cast(channels)}},NRTBuf::data), +// BufferAdaptor({0,{static_cast(frames),static_cast(channels)}},NRTBuf::data), mBufnum(bufnum), mWorld(world) {} @@ -74,6 +74,37 @@ namespace sc{ return (mBufnum >=0 && mBufnum < mWorld->mNumSndBufs); } + FluidTensorView samps(size_t channel, size_t rankIdx = 1) override + { + FluidTensorView v{this->data,0, static_cast(this->frames), static_cast(this->channels)}; + + return v.col(rankIdx + channel * (this->channels - 1)); + } + //Return a view of all the data + FluidTensorView samps() override + { + return {this->data,0, static_cast(this->frames), static_cast(this->channels)}; + } + + size_t numSamps() const override + { + if(valid()) + { + return this->frames; + } + return 0; + } + + size_t numChans() const override + { + if(valid()) + { + return this->channels; + } + return 0; + } + + void resize(size_t frames, size_t channels, size_t rank) override { SndBuf* thisThing = static_cast(this); @@ -82,9 +113,9 @@ namespace sc{ mWorld->ft->fBufAlloc(this, channels * rank, frames, this->samplerate); - FluidTensorView v= FluidTensorView(NRTBuf::data,0,static_cast(frames),static_cast(channels * rank)); - - static_cast&>(*this) = std::move(v); +// FluidTensorView v= FluidTensorView(NRTBuf::data,0,static_cast(frames),static_cast(channels * rank)); +// +// static_cast&>(*this) = std::move(v); if(oldData) boost::alignment::aligned_free(oldData);