Skip to content

Commit

Permalink
start to change from boost program options back to plain options
Browse files Browse the repository at this point in the history
  • Loading branch information
gisogrimm committed Mar 11, 2024
1 parent 6fdb95e commit 0af7268
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 15 deletions.
4 changes: 2 additions & 2 deletions apps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ build/tascar_pdf build/tascar_pdf.o: EXTERNALS += $(GTKEXT)
build/tascar_pdf build/tascar_pdf.o: LDLIBS += -ltascargui `pkg-config --libs $(EXTERNALS)`
build/tascar_ambdecoder: LDLIBS += `pkg-config --libs gsl`
build/tascar_lslsl build/tascar_lsljacktime build/tascar_osc2lsl: LDLIBS+=-llsl
build/tascar_renderfile: LDLIBS += -lboost_program_options
build/tascar_renderir: LDLIBS += -lboost_program_options
#build/tascar_renderfile: LDLIBS += -lboost_program_options
#build/tascar_renderir: LDLIBS += -lboost_program_options

ifeq "$(COVERAGE)" "yes"
LDLIBS += -lgcov -lgmock_main
Expand Down
73 changes: 61 additions & 12 deletions apps/src/tascar_renderfile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,79 @@
* Version 3 along with TASCAR. If not, see <http://www.gnu.org/licenses/>.
*/

#include "cli.h"
#include "irrender.h"
#include "tascar_os.h"
#include <boost/program_options.hpp>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>

namespace po = boost::program_options;

int main(int argc, char** argv)
{
#ifndef TSCDEBUG
try {
#endif

po::options_description desc(
"tascar_renderfile [ options ] sessionfile\n\n"
"Render a TASCAR session into a sound file.\n\n"
"Allowed options:");
po::positional_options_description pd;
pd.add("sessionfile", 1);
desc.add_options()("help,h", "produce help message");
desc.add_options()("sessionfile", po::value<std::string>(),
"TASCAR session file name.");
// TSC configuration file:
std::string tscfile;
// Scene name (or empty to use first scene in session file):
std::string scene;
// input file name (pointing to an existing sound file):
std::string in_fname;
// output sound file name, will be created/overwritten:
std::string out_fname;
// start time of simulation:
double starttime = 0.0;
// sampling rate in case of no input file:
double srate = 44100;
// duration in case in no input file:
double duration = 0;
// flag to increment time on each cycle:
bool dynamic = true;
// fragment size, or -1 to use only a single fragment:
uint32_t fragsize = -1;
// minimum ISM order:
uint32_t ism_min = 0;
// maximum ISM order:
uint32_t ism_max = -1;
// print statistics
bool b_verbose = false;
// update channel map:
std::string schmap;
// parse options:
const char* options = "hi:s:";
struct option long_options[] = {{"help", 0, 0, 'h'},
{"inputfile", 1, 0, 'i'},
{"outputfile", 1, 0, 'o'},
{"scene", 1, 0, 's'},
{0, 0, 0, 0}};
int opt(0);
int option_index(0);
while((opt = getopt_long(argc, argv, options, long_options,
&option_index)) != -1) {
switch(opt) {
case 'h':
TASCAR::app_usage(
"tascar_renderfile", long_options, "sessionfile",
"Render a TASCAR session into a sound file.\n\nThe channel map is "
"a list of output channels (zero-base), or empty to use all.\n"
"Example: -m 0-5,8,12");
return 0;
case 'i':
in_fname = optarg;
break;
case 'o':
out_fname = optarg;
break;
}
}
if(optind < argc)
tscfile = argv[optind++];
if(url.size() == 0) {
TASCAR::app_usage("tascar_renderfile", long_options, "sessionfile",
"Render a TASCAR session into a sound file.\n\n");
return 1;
}
desc.add_options()("scene", po::value<std::string>(),
"Scene name, or empty to select first scene.");
desc.add_options()("inputfile,i", po::value<std::string>(),
Expand Down
2 changes: 1 addition & 1 deletion apps/src/tascar_renderir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "irrender.h"
#include "tascar_os.h"
#include <boost/program_options.hpp>
//#include <boost/program_options.hpp>
#include <stdlib.h>
#include <unistd.h>

Expand Down

0 comments on commit 0af7268

Please sign in to comment.