Skip to content

Commit

Permalink
Add a verbose state switch in the jack client
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfd authored and jpcima committed May 6, 2020
1 parent e2c0822 commit b808fa6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion clients/jack_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ static void done(int sig)
ABSL_FLAG(std::string, client_name, "sfizz", "Jack client name");
ABSL_FLAG(std::string, oversampling, "1x", "Internal oversampling factor (value values are x1, x2, x4, x8)");
ABSL_FLAG(uint32_t, preload_size, 8192, "Preloaded value");
ABSL_FLAG(bool, state, false, "Output the synth state in the jack loop");

int main(int argc, char** argv)
{
Expand All @@ -155,6 +156,7 @@ int main(int argc, char** argv)
const std::string clientName = absl::GetFlag(FLAGS_client_name);
const std::string oversampling = absl::GetFlag(FLAGS_oversampling);
const uint32_t preload_size = absl::GetFlag(FLAGS_preload_size);
const bool verboseState = absl::GetFlag(FLAGS_state);

std::cout << "Flags" << '\n';
std::cout << "- Client name: " << clientName << '\n';
Expand Down Expand Up @@ -261,11 +263,14 @@ int main(int argc, char** argv)
signal(SIGQUIT, done);

while (!shouldClose){
if (verboseState) {
std::cout << "Active voices: " << synth.getNumActiveVoices() << '\n';
#ifndef NDEBUG
std::cout << "Allocated buffers: " << synth.getAllocatedBuffers() << '\n';
std::cout << "Total size: " << synth.getAllocatedBytes() << '\n';
#endif
std::this_thread::sleep_for(std::chrono::seconds(2));
}
std::this_thread::sleep_for(std::chrono::seconds(1));
}

std::cout << "Closing..." << '\n';
Expand Down

0 comments on commit b808fa6

Please sign in to comment.