Commit Graph
100 Commits
Author SHA1 Message Date
Juho Hiltunen 6362245b24 code cleanup: combine two identical if-clauses 2022-11-20 19:27:31 +02:00
Juho Hiltunen e5f95289ad code cleanup: remove setting unread variable. 2022-11-20 19:15:19 +02:00
Juho Hiltunen 745ae078fb code cleanup: reduce variable scopes in compiledata.c 2022-11-20 19:00:53 +02:00
Juho Hiltunen bf6d99cb89 Merge branch 'duplicates' 2022-11-20 18:29:36 +02:00
Juho Hiltunen c496da5bf6 code cleanup: reduce duplication with new function CalculateSample() 2022-11-20 18:22:27 +02:00
Juho Hiltunen bbfef6a269 code cleanup: reduce duplication with new function DollarRule() 2022-11-20 17:31:27 +02:00
Juho Hiltunen 33df55bf12 code cleanup: next part (#1548)
Contribute to #68 

Reduce number of externs and static-returns
2022-11-19 20:44:56 +02:00
Juho Hiltunen b368302170 MerGe branch 'phonemelist_cleanup' 2022-11-19 12:07:58 +02:00
Juho Hiltunen 7c13683b68 code cleanup: reduce code duplication with ReInterpretPhoneme().
Found with pmd-cpd scanner. The new function could probably be named better.
2022-11-19 11:41:20 +02:00
Juho Hiltunen e8e5e06422 cleanup: remove redundant *next2 2022-11-19 11:41:20 +02:00
Juho Hiltunen 4cbe26b711 cleanup: refactor check for LOPT_REGRESSIVE_VOICING to SetRegressiveVoicing() 2022-11-19 11:41:20 +02:00
Juho Hiltunen 84609c27bd cleanup: reduce variable scopes in phonemelist.c 2022-11-19 11:34:08 +02:00
Juho Hiltunen c522d8790d code cleanup: use statics and consts when possible (#1544)
Contribute to #68
2022-11-19 11:11:14 +02:00
Juho Hiltunen 0f3fb42b62 code cleanup: reduce global externs (#1536)
Contribute to #68

Reduce count of globals / externs that could be a file-local static
variables
2022-11-16 06:33:32 +02:00
Juho Hiltunen 1b930c53f3 Allow <break> at the beginning of SSML (#1531)
Fixes #1232
2022-11-15 20:51:28 +02:00
Juho Hiltunen 7ed32edc63 code cleanup: localize compiledict static objects (#1534)
Contribute to #68

compiledict.c is clean from global state now

```bash
nm -C -l -fbsd src/libespeak-ng/la-compiledict.o | grep -E ' b | B '
```
2022-11-15 20:46:22 +02:00
Juho Hiltunen 4e7b0ddc75 code cleanup: localize compiledata static objects (#1532)
Contribute to #68

compiledata.c is clean from global state now

```bash
nm -C -l -fbsd src/libespeak-ng/la-compiledata.o | grep -E ' b | B '
```
2022-11-15 20:45:13 +02:00
Juho Hiltunen 29ff8f1753 Use deterministic random generator (#1530)
Fixes #1528 

Now, `klatt` and `breath`-enabled variants may be added to tests
2022-11-15 18:24:19 +02:00
Juho Hiltunen 38384e4a67 Fix non-SSML pauses with libsonic (#1526)
Following #1512 

Ref: espeak-ng/espeak-ng-ios-app#34

I unfortunately have broken in-speech pauses by fixing ones that should
be constant-time.
This reverts such change and adds a compensation to SSML code.
2022-11-12 10:06:50 +02:00
Juho Hiltunen 90273e6842 Spanish: fix pronunciation of "r" letter (#1517)
In Spanish the letter "r" in the alphabet is correctly pronounced as
"ERRe", instead of "Ere".
2022-11-09 20:20:42 +02:00
Juho Hiltunen 52e4811ab9 test for #1507 2022-11-08 00:01:01 +01:00
Juho Hiltunen 3a3787b855 cleanup: use bool instead of int for condition_failed 2022-11-07 21:08:25 +02:00
Juho Hiltunen 34fecbdd4f Belarusian: add rules for softening з, с / tests [ready to review] (#1500)
soft `з, с` if previous syllable is soft
add test for the new rules
2022-11-07 06:41:32 +02:00
Juho Hiltunen 6e7f3c4e98 Merge branch 'duplicates' 2022-11-05 21:22:50 +02:00
Juho Hiltunen c5fac3185c cleanup: join two adjacent if (only == false) blocks.
Note: The latter part is untested code.
2022-11-05 21:22:39 +02:00
Juho Hiltunen ca0019b197 cleanup: use bool in LookupCharName() 2022-11-05 21:22:39 +02:00
Juho Hiltunen acc43a76e4 cleanup: remove code duplication with UnGetC() 2022-11-05 21:22:39 +02:00
Juho Hiltunen 95e5c4458d cleanup: remove duplication with DecodeWithPhonemeMode().
TODO: think of a better function name.
2022-11-05 21:22:39 +02:00
Juho Hiltunen f53ebf469c cleanup: remove code duplication with TerminateBufWithSpaceAndZero().
One redundant ix++ was removed because there's a return right after that.
2022-11-05 21:22:39 +02:00
Juho Hiltunen abc10e67ae Belarusian: add voiced-devoiced rules and test [ready to review] (#1481)
- add voiced-devoiced rules and test
2022-11-05 17:31:14 +02:00
Juho Hiltunen b40a0f22c0 Fix breathw arg count in Alicia and F5 voices (#1496)
Fixes #1494
2022-11-03 20:21:08 +02:00
Juho Hiltunen 822abfd1f3 Fixes for Ukrainian language (#1480) 2022-11-01 22:13:32 +02:00
Juho Hiltunen b0661692b1 fix a warning about deprecated egrep by using grep -E. 2022-10-31 21:00:02 +02:00
Juho Hiltunen bdd46838c0 fix compiler warnings for unused variables and functions.
See commits ae97fa16 and a178ea1b.
2022-10-31 20:45:59 +02:00
Juho Hiltunen 1de9f4b52c Revert "cleanup: reduce code duplication with a new function"
This reverts commit 8021528f5e.

Failing on CI/CD.
2022-10-30 10:56:59 +02:00
Juho Hiltunen ec57210cc5 Merge branch 'duplicates'
Code cleanups found with static analyzers.
2022-10-30 10:12:23 +02:00
Juho Hiltunen 8021528f5e cleanup: reduce code duplication with a new function
StatusCreateTerminatedMsg.

This is not covered by current tests.
2022-10-30 10:12:11 +02:00
Juho Hiltunen 55f1f8e113 cleanup: reduce code duplication with AddToVoicesList()
Checking for return value & continue might be redundant.
2022-10-30 10:12:11 +02:00
Juho Hiltunen d47d2d0a40 cleanup: remove duplicate StringToWord()
Found with pmd-cpd static analysis
2022-10-30 10:12:11 +02:00
Juho Hiltunen 03ebb2fd11 cleanup: reduce variable scopes dictionary.c 2022-10-30 10:12:06 +02:00
Juho Hiltunen f23ff88755 cleanup: reduce variable scopes in synthdata.c 2022-10-30 10:11:53 +02:00
Juho Hiltunen 5d4791ccd1 cleanup: reduce variable scopes in synthesize.c 2022-10-30 10:11:44 +02:00
Juho Hiltunen 54265990b5 cleanup: reduce variable scopes in wavegen.c 2022-10-30 10:11:44 +02:00
Juho Hiltunen fa575b54cb cleanup: fix knownConditionTrueFalse code smells 2022-10-30 10:11:44 +02:00
Juho Hiltunen 7c7ab9e177 cleanup: fix duplicateCondition code smell 2022-10-30 10:11:44 +02:00
Juho Hiltunen 19f98ed699 Update es-419 (#1436)
This fixes the intonation in Latin American Spanish questions, removes
the phoneme replacement (T to s) because it is already included in
phonemes es_la. It also eliminates the line languaje es 6, because when
the voice is in the dialect of Spain and it automatically changes to the
dialect of Latin America, it does not return to the dialect of Spain.
2022-10-29 15:02:33 +03:00
Juho Hiltunen 385105b7cd Merge branch 'staticanalysis'
Fixes for some code smells found with cppcheck static code analysis tool.
2022-10-26 17:57:05 +03:00
Juho Hiltunen 507a5f5410 cleanup: fix unreadVariable code smell for variant_name in SelectVoiceByName() 2022-10-26 17:55:00 +03:00
Juho Hiltunen 14f12376a3 cleanup: change int skip to bool 2022-10-26 17:55:00 +03:00
Juho Hiltunen 8ddcf6ed94 cleanup: reduce variable scopes in voices.c 2022-10-26 17:54:55 +03:00
Juho Hiltunen 9900d55ccf cleanup: reduce variable scopes in setlengths.c 2022-10-25 20:02:54 +03:00
Juho Hiltunen 78a037924e cleanup: fix code smell knownConditionTrueFalse for strlen() >= 0
Strlen never retuns a negative value. Also combined if statements to
reduce complexity. This code currently has no tests.
2022-10-25 19:51:02 +03:00
Juho Hiltunen 07da7edeea cleanup: fix code smell knownConditionTrueFalse
Inner 'n_bytes >= 0' will always be true.
2022-10-25 19:51:02 +03:00
Juho Hiltunen 59177db8ef cleanup: fix code smell knownConditionTrueFalse
Inner 'p->stresslevel>=4' will always be true. Thus checking for
count_stressed is redundant.
2022-10-25 19:51:02 +03:00
Juho Hiltunen ef809dcd7e SetSpeed() refactoring (#1465)
Unify common parts of two implementations. Split into smaller functions.
2022-10-25 19:32:32 +03:00
Juho Hiltunen d1e98942e3 Update README.md (#1442)
Google is now a LLC not Inc.
2022-10-25 19:30:55 +03:00
Juho Hiltunen b94a5b160b Add arm CI (#1463)
This allows to cover
- another arch that x86, which is also very common
- an arch where char is unsigned
- a little-endian arch

This is running under qemu-user, so significantly slower and doesn't
support ptrace thus no address sanitizer etc. but at least the undefined
sanitizer works.
2022-10-25 19:29:20 +03:00
Juho Hiltunen 8170775113 code cleanup: refactor and remove duplication by unifying SetSpeed()
implemantations.

It is unclear why the two implementations differ.
2022-10-25 19:24:55 +03:00
Juho Hiltunen 0c82988b44 cleanup: refactor and remove duplication from SetSpeed() implementations. 2022-10-25 19:24:55 +03:00
Juho Hiltunen 84f58824af cleanup: refactor and remove duplication from SetSpeed() implementations. 2022-10-25 19:24:55 +03:00
Juho Hiltunen 9e9fb16b56 cleanup: use parameters instead of globals with SetSpeedMods 2022-10-25 19:24:55 +03:00
Juho Hiltunen a4c70d7921 cleanup: remove setting samplerate with Sonic.
we currently only support 22050 as samplerate so this code has no
effect. This should be readded to setSpeed() with and without Sonic if
multiple samplerates are supported in the future.
2022-10-25 18:24:27 +03:00
Juho Hiltunen bc16f819dd cleanup: refactor and remove duplication from SetSpeed() implementations.
There are two SetSpeed(), one for Sonic and one without. The differences
are very small.

In SetSpeedMods(), sample rate is adjusted for Sonic only:
 speed.min_sample_len = (speed.min_sample_len * samplerate_native) / 22050;

Since samplerate_native is 22050 at the moment this line has no effect.
2022-10-24 21:49:12 +03:00
Juho Hiltunen 5db96bd845 Staticanalysis (#1457)
Fixes for code smells from cppcheck static code analysis tool.

Also includes some function refactoring.
2022-10-23 19:45:47 +03:00
Juho Hiltunen 9e3ade9004 cleanup: reduce variable scopes in ssml.c
Contributes to #9.
2022-10-23 19:34:59 +03:00
Juho Hiltunen 185c93e702 cleanup: reduce variable scopes in readclause.c
Contributes to #9.
2022-10-23 19:15:18 +03:00
Juho Hiltunen 9be76c0b30 cleanup: fix cppcheck unusedVariable code smells 2022-10-23 18:44:30 +03:00
Juho Hiltunen 0551a234eb cleanup: reduce variable scopes in translateword.c
Contributes to #9.
2022-10-23 18:34:15 +03:00
Juho Hiltunen b4053da400 cleanup: fix cppcheck identicalInnerCondition code smells 2022-10-23 18:09:06 +03:00
Juho Hiltunen 77df00ad79 cleanup: fix cppcheck unreadVariable code smell in common.c 2022-10-23 17:32:41 +03:00
Juho Hiltunen 80a632ed26 cleanup: reduce variable scopes in common.c
Contributes to #9.
2022-10-23 17:32:41 +03:00
Juho Hiltunen 39ea6e3a90 cleanup: reduce variable scopes in translate.c
Contributes to #9.

Found with cppcheck static code analyzer variableScope parameter.
2022-10-23 17:28:20 +03:00
Juho Hiltunen ef1b562714 cleanup: remove code duplication by using SetPlist2() 2022-10-23 12:14:59 +03:00
Juho Hiltunen 319ce7b09f cleanup: refactor duplicate loops to CalcWordLength().
Note: This code has no tests. Tests would pass even without a call to
this function.
2022-10-23 12:14:59 +03:00
Juho Hiltunen 139eef57d2 cleanup: refactor checking for _^_ to function SwitchLanguage() 2022-10-23 12:14:59 +03:00
Juho Hiltunen 268f5899c8 fixup e2862bbc
Changing da_rules was accidentally included in the commit.
2022-10-22 17:31:29 +03:00
Juho Hiltunen c92f7b7bfe cleanup: refactor checking FLAG_COMBINE into a function (#1454) 2022-10-22 11:55:38 +03:00
Juho Hiltunen e2862bbc51 cleanup: refactor checking FLAG_COMBINE into a function 2022-10-22 11:49:27 +03:00
Juho Hiltunen 43d7c29d52 Increase targetSdk to 30 and support signature scheme v2 (#1413)
[This removes the warning that this app may not be compatible because it
was developed for an older
android-version.](https://developer.android.com/about/versions/10/behavior-changes-all#low-target-sdk-warnings)
Also, this adds support for signature scheme v2 and v3 [which reduces
the attack surface along with other
benefits](https://source.android.com/docs/security/features/apksigning#v1).
Lastly this adds 64-bit support for the APK, so this app can be
installed on 64-bit-only hardware.
2022-10-11 06:37:17 +03:00
Juho Hiltunen c05690be34 cleanup: move LoadConfig to langopts.c
LoadConfig() should be refactored to support both voice and language options set
in LoadVoice() and LoadLanguageOptions().
2022-10-10 21:36:25 +03:00
Juho Hiltunen 0f1f006afe Merge branch 'spellingStress' 2022-10-10 21:25:29 +03:00
Juho Hiltunen dc60881171 et: fi: move spellingStress from code to language configuration 2022-10-10 21:20:53 +03:00
Juho Hiltunen 53e40ead80 docs: add spellingStress 2022-10-10 21:20:53 +03:00
Juho Hiltunen 015bb42a70 new configurable language option: spellingStress 2022-10-10 21:20:20 +03:00
Juho Hiltunen f342b5d319 cleanup: make spelling_stress bool and set default value 2022-10-10 21:04:25 +03:00
Juho Hiltunen e03ab8a8c4 tests: add a test for langopts.spelling_stress 2022-10-10 21:04:25 +03:00
Juho Hiltunen c701b09c25 cleanup: reorganize LOPT defines 2022-10-10 20:08:22 +03:00
Juho Hiltunen 4d70ceceb5 Remove LOPT_IT_DOUBLING and delete unused functionality.
Code checked for both langopt LOPT_IT_DOUBLING and attribe $double.
LOPT_IT_DOUBLING is redundant. $double already has a test in
dictionary.test

Code had a check for tr->langopts.param[LOPT_IT_DOUBLING] & 2 but that bit value is
not used in any language. That logic was removed.
2022-10-10 19:57:23 +03:00
Juho Hiltunen 3b2557cfdd et: fi: move configuration from code to language file 2022-10-10 19:49:42 +03:00
Juho Hiltunen 644f02c26a fixup case V_TUNES
previous changing of variable names caused an error in the program logic.
2022-10-10 19:45:01 +03:00
Juho Hiltunen 78c9b55c5f fixup language options status and maintainer. 2022-10-10 19:34:21 +03:00
Juho Hiltunen b4c223a256 fixup: move some language option keywords to the correct MNEM_TAB.
Caused when creating LoadLanguageOptions().
2022-10-09 22:03:18 +03:00
Juho Hiltunen 7115e46879 fi: uncomment number configuration.
Accidentally commented out in ac82698f.
2022-10-09 20:41:22 +03:00
Juho Hiltunen 74fc17bbf1 Create langopts.c for language option configuration (#1419)
Loading Voice and Language options is complicated. They are not
separated in the code.

This PR creates langopts.c for holding language option related
configuration. In the future:
1. all new language options should go to langopts.c
2. voice options should have a similar file
3. LoadVoice should know if it's loading a voice or a language.
2022-10-09 16:48:18 +03:00
Juho Hiltunen a19e4b8df2 resize and initialize a two-dimensional array to pass sanitizer 2022-10-09 16:38:53 +03:00
Juho Hiltunen eae4595dc9 cleanup: move shared enums and MNEM_TABs to header file 2022-10-09 16:38:53 +03:00
Juho Hiltunen 78c6873427 cleanup: call CheckTranslator at start of LoadLangugeOptions 2022-10-09 16:38:53 +03:00
Juho Hiltunen 3182dee147 code cleanup: move CheckTranslator() to langopts.c 2022-10-09 16:38:53 +03:00
Juho Hiltunen 159ab0ee76 cleanup: move langopts.params handling to LoadLanguageOptions()
These have no tests and should be refactore to be similar to other
langopts.
2022-10-09 16:38:53 +03:00
Juho Hiltunen b820b68182 cleanup: move words to LoadLanguageOptions() 2022-10-09 16:38:53 +03:00