cosmetic
This commit is contained in:
parent
cd486c5090
commit
2d6adefc56
@ -14,7 +14,6 @@ int display_sf_info(SF_INFO *psf, char *text)
|
|||||||
{
|
{
|
||||||
|
|
||||||
fprintf(stderr, " +-- sf info [%s] %p\n", text, psf);
|
fprintf(stderr, " +-- sf info [%s] %p\n", text, psf);
|
||||||
|
|
||||||
fprintf(stderr, " | samplerate %d\n", psf->samplerate);
|
fprintf(stderr, " | samplerate %d\n", psf->samplerate);
|
||||||
fprintf(stderr, " | channels %d\n", psf->channels);
|
fprintf(stderr, " | channels %d\n", psf->channels);
|
||||||
fprintf(stderr, " | frames %ld\n", psf->frames);
|
fprintf(stderr, " | frames %ld\n", psf->frames);
|
||||||
@ -23,7 +22,6 @@ fprintf(stderr, " | format 0x%x\n", psf->format);
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------- */
|
/* --------------------------------------------------------------- */
|
||||||
|
|
||||||
void print_version(char *msg)
|
void print_version(char *msg)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "=== %s compiled %s, %s\n", \
|
fprintf(stderr, "=== %s compiled %s, %s\n", \
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* WARNING !
|
* 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;
|
SNDFILE * sndf;
|
||||||
SF_INFO sfinfo;
|
SF_INFO sfinfo;
|
||||||
@ -27,7 +27,7 @@ int left, right;
|
|||||||
int nb_lus, idx;
|
int nb_lus, idx;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">>> %s ( '%s' )\n", __func__, outfname);
|
fprintf(stderr, ">>> %s ( '%s' )\n", __func__, outf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (format) {
|
if (format) {
|
||||||
@ -45,13 +45,13 @@ if (NULL==(buffer=malloc(SMPL_COUNT * sizeof(short) * 2))) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(&sfinfo, 0, sizeof(sfinfo)); /* be clean */
|
memset(&sfinfo, 0, sizeof(sfinfo)); /* be clean */
|
||||||
sfinfo.samplerate = 44100;
|
sfinfo.samplerate = sr;
|
||||||
sfinfo.channels = 2;
|
sfinfo.channels = 2;
|
||||||
sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
|
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",
|
fprintf(stderr, "write to %s : err %s\n",
|
||||||
outfname, sf_strerror (NULL));
|
outf, sf_strerror (NULL));
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ if (2 != argc) {
|
|||||||
exit(1);
|
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);
|
fprintf(stderr, "got a %d from text->wav converter\n", foo);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user