11/*
22Part of the Fluid Corpus Manipulation Project (http://www.flucoma.org/)
3- Copyright 2017-2019 University of Huddersfield.
3+ Copyright University of Huddersfield.
44Licensed under the BSD-3 License.
55See license.md file in the project root for full license information.
66This project has received funding from the European Research Council (ERC)
@@ -24,10 +24,10 @@ template <typename C>
2424class FluidSCWrapper : public impl ::FluidSCWrapperBase<C>
2525{
2626 using FloatControlsIter = impl::FloatControlsIter;
27-
28- // I would like to template these to something more scaleable, but baby steps
29- friend class impl ::RealTime<C,FluidSCWrapper>;
30- friend class impl ::NonRealTime<C,FluidSCWrapper>;
27+
28+ // I would like to template these to something more scaleable, but baby steps
29+ friend class impl ::RealTime<C, FluidSCWrapper>;
30+ friend class impl ::NonRealTime<C, FluidSCWrapper>;
3131
3232 static void doVersion (Unit*, sc_msg_iter*)
3333 {
@@ -38,12 +38,14 @@ class FluidSCWrapper : public impl::FluidSCWrapperBase<C>
3838 bool mInit {false };
3939
4040public:
41-
4241 template <size_t N, typename T>
43- using ArgumentSetter = typename ClientParams<FluidSCWrapper>::template Setter<sc_msg_iter, N, T>;
42+ using ArgumentSetter =
43+ typename ClientParams<FluidSCWrapper>::template Setter<sc_msg_iter, N, T>;
4444
4545 template <size_t N, typename T>
46- using ControlSetter = typename ClientParams<FluidSCWrapper>::template Setter<FloatControlsIter, N, T>;
46+ using ControlSetter =
47+ typename ClientParams<FluidSCWrapper>::template Setter<FloatControlsIter,
48+ N, T>;
4749
4850 using Client = C;
4951 using ParamSetType = typename C::ParamSetType;
@@ -66,73 +68,67 @@ class FluidSCWrapper : public impl::FluidSCWrapperBase<C>
6668 getInterfaceTable (ft);
6769 impl::FluidSCWrapperBase<Client>::setup (ft, name);
6870 ft->fDefineUnitCmd (name, " version" , doVersion);
69-
71+
7072 std::string commandName (" /" );
7173 commandName += getName ();
7274 commandName += " /version" ;
73- ft->fDefinePlugInCmd (commandName. c_str (),
74- [](World*, void *, sc_msg_iter*, void *){ doVersion ( nullptr , nullptr ); } ,
75- nullptr );
76-
75+ ft->fDefinePlugInCmd (
76+ commandName. c_str () ,
77+ [](World*, void *, sc_msg_iter*, void *) { doVersion ( nullptr , nullptr ); },
78+ nullptr );
7779 }
7880
7981 static auto & setParams (Unit* x, ParamSetType& p, FloatControlsIter& inputs,
8082 Allocator& alloc, bool constrain = false ,
8183 bool initialized = true )
8284 {
8385 bool verbose = x->mWorld ->mVerbosity > 0 ;
84-
86+
8587 using Reportage = decltype (static_cast <FluidSCWrapper*>(x)->mReportage );
86-
87- Reportage* reportage = initialized ? &(static_cast <FluidSCWrapper*>(x)->mReportage ) : new Reportage ();
88+
89+ Reportage* reportage = initialized
90+ ? &(static_cast <FluidSCWrapper*>(x)->mReportage )
91+ : new Reportage ();
8892
8993 p.template setParameterValuesRT <ControlSetter>(
9094 verbose ? reportage : nullptr , x, inputs, p, alloc);
9195 if (constrain) p.constrainParameterValuesRT (verbose ? reportage : nullptr );
92- if (verbose)
96+ if (verbose)
9397 {
94- for (auto & r: *reportage)
98+ for (auto & r : *reportage)
9599 {
96- if (!r.ok ()) printResult (x->mParent ->mNode .mWorld , r);
100+ if (!r.ok ()) printResult (x->mParent ->mNode .mWorld , r);
97101 }
98102 }
99- if (!initialized) delete reportage;
103+ if (!initialized) delete reportage;
100104 return p;
101105 }
102106
103- // static void printResult(SharedState<C>& x, Result& r)
104- // {
105- // if (!x.get() || !x->mNodeAlive) return;
106- // FluidSCWrapper::printResult(x->mNode->mWorld, r);
107- // }
108-
109- static void printResult (World* w,Result& r)
107+ static void printResult (World* w, Result& r)
110108 {
111-
109+
112110 switch (r.status ())
113111 {
114- case Result::Status::kWarning :
115- {
116- if (!w || w->mVerbosity > 0 )
117- std::cout << " WARNING: " << getName () << " - " << r.message ().c_str () << ' \n ' ;
118- break ;
119- }
120- case Result::Status::kError :
121- {
122- std::cout << " ERROR: " << getName () << " - " << r.message ().c_str () << ' \n ' ;
123- break ;
124- }
125- case Result::Status::kCancelled :
126- {
127- std::cout << getName () << " : Task cancelled\n " << ' \n ' ;
128- break ;
129- }
130- default :
131- {
132- }
133- }
112+ case Result::Status::kWarning : {
113+ if (!w || w->mVerbosity > 0 )
114+ std::cout << " WARNING: " << getName () << " - " << r.message ().c_str ()
115+ << ' \n ' ;
116+ break ;
117+ }
118+ case Result::Status::kError : {
119+ std::cout << " ERROR: " << getName () << " - " << r.message ().c_str ()
120+ << ' \n ' ;
121+ break ;
122+ }
123+ case Result::Status::kCancelled : {
124+ std::cout << getName () << " : Task cancelled\n " << ' \n ' ;
125+ break ;
126+ }
127+ default : {
128+ }
129+ }
134130 }
135-
131+
136132private:
137133 std::array<Result, Client::getParameterDescriptors().size()> mReportage ;
138134};
0 commit comments