From 2d6adefc562225ccb60036d33da4565c082b62b4 Mon Sep 17 00:00:00 2001 From: tth Date: Wed, 4 May 2022 13:51:44 +0200 Subject: [PATCH] cosmetic --- SoundBrotching/c-tools/support.c | 2 -- SoundBrotching/c-tools/text2wav.c | 14 +++++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/SoundBrotching/c-tools/support.c b/SoundBrotching/c-tools/support.c index 874b6df..5abefce 100644 --- a/SoundBrotching/c-tools/support.c +++ b/SoundBrotching/c-tools/support.c @@ -14,7 +14,6 @@ int display_sf_info(SF_INFO *psf, char *text) { fprintf(stderr, " +-- sf info [%s] %p\n", text, psf); - fprintf(stderr, " | samplerate %d\n", psf->samplerate); fprintf(stderr, " | channels %d\n", psf->channels); fprintf(stderr, " | frames %ld\n", psf->frames); @@ -23,7 +22,6 @@ fprintf(stderr, " | format 0x%x\n", psf->format); return 0; } /* --------------------------------------------------------------- */ - void print_version(char *msg) { fprintf(stderr, "=== %s compiled %s, %s\n", \ diff --git a/SoundBrotching/c-tools/text2wav.c b/SoundBrotching/c-tools/text2wav.c index 6dbd7c5..34508ea 100644 --- a/SoundBrotching/c-tools/text2wav.c +++ b/SoundBrotching/c-tools/text2wav.c @@ -16,9 +16,9 @@ /* * WARNING ! - * this function can read only 16bits stereo input + * this function write only 16bits stereo input */ -int convert_text_to_wav(FILE *input, char *outfname, int format) +int convert_text_to_wav(FILE *input, char *outf, int sr, int format) { SNDFILE * sndf; SF_INFO sfinfo; @@ -27,7 +27,7 @@ int left, right; int nb_lus, idx; #if DEBUG_LEVEL -fprintf(stderr, ">>> %s ( '%s' )\n", __func__, outfname); +fprintf(stderr, ">>> %s ( '%s' )\n", __func__, outf); #endif if (format) { @@ -45,13 +45,13 @@ if (NULL==(buffer=malloc(SMPL_COUNT * sizeof(short) * 2))) { } memset(&sfinfo, 0, sizeof(sfinfo)); /* be clean */ -sfinfo.samplerate = 44100; +sfinfo.samplerate = sr; sfinfo.channels = 2; sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16; -if ( ! (sndf=sf_open(outfname, SFM_WRITE, &sfinfo)) ) { +if ( ! (sndf=sf_open(outf, SFM_WRITE, &sfinfo)) ) { fprintf(stderr, "write to %s : err %s\n", - outfname, sf_strerror (NULL)); + outf, sf_strerror (NULL)); return -2; } @@ -94,7 +94,7 @@ if (2 != argc) { exit(1); } -foo = convert_text_to_wav(stdin, argv[1], 0); +foo = convert_text_to_wav(stdin, argv[1], 44100, 0); fprintf(stderr, "got a %d from text->wav converter\n", foo); return 0;