Skip to content

Commit

Permalink
static polymorphic API
Browse files Browse the repository at this point in the history
  • Loading branch information
kupix committed Apr 14, 2024
1 parent 1282b7d commit d12ff57
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bungee/CommandLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct Options :
{
std::vector<std::string> helpGroups;

Options(std::string program_name = "bungee", std::string help_string = std::string("Bungee audio speed and pitch changer\n\nVersion: ") + Bungee::Stretcher<Basic>::version() + "\n") :
Options(std::string program_name, std::string help_string) :
cxxopts::Options(program_name, help_string)
{
add_options() //
Expand Down
13 changes: 7 additions & 6 deletions cmd/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (C) 2024 Parabola Research Limited
// SPDX-License-Identifier: MPL-2.0

#include "bungee/../src/log2.h"
#include "bungee/Bungee.h"
#include "bungee/CommandLine.h"

Expand All @@ -11,15 +10,17 @@ int main(int argc, const char *argv[])

Request request{};

constexpr int log2SynthesisHop = 9;
#ifndef BUNGEE_IMPLEMENTATION
# define BUNGEE_IMPLEMENTATION Basic
#endif
#define XSTR(a) STR(a)
#define STR(A) #A
static const auto helpString = std::string("Bungee " XSTR(BUNGEE_IMPLEMENTATION)) + " audio speed and pitch changer\n\nVersion: " + Bungee::Stretcher<BUNGEE_IMPLEMENTATION>::version() + "\n";

CommandLine::Options options;
CommandLine::Options options{"<bungee-command>", helpString};
CommandLine::Parameters parameters{options, argc, argv, request};
CommandLine::Processor processor{parameters, request};

#ifndef BUNGEE_IMPLEMENTATION
# define BUNGEE_IMPLEMENTATION Basic
#endif
Bungee::Stretcher<BUNGEE_IMPLEMENTATION> stretcher(processor.sampleRates, processor.channelCount);

processor.restart(request);
Expand Down

0 comments on commit d12ff57

Please sign in to comment.