This is from the old espeak RiscOS port that has been removed. If/when the espeak-ng program is ported to RiscOS, this will be done in a different, more maintainable way.master
@@ -1347,14 +1347,10 @@ static int attr_prosody_value(int param_type, const wchar_t *pw, int *value_out) | |||
} | |||
if ((tail[0] == 's') && (tail[1] == 't')) { | |||
#ifdef PLATFORM_RISCOS | |||
*value_out = 100; | |||
#else | |||
double x; | |||
// convert from semitones to a frequency percentage | |||
x = pow((double)2.0, (double)((value*sign)/12)) * 100; | |||
*value_out = (int)x; | |||
#endif | |||
return 2; // percentage | |||
} | |||
@@ -605,15 +605,11 @@ ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output_type, int buf_length | |||
// It seems that the wctype functions don't work until the locale has been set | |||
// to something other than the default "C". Then, not only Latin1 but also the | |||
// other characters give the correct results with iswalpha() etc. | |||
#ifdef PLATFORM_RISCOS | |||
setlocale(LC_CTYPE, "ISO8859-1"); | |||
#else | |||
if (setlocale(LC_CTYPE, "C.UTF-8") == NULL) { | |||
if (setlocale(LC_CTYPE, "UTF-8") == NULL) | |||
if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL) | |||
setlocale(LC_CTYPE, ""); | |||
} | |||
#endif | |||
init_path(path); | |||
if (options & espeakINITIALIZE_PATH_ONLY) |
@@ -33,12 +33,8 @@ | |||
#ifdef PLATFORM_WINDOWS | |||
#include "windows.h" | |||
#else | |||
#ifdef PLATFORM_RISCOS | |||
#include "kernel.h" | |||
#else | |||
#include "dirent.h" | |||
#endif | |||
#endif | |||
#include "speak_lib.h" | |||
#include "phoneme.h" | |||
@@ -396,11 +392,7 @@ void VoiceReset(int tone_only) | |||
speed.fast_settings[1] = 800; | |||
speed.fast_settings[2] = 175; | |||
#ifdef PLATFORM_RISCOS | |||
voice->roughness = 1; | |||
#else | |||
voice->roughness = 2; | |||
#endif | |||
InitBreath(); | |||
for (pk = 0; pk < N_PEAKS; pk++) { | |||
@@ -1438,48 +1430,6 @@ static void GetVoices(const char *path) | |||
int ftype; | |||
char fname[sizeof(path_home)+100]; | |||
#ifdef PLATFORM_RISCOS | |||
int len; | |||
int *type; | |||
char *p; | |||
_kernel_swi_regs regs; | |||
_kernel_oserror *error; | |||
char buf[80]; | |||
char directory2[sizeof(path_home)+100]; | |||
regs.r[0] = 10; | |||
regs.r[1] = (int)path; | |||
regs.r[2] = (int)buf; | |||
regs.r[3] = 1; | |||
regs.r[4] = 0; | |||
regs.r[5] = sizeof(buf); | |||
regs.r[6] = 0; | |||
while (regs.r[3] > 0) { | |||
error = _kernel_swi(0x0c+0x20000, ®s, ®s); // OS_GBPB 10, read directory entries | |||
if ((error != NULL) || (regs.r[3] == 0)) | |||
break; | |||
type = (int *)(&buf[16]); | |||
len = strlen(&buf[20]); | |||
sprintf(fname, "%s.%s", path, &buf[20]); | |||
if (*type == 2) { | |||
// a sub-directory | |||
GetVoices(fname); | |||
} else { | |||
// a regular line, add it to the voices list | |||
if ((f_voice = fopen(fname, "r")) == NULL) | |||
continue; | |||
// pass voice file name within the voices directory | |||
voice_data = ReadVoiceFile(f_voice, fname+len_path_voices, &buf[20]); | |||
fclose(f_voice); | |||
if (voice_data != NULL) | |||
voices_list[n_voices_list++] = voice_data; | |||
} | |||
} | |||
#else | |||
#ifdef PLATFORM_WINDOWS | |||
WIN32_FIND_DATAA FindFileData; | |||
HANDLE hFind = INVALID_HANDLE_VALUE; | |||
@@ -1552,7 +1502,6 @@ static void GetVoices(const char *path) | |||
} | |||
closedir(dir); | |||
#endif | |||
#endif | |||
} | |||
espeak_ERROR SetVoiceByName(const char *name) | |||
@@ -1640,15 +1589,6 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec) | |||
{ | |||
char path_voices[sizeof(path_home)+12]; | |||
#ifdef PLATFORM_RISCOS | |||
if (n_voices_list == 0) { | |||
sprintf(path_voices, "%s%cvoices", path_home, PATHSEP); | |||
len_path_voices = strlen(path_voices)+1; | |||
GetVoices(path_voices); | |||
voices_list[n_voices_list] = NULL; // voices list terminator | |||
} | |||
return (const espeak_VOICE **)voices_list; | |||
#else | |||
int ix; | |||
int j; | |||
espeak_VOICE *v; | |||
@@ -1682,7 +1622,6 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec) | |||
voices[j] = NULL; | |||
} | |||
return (const espeak_VOICE **)voices; | |||
#endif | |||
} | |||
ESPEAK_API espeak_VOICE *espeak_GetCurrentVoice(void) |
@@ -881,7 +881,6 @@ static void AdvanceParameters() | |||
} | |||
} | |||
#ifndef PLATFORM_RISCOS | |||
static double resonator(RESONATOR *r, double input) | |||
{ | |||
double x; | |||
@@ -917,11 +916,9 @@ static void setresonator(RESONATOR *rp, int freq, int bwidth, int init) | |||
rp->a = 1.0 - rp->b - rp->c; | |||
} | |||
#endif | |||
void InitBreath(void) | |||
{ | |||
#ifndef PLATFORM_RISCOS | |||
int ix; | |||
minus_pi_t = -PI / samplerate; | |||
@@ -929,12 +926,10 @@ void InitBreath(void) | |||
for (ix = 0; ix < N_PEAKS; ix++) | |||
setresonator(&rbreath[ix], 2000, 200, 1); | |||
#endif | |||
} | |||
static void SetBreath() | |||
{ | |||
#ifndef PLATFORM_RISCOS | |||
int pk; | |||
if (wvoice->breath[0] == 0) | |||
@@ -947,13 +942,11 @@ static void SetBreath() | |||
setresonator(&rbreath[pk], peaks[pk].freq >> 16, wvoice->breathw[pk], 0); | |||
} | |||
} | |||
#endif | |||
} | |||
static int ApplyBreath(void) | |||
{ | |||
int value = 0; | |||
#ifndef PLATFORM_RISCOS | |||
int noise; | |||
int ix; | |||
int amp; | |||
@@ -967,7 +960,6 @@ static int ApplyBreath(void) | |||
value += (int)resonator(&rbreath[ix], noise) * amp; | |||
} | |||
} | |||
#endif | |||
return value; | |||
} | |||
@@ -1138,10 +1130,8 @@ int Wavegen() | |||
if (voicing != 64) | |||
total = (total >> 6) * voicing; | |||
#ifndef PLATFORM_RISCOS | |||
if (wvoice->breath[0]) | |||
total += ApplyBreath(); | |||
#endif | |||
// mix with sampled wave if required | |||
z2 = 0; |
@@ -341,14 +341,10 @@ static int initialise(void) | |||
// It seems that the wctype functions don't work until the locale has been set | |||
// to something other than the default "C". Then, not only Latin1 but also the | |||
// other characters give the correct results with iswalpha() etc. | |||
#ifdef PLATFORM_RISCOS | |||
setlocale(LC_CTYPE, "ISO8859-1"); | |||
#else | |||
if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL) { | |||
if (setlocale(LC_CTYPE, "UTF-8") == NULL) | |||
setlocale(LC_CTYPE, ""); | |||
} | |||
#endif | |||
if ((result = LoadPhData(&srate)) != 1) { | |||
if (result == -1) { |