From 05b0020f4f12b35728a820be12e73f9da3625e6d Mon Sep 17 00:00:00 2001 From: Arnaud Blanchard <arnaud.blanchard@ensea.fr> Date: Fri, 12 May 2017 18:16:53 +0200 Subject: [PATCH] requestfilename as an option in i_asound. Improve description --- i_sndfile/i_sndfile.cpp | 8 +++++++- o_sndfile/o_sndfile.cpp | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/i_sndfile/i_sndfile.cpp b/i_sndfile/i_sndfile.cpp index f303bf0..d633213 100644 --- a/i_sndfile/i_sndfile.cpp +++ b/i_sndfile/i_sndfile.cpp @@ -16,13 +16,19 @@ int main(int argc, char**argv){ SNDFILE *sndfile; sf_count_t read_items_nb; + blc_program_set_description("Record blc_channel input in a sound file"); + blc_program_add_option(&filename, 'f', "file", "string", "filename of the file to write", NULL); blc_program_add_option(&output_name, 'o', "output", "string", "Channel containing the fast fourier transformation", DEFAULT_OUTPUT_NAME); blc_program_add_option(&period_str, 'p', "period", "integer", "Period between each sample in ms (0 as fast as possible)", "0"); blc_program_add_option(&length_str, 's', "size", "integer", "Sample size", "1024"); blc_program_add_option(&type_str, 't', "type", "INT8|FL32", "Type of the data.", "FL32"); - blc_program_add_parameter(&filename, "string", 1, "Filename containing the sound", NULL); blc_program_init(&argc, &argv, NULL); + if (filename==NULL){ + blc_program_args_display_help(); + EXIT_ON_ERROR("You need to specify a filename: -f<filename>"); + } + type=STRING_TO_UINT32(type_str); if (sscanf(length_str, "%ld", &length)!=1) EXIT_ON_ERROR("Reading size '%s'", length_str); if (sscanf(period_str, "%d", &period)!=1) EXIT_ON_ERROR("Reading period in '%s'", period_str); diff --git a/o_sndfile/o_sndfile.cpp b/o_sndfile/o_sndfile.cpp index 6dfee71..cc766c4 100644 --- a/o_sndfile/o_sndfile.cpp +++ b/o_sndfile/o_sndfile.cpp @@ -11,6 +11,7 @@ int main(int argc, char**argv){ SNDFILE *sndfile; sf_count_t write_items_nb; + blc_program_set_description("Load a sound file (no mp3) and put the result in the blc_channel"); blc_program_add_option(&filename, 'f', "file", "string", "filename of the file to write", NULL); blc_program_add_parameter(&input_name, "blc_channel-in", 1, "blc channel containing the sound", NULL); blc_program_init(&argc, &argv, NULL); -- GitLab