Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skeleton of voiceallocator, to troubleshoot multi control in management #229

Closed
wants to merge 11 commits into from
Prev Previous commit
Next Next commit
clang'd
  • Loading branch information
tremblap committed Feb 27, 2023
commit 51376a44cac9975372f6fc53ad8468c0c2979be4
42 changes: 23 additions & 19 deletions include/clients/rt/VoiceAllocator.hpp
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ under the European Union’s Horizon 2020 research and innovation programme
#include "../common/ParameterConstraints.hpp"
#include "../common/ParameterSet.hpp"
#include "../common/ParameterTypes.hpp"
//#include "../../algorithms/public/RunningStats.hpp"
// #include "../../algorithms/public/RunningStats.hpp"
#include "../../data/TensorTypes.hpp"

namespace fluid {
@@ -26,10 +26,13 @@ namespace voiceallocator {
template <typename T>
using HostVector = FluidTensorView<T, 1>;

constexpr auto VoiceAllocatorParams =
defineParameters(LongParam("history", "History Size", 2, Min(2))); //will be most probably a max num voice and all other params
constexpr auto VoiceAllocatorParams = defineParameters(LongParam(
"history", "History Size", 2,
Min(2))); // will be most probably a max num voice and all other params

class VoiceAllocatorClient : public FluidBaseClient, public ControlIn, ControlOut
class VoiceAllocatorClient : public FluidBaseClient,
public ControlIn,
ControlOut
{
public:
using ParamDescType = decltype(VoiceAllocatorParams);
@@ -50,7 +53,7 @@ class VoiceAllocatorClient : public FluidBaseClient, public ControlIn, ControlOu
return VoiceAllocatorParams;
}

VoiceAllocatorClient(ParamSetViewType& p, FluidContext&)
VoiceAllocatorClient(ParamSetViewType& p, FluidContext&)
: mParams(p), mInputSize{0}, mSizeTracker{0}
{
controlChannelsIn(3);
@@ -63,25 +66,25 @@ class VoiceAllocatorClient : public FluidBaseClient, public ControlIn, ControlOu
void process(std::vector<HostVector<T>>& input,
std::vector<HostVector<T>>& output, FluidContext&)
{
bool inputSizeChanged = mInputSize != input[0].size() ;

bool inputSizeChanged = mInputSize != input[0].size();
bool sizeParamChanged = mSizeTracker.changed(get<0>());

if(inputSizeChanged|| sizeParamChanged)
if (inputSizeChanged || sizeParamChanged)
{
mInputSize = input[0].size();
// mAlgorithm.init(get<0>(),mInputSize);
// mAlgorithm.init(get<0>(),mInputSize);
}

// mAlgorithm.process(input[0],output[0],output[1]);
output[2] <<= input[2];
output[1] <<= input[1];
output[0] <<= input[0];
// mAlgorithm.process(input[0],output[0],output[1]);
output[2] <<= input[2];
output[1] <<= input[1];
output[0] <<= input[0];
}

MessageResult<void> clear()
{
// mAlgorithm.init(get<0>(),mInputSize);
{
// mAlgorithm.init(get<0>(),mInputSize);
return {};
}

@@ -93,14 +96,15 @@ class VoiceAllocatorClient : public FluidBaseClient, public ControlIn, ControlOu
index latency() { return 0; }

private:
// algorithm::RunningStats mAlgorithm;
index mInputSize;
// algorithm::RunningStats mAlgorithm;
index mInputSize;
ParameterTrackChanges<index> mSizeTracker;
};

} // namespace runningstats
} // namespace voiceallocator

using VoiceAllocatorClient = ClientWrapper<voiceallocator::VoiceAllocatorClient>;
using VoiceAllocatorClient =
ClientWrapper<voiceallocator::VoiceAllocatorClient>;

} // namespace client
} // namespace fluid