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

Progress output #2

Merged
merged 4 commits into from
Sep 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions include/FluidCLIWrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ under the European Union’s Horizon 2020 research and innovation programme
#include <clients/common/ParameterTypes.hpp>
#include <FluidVersion.hpp>
#include <cctype>
#include <chrono>
#include <iomanip>
#include <iostream>
#include <regex>
#include <string>
#include <thread>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -388,20 +390,45 @@ class CLIWrapper
params.constrainParameterValues();

// Create client after all parameters are set
FluidContext context;
// Create client after all parameters are set
ClientType client(params);
auto result = client.process(context);
Result result;

client.enqueue(params);
result = client.process();

double progress = 0.0; // Variable to store progress

while(result.ok())
{
ProcessState state = client.checkProgress(result);

if (state == ProcessState::kDone || state == ProcessState::kDoneStillProcessing) {
std::cout << '\n';
break;
}
if (state != ProcessState::kDone) {
double newProgress = client.progress();
if (newProgress - progress >=0.01)
{
std::cout << newProgress << '\r' << std::flush;

progress = newProgress;
}
using namespace std::chrono_literals;
std::this_thread::sleep_for(20ms);
continue;
}
}

if (!result.ok())
{
// Output error

std::cerr << result.message() << "\n";
}
else
{
// Write files

bool allowCSV = true;
params.template forEachParamType<BufferT, WriteFiles>(allowCSV);
}
Expand All @@ -412,3 +439,5 @@ class CLIWrapper

} // namespace client
} // namespace fluid


2 changes: 1 addition & 1 deletion src/fluid-ampgate/fluid-ampgate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<NRTAmpGateClient>::run(argc, argv);
return CLIWrapper<NRTThreadedAmpGateClient>::run(argc, argv);
}
2 changes: 1 addition & 1 deletion src/fluid-ampslice/fluid-ampslice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<NRTAmpSliceClient>::run(argc, argv);
return CLIWrapper<NRTThreadedAmpSliceClient>::run(argc, argv);
}
2 changes: 1 addition & 1 deletion src/fluid-hpss/fluid-hpss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<NRTHPSSClient>::run(argc, argv);
return CLIWrapper<NRTThreadedHPSSClient>::run(argc, argv);
}
2 changes: 1 addition & 1 deletion src/fluid-loudness/fluid-loudness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<NRTLoudnessClient>::run(argc, argv);
return CLIWrapper<NRTThreadedLoudnessClient>::run(argc, argv);
}
2 changes: 1 addition & 1 deletion src/fluid-melbands/fluid-melbands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<NRTMelBandsClient>::run(argc, argv);
return CLIWrapper<NRTThreadedMelBandsClient>::run(argc, argv);
}
2 changes: 1 addition & 1 deletion src/fluid-mfcc/fluid-mfcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<NRTMFCCClient>::run(argc, argv);
return CLIWrapper<NRTThreadedMFCCClient>::run(argc, argv);
}
2 changes: 1 addition & 1 deletion src/fluid-nmf/fluid-nmf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<NMFClient>::run(argc, argv);
return CLIWrapper<NRTThreadedNMFClient>::run(argc, argv);
}
2 changes: 1 addition & 1 deletion src/fluid-noveltyslice/fluid-noveltyslice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<NRTNoveltySliceClient>::run(argc, argv);
return CLIWrapper<NRTThreadingNoveltySliceClient>::run(argc, argv);
}
2 changes: 1 addition & 1 deletion src/fluid-onsetslice/fluid-onsetslice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<NRTOnsetSliceClient>::run(argc, argv);
return CLIWrapper<NRTThreadingOnsetSliceClient>::run(argc, argv);
}
2 changes: 1 addition & 1 deletion src/fluid-pitch/fluid-pitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<NRTPitchClient>::run(argc, argv);
return CLIWrapper<NRTThreadedPitchClient>::run(argc, argv);
}
2 changes: 1 addition & 1 deletion src/fluid-sines/fluid-sines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<NRTSinesClient>::run(argc, argv);
return CLIWrapper<NRTThreadedSinesClient>::run(argc, argv);
}
2 changes: 1 addition & 1 deletion src/fluid-spectralshape/fluid-spectralshape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<NRTSpectralShapeClient>::run(argc, argv);
return CLIWrapper<NRTThreadedSpectralShapeClient>::run(argc, argv);
}
2 changes: 1 addition & 1 deletion src/fluid-stats/fluid-stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<BufStatsClient>::run(argc, argv);
return CLIWrapper<NRTThreadedBufStatsClient>::run(argc, argv);
}
2 changes: 1 addition & 1 deletion src/fluid-transients/fluid-transients.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<NRTTransientsClient>::run(argc, argv);
return CLIWrapper<NRTThreadedTransientsClient>::run(argc, argv);
}
4 changes: 3 additions & 1 deletion src/fluid-transientslice/fluid-transientslice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ under the European Union’s Horizon 2020 research and innovation programme
int main(int argc, const char* argv[])
{
using namespace fluid::client;
return CLIWrapper<NRTTransientSliceClient>::run(argc, argv);
// return CLIWrapper<NRTTransientSliceClient>::run(argc, argv);
return CLIWrapper<NRTThreadedTransientSliceClient>::run(argc, argv);

}