Skip to content

Commit

Permalink
Enhance/max params (#93)
Browse files Browse the repository at this point in the history
* CMake: Centralise C++ version and set to 17

* Wrapper: handle new LongRuntimeMax param type

* POC for new LongRuntimeMax param with MFCC numCoeffs
  • Loading branch information
weefuzzy authored May 3, 2022
1 parent 82cd876 commit 167ea1c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

cmake_minimum_required(VERSION 3.11)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

################################################################################
# Paths
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/install" CACHE PATH "")
Expand All @@ -22,7 +26,6 @@ set(FLUID_PATH "" CACHE PATH "Optional path to the Fluid Decomposition repo")

if (APPLE)
set(CMAKE_XCODE_GENERATE_SCHEME ON)
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8" CACHE STRING "")
#A consequence of targetting 10.8. Needs to be set globally from 10.15 onwards in order for the test program to compile successfully during configure
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libc++")
Expand Down
12 changes: 11 additions & 1 deletion include/wrapper/ArgsFromClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ struct ParamReader<impl::FloatControlsIter>
auto id = fromArgs(x, args, index{}, 0);
return {id >= 0 ? std::to_string(id).c_str() : "" };
}

static auto fromArgs(Unit*,Controls& args,typename LongRuntimeMaxT::type&, int)
{
return typename LongRuntimeMaxT::type{static_cast<index>(args.next()), static_cast<index>(args.next())};
}

};

// NRT case: we're decoding data from sc_msg_iter*, there will be a World*, we can't have LocalBufs
Expand Down Expand Up @@ -285,6 +291,11 @@ struct ParamReader<sc_msg_iter>
return res;
}

static auto fromArgs(World*,sc_msg_iter& args,typename LongRuntimeMaxT::type&, int)
{
return typename LongRuntimeMaxT::type{args.geti(), args.geti()};
}

static auto fromArgs(World*, sc_msg_iter& args, typename ChoicesT::type, int)
{
int x = args.geti();
Expand All @@ -296,7 +307,6 @@ struct ParamReader<sc_msg_iter>
{
return Optional<T>{fromArgs(w,args,T{},int{})};
}

};


Expand Down
2 changes: 1 addition & 1 deletion include/wrapper/RealTimeBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ struct RealTimeBase

index outputSize = client.controlChannelsOut().size > 0
? std::max(client.audioChannelsOut(),
client.controlChannelsOut().size)
client.maxControlChannelsOut())
: unit.mSpecialIndex + 1;
mOutputs.reserve(asUnsigned(outputSize));

Expand Down
11 changes: 7 additions & 4 deletions release-packaging/Classes/FluidMFCC.sc
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
FluidMFCC : FluidRTMultiOutUGen {

*kr { arg in = 0, numCoeffs = 13, numBands = 40, startCoeff = 0, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, maxNumCoeffs = 13, maxFFTSize = 16384;
^this.multiNew('control', in.asAudioRateInput(this), numCoeffs, numBands, startCoeff, minFreq, maxFreq, maxNumCoeffs, windowSize, hopSize, fftSize, maxFFTSize);
*kr { arg in = 0, numCoeffs = 13, numBands = 40, startCoeff = 0, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, maxNumCoeffs = nil, maxFFTSize = 16384;

maxNumCoeffs = maxNumCoeffs ? numCoeffs;

^this.multiNew('control', in.asAudioRateInput(this), numCoeffs, maxNumCoeffs, numBands, startCoeff, minFreq, maxFreq, windowSize, hopSize, fftSize, maxFFTSize);
}


init {arg ...theInputs;
inputs = theInputs;
^this.initOutputs(inputs.at(6),rate);//this instantiate the number of output from the maxNumCoeffs in the multiNew order
^this.initOutputs(inputs.at(2),rate);//this instantiate the number of output from the maxNumCoeffs in the multiNew order
}

checkInputs {
// the checks of rates here are in the order of the kr method definition
if(inputs.at(6).rate != 'scalar') {
if(inputs.at(2).rate != 'scalar') {
^(": maxNumCoeffs cannot be modulated.");
};
if(inputs.at(10).rate != 'scalar') {
Expand Down
12 changes: 6 additions & 6 deletions scripts/target_post.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# under the European Union’s Horizon 2020 research and innovation programme
# (grant agreement No 725899).

target_compile_features(${PLUGIN} PRIVATE cxx_std_14)
# target_compile_features(${PLUGIN} PRIVATE cxx_std_14)

if(MSVC)
target_compile_options(${PLUGIN} PRIVATE /W3)
Expand All @@ -20,11 +20,11 @@ else()
endif()
endif()

set_target_properties(${PLUGIN} PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
# set_target_properties(${PLUGIN} PROPERTIES
# CXX_STANDARD 14
# CXX_STANDARD_REQUIRED YES
# CXX_EXTENSIONS NO
# )

if(APPLE)
set_target_properties(${PLUGIN} PROPERTIES
Expand Down

0 comments on commit 167ea1c

Please sign in to comment.