|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
/*
|
|
|
- * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
|
|
|
|
|
|
|
+ * Copyright (c) 1983-2023 Trevor Wishart and Composers Desktop Project Ltd
|
|
|
* http://www.trevorwishart.co.uk
|
|
* http://www.trevorwishart.co.uk
|
|
|
* http://www.composersdesktop.com
|
|
* http://www.composersdesktop.com
|
|
|
*
|
|
*
|
|
@@ -53,174 +53,174 @@ int is_converted_to_stereo = -1;
|
|
|
|
|
|
|
|
/* RWD N0v 2011: removed bad call to sndsetbuf, caused synth spectra to fail */
|
|
/* RWD N0v 2011: removed bad call to sndsetbuf, caused synth spectra to fail */
|
|
|
/* TODO: fix malloc of dz->ifd array - default is one channel, but this code tries to use two. */
|
|
/* TODO: fix malloc of dz->ifd array - default is one channel, but this code tries to use two. */
|
|
|
-
|
|
|
|
|
-/* RWD 22/02/2018 fixed output interleave (glitch on ch 2),
|
|
|
|
|
- replaced hamming with vonhann window in pvoc for clean frame transitions
|
|
|
|
|
- bumped version number
|
|
|
|
|
-*/
|
|
|
|
|
|
|
+
|
|
|
|
|
+/* RWD 22/02/2018 fixed output interleave (glitch on ch 2),
|
|
|
|
|
+ replaced hamming with vonhann window in pvoc for clean frame transitions
|
|
|
|
|
+ bumped version number
|
|
|
|
|
+*/
|
|
|
|
|
|
|
|
const char* cdp_version = "7.1.1";
|
|
const char* cdp_version = "7.1.1";
|
|
|
|
|
|
|
|
int main(int argc,char *argv[])
|
|
int main(int argc,char *argv[])
|
|
|
{
|
|
{
|
|
|
- int exit_status;
|
|
|
|
|
-// FILE *fp = NULL;
|
|
|
|
|
- dataptr dz = NULL;
|
|
|
|
|
- char **cmdline;
|
|
|
|
|
- int cmdlinecnt;
|
|
|
|
|
- aplptr ap;
|
|
|
|
|
- int *valid = NULL;
|
|
|
|
|
- int is_launched = FALSE;
|
|
|
|
|
- int validcnt;
|
|
|
|
|
-
|
|
|
|
|
- /* CHECK FOR SOUNDLOOM */
|
|
|
|
|
|
|
+ int exit_status;
|
|
|
|
|
+// FILE *fp = NULL;
|
|
|
|
|
+ dataptr dz = NULL;
|
|
|
|
|
+ char **cmdline;
|
|
|
|
|
+ int cmdlinecnt;
|
|
|
|
|
+// aplptr ap;
|
|
|
|
|
+ int *valid = NULL;
|
|
|
|
|
+ int is_launched = FALSE;
|
|
|
|
|
+ int validcnt;
|
|
|
|
|
+
|
|
|
|
|
+ /* CHECK FOR SOUNDLOOM */
|
|
|
//TW UPDATE
|
|
//TW UPDATE
|
|
|
- if((argc==2) && strcmp(argv[1],"--version")==0) {
|
|
|
|
|
- fprintf(stdout,"%s\n",cdp_version);
|
|
|
|
|
- fflush(stdout);
|
|
|
|
|
- return 0;
|
|
|
|
|
- }
|
|
|
|
|
- if((sloom = sound_loom_in_use(&argc,&argv)) > 1) {
|
|
|
|
|
- sloom = 0;
|
|
|
|
|
- sloombatch = 1;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(!sloom) {
|
|
|
|
|
- if((exit_status = allocate_and_initialise_validity_flags(&valid,&validcnt))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(sflinit("cdp")){
|
|
|
|
|
- sfperror("cdp: initialisation\n");
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /* SET UP THE PRINCIPLE DATASTRUCTURE */
|
|
|
|
|
- if((exit_status = establish_datastructure(&dz))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(!sloom) {
|
|
|
|
|
- /* INITIAL CHECK OF CMDLINE DATA */
|
|
|
|
|
- if((exit_status = make_initial_cmdline_check(&argc,&argv))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
- cmdline = argv; /* GET PRE_DATA, ALLOCATE THE APPLICATION, CHECK FOR EXTRA INFILES */
|
|
|
|
|
- cmdlinecnt = argc;
|
|
|
|
|
- if((exit_status = get_process_and_mode_from_cmdline(&cmdlinecnt,&cmdline,dz))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
- if((exit_status = setup_particular_application(dz))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
- if((exit_status = count_and_allocate_for_infiles(cmdlinecnt,cmdline,dz))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- if((exit_status = parse_tk_data(argc,argv,&cmdline,&cmdlinecnt,dz))<0) { /* includes setup_particular_application() */
|
|
|
|
|
- exit_status = print_messages_and_close_sndfiles(exit_status,is_launched,dz);/* and cmdlinelength check = sees extra-infiles */
|
|
|
|
|
- return(exit_status);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- ap = dz->application;
|
|
|
|
|
|
|
+ if((argc==2) && strcmp(argv[1],"--version")==0) {
|
|
|
|
|
+ fprintf(stdout,"%s\n",cdp_version);
|
|
|
|
|
+ fflush(stdout);
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ if((sloom = sound_loom_in_use(&argc,&argv)) > 1) {
|
|
|
|
|
+ sloom = 0;
|
|
|
|
|
+ sloombatch = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(!sloom) {
|
|
|
|
|
+ if((exit_status = allocate_and_initialise_validity_flags(&valid,&validcnt))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(sflinit("cdp")){
|
|
|
|
|
+ sfperror("cdp: initialisation\n");
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* SET UP THE PRINCIPLE DATASTRUCTURE */
|
|
|
|
|
+ if((exit_status = establish_datastructure(&dz))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(!sloom) {
|
|
|
|
|
+ /* INITIAL CHECK OF CMDLINE DATA */
|
|
|
|
|
+ if((exit_status = make_initial_cmdline_check(&argc,&argv))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+ cmdline = argv; /* GET PRE_DATA, ALLOCATE THE APPLICATION, CHECK FOR EXTRA INFILES */
|
|
|
|
|
+ cmdlinecnt = argc;
|
|
|
|
|
+ if((exit_status = get_process_and_mode_from_cmdline(&cmdlinecnt,&cmdline,dz))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+ if((exit_status = setup_particular_application(dz))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+ if((exit_status = count_and_allocate_for_infiles(cmdlinecnt,cmdline,dz))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if((exit_status = parse_tk_data(argc,argv,&cmdline,&cmdlinecnt,dz))<0) { /* includes setup_particular_application() */
|
|
|
|
|
+ exit_status = print_messages_and_close_sndfiles(exit_status,is_launched,dz);/* and cmdlinelength check = sees extra-infiles */
|
|
|
|
|
+ return(exit_status);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+// ap = dz->application;
|
|
|
|
|
|
|
|
/*********************************************************************************************************************
|
|
/*********************************************************************************************************************
|
|
|
- cmdline[0] 2 vals ACTIVE
|
|
|
|
|
-TK (infile) (more-infiles) (outfile) (flag val) (formantsqksrch) (special) params options variant-params flags
|
|
|
|
|
-CMDLINE (infile) (more-infiles) (outfile) (formants) (formantsqksrch) (special) params POSSIBLY POSSIBLY POSSIBLY
|
|
|
|
|
- 1 val
|
|
|
|
|
|
|
+ cmdline[0] 2 vals ACTIVE
|
|
|
|
|
+TK (infile) (more-infiles) (outfile) (flag val) (formantsqksrch) (special) params options variant-params flags
|
|
|
|
|
+CMDLINE (infile) (more-infiles) (outfile) (formants) (formantsqksrch) (special) params POSSIBLY POSSIBLY POSSIBLY
|
|
|
|
|
+ 1 val
|
|
|
*********************************************************************************************************************/
|
|
*********************************************************************************************************************/
|
|
|
|
|
|
|
|
- if((exit_status = setup_param_ranges_and_defaults(dz))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if((exit_status = setup_param_ranges_and_defaults(dz))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/*********************************************************************************************************************
|
|
/*********************************************************************************************************************
|
|
|
- cmdline[0] 2 vals ACTIVE
|
|
|
|
|
-TK (more-infiles) (outfile) (flag val) (formantsqksrch) (special) params options variant-params flags
|
|
|
|
|
-CMDLINE (more-infiles) (outfile) (formants) (formantsqksrch) (special) params POSSIBLY POSSIBLY POSSIBLY
|
|
|
|
|
- 1 val
|
|
|
|
|
|
|
+ cmdline[0] 2 vals ACTIVE
|
|
|
|
|
+TK (more-infiles) (outfile) (flag val) (formantsqksrch) (special) params options variant-params flags
|
|
|
|
|
+CMDLINE (more-infiles) (outfile) (formants) (formantsqksrch) (special) params POSSIBLY POSSIBLY POSSIBLY
|
|
|
|
|
+ 1 val
|
|
|
*********************************************************************************************************************/
|
|
*********************************************************************************************************************/
|
|
|
|
|
|
|
|
- if((exit_status = handle_extra_infiles(&cmdline,&cmdlinecnt,dz))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if((exit_status = handle_extra_infiles(&cmdline,&cmdlinecnt,dz))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/*********************************************************************************************************************
|
|
/*********************************************************************************************************************
|
|
|
- cmdline[0] 2 ACTIVE
|
|
|
|
|
-TK (outfile) (flag val) (formantsqksrch) (special) params options variant-params flags
|
|
|
|
|
-CMDLINE (outfile) (formants) (formantsqksrch) (special) params POSSIBLY POSSIBLY POSSIBLY
|
|
|
|
|
- 1
|
|
|
|
|
|
|
+ cmdline[0] 2 ACTIVE
|
|
|
|
|
+TK (outfile) (flag val) (formantsqksrch) (special) params options variant-params flags
|
|
|
|
|
+CMDLINE (outfile) (formants) (formantsqksrch) (special) params POSSIBLY POSSIBLY POSSIBLY
|
|
|
|
|
+ 1
|
|
|
*********************************************************************************************************************/
|
|
*********************************************************************************************************************/
|
|
|
|
|
|
|
|
- if((exit_status = handle_outfile(&cmdlinecnt,&cmdline,is_launched,dz))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if((exit_status = handle_outfile(&cmdlinecnt,&cmdline,is_launched,dz))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/****************************************************************************************
|
|
/****************************************************************************************
|
|
|
- cmdline[0] ACTIVE
|
|
|
|
|
-TK (flag val) (formantsqksrch) (special) params options variant-params flags
|
|
|
|
|
-CMDLINE (formants) (formantsqksrch) (special) params POSSIBLY POSSIBLY POSSIBLY
|
|
|
|
|
|
|
+ cmdline[0] ACTIVE
|
|
|
|
|
+TK (flag val) (formantsqksrch) (special) params options variant-params flags
|
|
|
|
|
+CMDLINE (formants) (formantsqksrch) (special) params POSSIBLY POSSIBLY POSSIBLY
|
|
|
*****************************************************************************************/
|
|
*****************************************************************************************/
|
|
|
|
|
|
|
|
- if((exit_status = handle_formants(&cmdlinecnt,&cmdline,dz))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
- if((exit_status = handle_formant_quiksearch(&cmdlinecnt,&cmdline,dz))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
- if((exit_status = handle_special_data(&cmdlinecnt,&cmdline,dz))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if((exit_status = handle_formants(&cmdlinecnt,&cmdline,dz))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+ if((exit_status = handle_formant_quiksearch(&cmdlinecnt,&cmdline,dz))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+ if((exit_status = handle_special_data(&cmdlinecnt,&cmdline,dz))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/****************************************************************************************
|
|
/****************************************************************************************
|
|
|
- cmdline[0]
|
|
|
|
|
-TK active_params options variant-params flags
|
|
|
|
|
-CMDLINE active_params POSSIBLY POSSIBLY POSSIBLY
|
|
|
|
|
|
|
+ cmdline[0]
|
|
|
|
|
+TK active_params options variant-params flags
|
|
|
|
|
+CMDLINE active_params POSSIBLY POSSIBLY POSSIBLY
|
|
|
*****************************************************************************************/
|
|
*****************************************************************************************/
|
|
|
|
|
|
|
|
- if((exit_status = read_parameters_and_flags(&cmdline,&cmdlinecnt,dz))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
- if((exit_status = check_param_validity_and_consistency(dz))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
- is_launched = TRUE;
|
|
|
|
|
- if((exit_status = allocate_large_buffers(dz))<0){
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
- if((exit_status = param_preprocess(dz))<0){
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
- if((exit_status = groucho_process_file(dz))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
- if((exit_status = complete_output(dz))<0) {
|
|
|
|
|
- print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
- return(FAILED);
|
|
|
|
|
- }
|
|
|
|
|
- exit_status = print_messages_and_close_sndfiles(FINISHED,is_launched,dz);
|
|
|
|
|
- /* RWD we MUST free all allocs */
|
|
|
|
|
- /*free(dz);*/
|
|
|
|
|
- superfree(dz);
|
|
|
|
|
- return(SUCCEEDED);
|
|
|
|
|
|
|
+ if((exit_status = read_parameters_and_flags(&cmdline,&cmdlinecnt,dz))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+ if((exit_status = check_param_validity_and_consistency(dz))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+ is_launched = TRUE;
|
|
|
|
|
+ if((exit_status = allocate_large_buffers(dz))<0){
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+ if((exit_status = param_preprocess(dz))<0){
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+ if((exit_status = groucho_process_file(dz))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+ if((exit_status = complete_output(dz))<0) {
|
|
|
|
|
+ print_messages_and_close_sndfiles(exit_status,is_launched,dz);
|
|
|
|
|
+ return(FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+ exit_status = print_messages_and_close_sndfiles(FINISHED,is_launched,dz);
|
|
|
|
|
+ /* RWD we MUST free all allocs */
|
|
|
|
|
+ /*free(dz);*/
|
|
|
|
|
+ superfree(dz);
|
|
|
|
|
+ return(SUCCEEDED);
|
|
|
}
|
|
}
|
|
|
|
|
|