blc_program_set_description("Record blc_channel input in a sound file");
blc_program_add_option(&seek_pos_str,'b',"begin","integer","Sample to begin at in the file (i.e. sample at which we should begin reading the file)","0");
blc_program_add_option(&filename,'f',"file","string","filename of the file to write",NULL);
blc_program_add_option(&iterations_nb_str,'n',"number","integer","number of samples to acquire (-1 for infinity)","-1");
blc_program_add_option(&output_name,'o',"output","string","Channel where to put the sound",DEFAULT_OUTPUT_NAME);
...
...
@@ -26,34 +27,39 @@ int main(int argc, char**argv){
blc_program_add_option(&type_str,'t',"type","INT8|FL32","Type of the data.","FL32");
blc_program_init(&argc,&argv,blc_quit);
blc_command_forward_blc_channels();
SSCANF(1,samplerate_str,"%d",&samplerate);
if(filename==NULL){
blc_program_args_display_help();
EXIT_ON_ERROR("You need to specify a filename: -f<filename>");
blc_program_args_display_help();
EXIT_ON_ERROR("You need to specify a filename: -f<filename>");
// if (sfinfo.format!=samplerate) EXIT_ON_ERROR("The file has been recorded with a samplerate of '%d' and you request '%d'", sfinfo.samplerate, samplerate);
if(sf_seek(sndfile,length*seek_pos,SEEK_CUR)==-1)EXIT_ON_ERROR("Seeking position %i before start or after end of file. libsndfile: '%s'",length*seek_pos,sf_strerror(NULL));
color_eprintf(BLC_YELLOW,"%s: Iteration %llu: Missing data. Read '%lld' items instead of '%ld'. It is probably the end of the file\n",blc_program_name,blc_loop_iteration,read_items_nb,output.total_length);