Fixes to Sound Icons (play WAV files for punctuation).

git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@107 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2007-11-21 10:27:32 +00:00
parent 5e73431fd9
commit 40c466b36e
5 changed files with 189 additions and 29 deletions
+10 -6
View File
@@ -529,18 +529,22 @@ static int LoadSoundFile(const char *fname, int index)
fname = fname2;
}
sprintf(fname_temp,"%s.wav",tmpnam(NULL));
sprintf(command,"sox \"%s\" -r %d -w %s polyphase\n",fname,samplerate,fname_temp);
if(system(command) < 0)
sprintf(command,"soxx \"%s\" -r %d -w %s polyphase\n",fname,samplerate,fname_temp);
if(system(command) != 0)
{
// resample has failed, use the original file
fprintf(stderr,"Failed to resample: %s\n",command);
return(2);
}
else
{
fname = fname_temp;
}
length = GetFileLength(fname_temp);
f = fopen(fname_temp,"rb");
length = GetFileLength(fname);
f = fopen(fname,"rb");
if(f == NULL)
{
fprintf(stderr,"Can't read temp file: %s",fname_temp);
fprintf(stderr,"Can't read temp file: %s",fname);
return(3);
}