|
|
|
|
|
|
|
|
static espeak_ng_STATUS LoadSoundFile(const char *fname, int index, espeak_ng_ERROR_CONTEXT *context) |
|
|
static espeak_ng_STATUS LoadSoundFile(const char *fname, int index, espeak_ng_ERROR_CONTEXT *context) |
|
|
{ |
|
|
{ |
|
|
FILE *f; |
|
|
FILE *f; |
|
|
char *p; |
|
|
|
|
|
|
|
|
unsigned char *p; |
|
|
int length; |
|
|
int length; |
|
|
char fname_temp[100]; |
|
|
char fname_temp[100]; |
|
|
char fname2[sizeof(path_home)+13+40]; |
|
|
char fname2[sizeof(path_home)+13+40]; |
|
|
|
|
|
|
|
|
fclose(f); |
|
|
fclose(f); |
|
|
return create_file_error_context(context, error, fname); |
|
|
return create_file_error_context(context, error, fname); |
|
|
} |
|
|
} |
|
|
if ((p = (char *)realloc(soundicon_tab[index].data, length)) == NULL) { |
|
|
|
|
|
|
|
|
if ((p = realloc(soundicon_tab[index].data, length)) == NULL) { |
|
|
fclose(f); |
|
|
fclose(f); |
|
|
return ENOMEM; |
|
|
return ENOMEM; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
length = p[40] | (p[41] << 8) | (p[42] << 16) | (p[43] << 24); |
|
|
length = p[40] | (p[41] << 8) | (p[42] << 16) | (p[43] << 24); |
|
|
soundicon_tab[index].length = length / 2; // length in samples |
|
|
soundicon_tab[index].length = length / 2; // length in samples |
|
|
soundicon_tab[index].data = p; |
|
|
|
|
|
|
|
|
soundicon_tab[index].data = (char *) p; |
|
|
return ENS_OK; |
|
|
return ENS_OK; |
|
|
} |
|
|
} |
|
|
|
|
|
|