Commit Graph
156 Commits
Author SHA1 Message Date
Samuel Thibault a660fc04cc Add more const qualifiers on static arrays
So we know they are just tables, get protected from overflows, and get shared between processes
2022-06-09 08:43:50 +02:00
Valdis Vitolins f56c7ea185 Merge pull request #1154 2022-04-13 22:43:06 +03:00
Samuel Thibault 15804e57a2 Constify tables
So they are protected from overflows, and shared between processes
2022-04-10 22:48:40 +02:00
Samuel Thibault 3ce135ac2b Mark re-used buffers as undefined
These are global arrays reused several times. When using them msan and
valgrind thus believe they are always initialized, which reduces their
capacity to detect uninitialized values. We can however explicitly tell them
when they are reused, and thus to be considered as uninitialized.
2022-04-10 22:42:51 +02:00
Samuel Thibault a34d74ed43 Make envelope computation more robust
When pollint() returns 100.0, multiplying by 2.55 doesn't actually seem to
be getting 255 on i386. Multiplying by 255 and dividing by 100, however,
does (probably because float computation with small integer values are
guaranteed to have integer results).

Fixes #1151
2022-04-10 22:12:28 +02:00
Valdis Vitolins 149c6b3d0d Merge pull request #1111 2022-03-16 21:34:08 +02:00
Samuel Thibault 51af5a4155 Add KlattFiniSP
speechPlayer_terminate was never called without calling
speechPlayer_initialize right after, so there would always be a FrameManager
laying behind.
2022-03-15 21:27:44 +01:00
Samuel Thibault 4dd1e04d8a Make polint use 0-based indexing
This avoids having to make LoadEnvelope2 pass &env_x[-1], which is very
strongly frowned upon by sanitizers such as usan.
2022-03-15 03:03:41 +01:00
Juho Hiltunen 0577cd90a6 code cleanup: remove unused variable markers_used 2022-01-03 21:14:18 +02:00
Juho Hiltunen dbcfa71f92 code cleanup: remove unused n_envelopes, N_ENVELOPES, envelope_paths and
envelope_dat.

envelope_dat and envelope_paths were only set but never used.
LoadEnvelope() and LoadEnvelope2() no longer need fname as an argument.
2022-01-02 21:21:35 +02:00
Juho Hiltunen 8fc69e2999 code cleanup: remove unnecessary temporary variable yy 2022-01-02 19:34:09 +02:00
John Bowler 18d807d680 Prevent compile-phonemes use of phontab, en_dict
espeak-ng --compile-phonemes generates phontab, but during the
generation it starts by reading the old phontab.  If works just fine,
apart from an error message, if this doesn't exist but if it does exist
it is not clear whether it might end up using old or bad data (e.g.
possibly crashing if phontab is corrupted making it very non-obvious how
to fix the problem...)

The same applies to en_dict as a result of espeak-ng defaulting to the
voice 'en'; again the phontab build works if en_dict is absent but a
spurious message is output.  It's not clear what would happen if someone
tried to build a reduced espeak-ng configuration with just one (non
'en') language.

The fix is to change espeak_ng_CompilePhonemeDataPath to call LoadVoice
with a new flag to indicate the voice structure is just required to
compile phoneme data (I changed the error message as well to make it
clear where it comes from - there are two identical error messages, the
other one is in voices.c)

Within LoadVoice the flag causes LoadVoice to not set a default language
or voicename and to skip loading the old phontab or dictionary (both of
which fail in a git clean -dfx build).

I checked the result by doing a compile from-scratch build sequence with
and without the patch, i.e. I did:

git clean -dfx
./autogen.sh
./configure --prefix=a-test-directory
make
make install

Then I compared the two copies of "a-test-directory" as well as the log
file output:

$ diff -r logs/*
diff -r logs/original/make.log logs/patched/make.log
175,176d174
< Unknown phoneme table: 'en'
< Can't read dictionary file:
'/home/jbowler/src/espeak-ng/master/espeak-ng-data/en_dict'

$ diff --no-dereference -r local.original local.patched
Binary files local.original/bin/speak-ng and local.patched/bin/speak-ng differ
Binary files local.original/lib/libespeak-ng.a and local.patched/lib/libespeak-ng.a differ
Binary files local.original/lib/libespeak-ng.so.1.1.51 and local.patched/lib/libespeak-ng.so.1.1.51 differ

So the change has not altered phontab or any of the other generated
files, only the binaries as would be expected.  (Note that I am
comparing truely clean builds; what you get if you download the source
and build from scratch.  This is the standard approach for people who
build for distribution.)

Signed-off-by: John Bowler <jbowler@acm.org>
2021-04-29 08:23:53 -07:00
Juho Hiltunen cffdfb837b code cleanup: move function declarations from speech.h to new file mnemonics.h
This adds a corresponding header file for mnemonics.c that was introduced in d5d93be.
2021-02-22 16:56:19 +02:00
freddii 61efed30fa fixed spelling mistakes 2021-01-13 01:55:34 +01:00
Juho Hiltunen ee944700f8 code cleanup: Check all local includes with include-what-you-use
Going through files in src/libespeak-ng/, include-what-you-use removed a
few unnecessary includes and included explanations on why a certain
header should be included. This makes tracking globals and dependencies easier.

Running the codebase through IWYU should be repeated after each major
code restIncludes to standard c library weren't checked to avoid
breaking builds with other platforms.

See https://github.com/include-what-you-use/include-what-you-use
2020-07-24 07:29:47 +03:00
BenTalagan 3e0150a34f Fixing ungetc bad behavior under macOS Catalina by avoiding to ungetc a different char from the last getc 2019-11-16 22:32:07 +01:00
Juho Hiltunen f4aec775cf compiledata.c: Fix -Wunused-result warning. 2018-05-01 19:02:21 +01:00
Reece H. Dunn 6d25013c94 CompileReport: Don't generate a report if there are no references. [msvc /analyze] 2018-03-27 12:59:51 +01:00
Reece H. Dunn d0410d8585 Include dictionary.h in the relevant source files to avoid implicit-function-declaration warnings. 2018-03-17 07:12:45 +00:00
Juho Hiltunen f00ff91fe4 headers: add new file wavegen.h with declarations of functions in wavegen.c 2018-03-11 11:27:56 +02:00
Juho Hiltunen 9012f3f0bf headers: continue with synthdata.h 2018-03-10 13:54:58 +02:00
Juho Hiltunen 706df97b20 headers: add new file readclause.h with declarations of functions in readclause.c 2018-03-10 07:18:07 +02:00
Juho Hiltunen 079d5a92c5 remove more unnecessary speech.h includes 2018-03-09 21:08:38 +02:00
Juho Hiltunen d1fd650219 Replace references to USHORT, DOUBLEX and UCHAR with unsigned short, double and unsigned char.
This makes the codebase more consistent. Including speech.h is not necessary anymore in some files. Includes have been removed.
2018-03-09 21:08:38 +02:00
Reece H. Dunn c49164334b Ensure each name in proc_names can fit an item_string [msvc /analyze]. 2018-03-07 12:50:58 +00:00
Reece H. Dunn 583a23f0cd Use ENV_LEN in the fwrite call in LoadEnvelope2 to be consistent with the rest of the function. 2018-03-07 12:36:58 +00:00
Juho Hiltunen 78749f14f8 readability fix: use boolean instead of 0 and 1 for loop control 2018-02-17 18:17:00 +02:00
Juho Hiltunen da287fb851 Unify terminology for stress
synthesize.h now contains the definitions STRESS_IS_... that should be used with code related to syllable stress.

Note that isBreak and other defines were renumbered so that stress definitions could have values 0-6.

Possible TODOs:
1. Unify with terms used with phonemes, i.e. keywords like isDiminished in compiledata.c and stress_type in phsource/phonemes
2. Add functionality and documentation about STRESS_IS_PRIORITY and STRESS_IS_EMPHASIZED
2018-01-14 15:26:03 +02:00
Reece H. Dunn 5e2c963006 Fix pronouncing words like 'newsletter'. Reverts 60a584c032. 2017-12-07 20:52:01 +00:00
Reece H. Dunn b5c415a98d Rename OPCODE_ to INSTN_. 2017-10-28 12:38:39 +01:00
Reece H. Dunn c59c9633de Fix -Wuninitialized warnings. 2017-10-11 22:01:41 +01:00
Reece H. Dunn b11480c09d compiledata.c: Fix -Wmissing-prototypes warnings. 2017-10-11 07:56:22 +01:00
Reece H. Dunn 68724badf3 encoding.c: Fix -Wmissing-prototypes warnings. 2017-10-11 07:41:31 +01:00
Reece H. Dunn 74f9f5e34b wavegen.c: Fix -Wmissing-prototypes warnings. 2017-10-10 21:37:46 +01:00
Reece H. Dunn d89fa59bed Enable and fix -Wunused-variable warnings. 2017-10-05 07:23:17 +01:00
Reece H. Dunn 57108e1ed7 Add n_points guards in the LoadEnvelope2 loop.
Clang static analysis reports these as 'Result of operation is
garbage or undefined' errors.
2017-09-13 07:28:58 +01:00
Reece H. Dunn 4a882e21d3 Don't update env_x/y if no points were read.
Clang static analysis reports an 'Assigned value is garbage or
undefined' for this. If no points were read from the file, the
`n_points` variable is 0 and `env_x[n_points-1]` performs an
out-of-bounds access.
2017-09-13 07:13:29 +01:00
Reece H. Dunn 19b2bebc02 Don't save an intonation if it was not found.
Clang static analysis reports an 'Assigned value is garbage or
undefined' error. This happens if the default_tune data has not
been copied in the kTUNE case.

Extending this further, it does not make sense to save the tune
data if the tune was not found, or if the tune already exists.
2017-09-13 07:03:18 +01:00
Reece H. Dunn 51c8a2d7d9 Rename the isVel check to isVelar. 2017-03-02 06:41:51 +00:00
Reece H. Dunn 901bc0d1ba Allow 'apr liquid' to be used together in a phoneme. 2017-01-30 20:27:10 +00:00
Reece H. Dunn 9448834298 Use '_' to indicate no parent phoneme table in the 'phonemetable' command. 2017-01-30 19:14:00 +00:00
Reece H. Dunn 574ecbd634 Inline the InstnPlusPhoneme function. 2017-01-29 10:53:33 +00:00
Reece H. Dunn e7374059e5 Use the stress condition values with i_CHANGE_IF. 2017-01-29 10:43:02 +00:00
Reece H. Dunn f2bb482782 Use OPCODE for the RETURN and CONTINUE opcodes. 2017-01-29 10:29:48 +00:00
Reece H. Dunn 8338cdd250 Better document the other condition checks (isDiminished, etc.). 2017-01-29 10:09:16 +00:00
Reece H. Dunn 5d2e2a2f8f Use the place of articulation constants to specify the place-based conditions. 2017-01-29 00:29:17 +00:00
Reece H. Dunn f0d4a98b96 Use an explicit is phoneme type constant to specify the type-based conditions. 2017-01-29 00:09:54 +00:00
Reece H. Dunn 98703c30de Use the phflag bit offset constants to specify the phflag-based conditions. 2017-01-29 00:04:44 +00:00
Reece H. Dunn 5600019a54 Remove unused conditional tests. 2017-01-28 21:16:08 +00:00
Reece H. Dunn 0415c46a8f Replace 'nonsyllabic' with 'nsy'. 2017-01-28 19:56:52 +00:00