Esempio n. 1
0
int main(int argc, char** argv)
{
	int i;
	int res;
	int c;
	extern char* optarg;
	extern int optind;

	while ((c = getopt(argc, argv, "m:")) != -1)
	{
		switch (c)
		{
			case 'm':	/* version_marker */
				magic = optarg;
				break;
			case '?':
				usage();
		}
	}
	
	if (argc == optind)
	{
		usage();
	}
	magiclen = strlen(magic);
	res = 0;
	for (i=optind; i< argc; i++)
	{
		res |= fix_file(argv[i]);
	}

	return res;
Esempio n. 2
0
int
main (int argc, char *argv [])
{	SNDFILE *sndfile ;
	SF_INFO sfinfo ;
	int k, data_is_float, converted = 0 ;

	puts ("\nCooledit Fixer.\n---------------") ;

	if (argc < 2)
		usage_exit (argv [0]) ;

	for (k = 1 ; k < argc ; k++)
	{	if ((sndfile = sf_open (argv [k], SFM_READ, &sfinfo)) == NULL)
		{	/*-printf ("Failed to open : %s\n", argv [k]) ;-*/
			continue ;
			} ;

		if (sfinfo.format != (SF_FORMAT_WAV | SF_FORMAT_PCM_32))
		{	/*-printf ("%-50s : not a 32 bit PCM WAV file.\n", argv [k]) ;-*/
			sf_close (sndfile) ;
			continue ;
			} ;

		data_is_float = is_data_really_float (sndfile) ;

		sf_close (sndfile) ;

		if (data_is_float == SF_FALSE)
		{	/*-printf ("%-50s : not a Cooledit abomination.\n", argv [k]) ;-*/
			continue ;
			} ;

		fix_file (argv [k]) ;
		converted ++ ;
		} ;

	if (converted == 0)
		puts ("\nNo files converted.") ;

	puts ("") ;

	return 0 ;
} /* main */
Esempio n. 3
0
void start_new_file(struct wav_file_headers* wav_headers, 
		    unsigned int bytecounter, int sample_c) {

  char fname[FILEN_LENGTH];

  if(fd != NULL) {

    if(debug_level >= VERYVERBOSE)
      printf("Wrote %i bytes\n", bytecounter);

    if(! opts.pipe_enabled) // Don't seek if we're piping
      fix_file(bytecounter); 

    fclose(fd);

    if(opts.exec_enabled)
      exec_cmd();

  }

  build_output_filename(counter++, fname); // Potential buffer overflow

  if(debug_level >= VERBOSE) {
    if(opts.show_progress) clear_line();
    printf("New File: %s\n", fname);
  }

  if(opts.pipe_enabled)
    fd = popen(opts.pipe_cmd, "w");
  else
    fd = fopen(fname, "w");

  fp_write_headers(fd, wav_headers);


}