Commit graph

183 commits

Author SHA1 Message Date
Solomon Peachy
eeacffbd15 voice: Allow voiced date format to be overridden
This adds LANG_VOICED_DATE_FORMAT, a format string with these tokens:

 Y  4-digit year
 A  Month name
 m  numeric month
 d  numeric day of month

The default (english) is '23 January 2013'
In comparison, english-us is 'January 23 2013'

Change-Id: I055a3287c104260dec63bba58d36fdae9df1ed16
2021-09-28 21:58:11 -04:00
Solomon Peachy
70e72e01d2 talk: Add support for languages that swap the tens position in numbers
For example, English would say "231" as "two hundred thirty one" but
many other languages would say "two hundred one and thirty"

So, if VOICE_NUMERIC_TENS_SWAP_SEPARATOR is not an empty string, swap
the tens and ones position and use that string ("and" in the above
example) as the voiced separator.

Change-Id: I69f8064d44b3995827327cabae6ad352bf257d04
2021-09-28 17:25:28 -04:00
William Wilgus
26fd90bb49 talk.c check for proper file load
few sanity checks on voice clip loads

Change-Id: I15fdf05d2964e9f6d00360b9730357dac6054af7
2021-07-23 22:53:25 +00:00
William Wilgus
8cd4b8da84 talk.c check for 0 talk clips file descriptor leaks & announce_status fix typo
talk.c potential division by zero warrants a check

desowin pointed out multiple fd leaks

announce_status.c dumb typo

Change-Id: Iae99bd64696afdd9585952245a7a04cdc9f88ef1
2021-07-21 11:26:29 +00:00
Solomon Peachy
a952cf52d5 voice: Corrections to 24-hour time voicing:
* Voice leading "Oh" if hours is under 10.

 (ie "0900" is read as "oh nine hundred hours"

Change-Id: I09853909221e0dd6da354f7e4bb9733ff5edca90
2021-07-08 10:57:57 -04:00
William Wilgus
895ed92496 Talk.c, playlist.c fix bugs
fix bug in talk.c

playlist.c only dump voice buffer if we are out of space

Change-Id: I75705d755db4193a87e542d062dbdc96b153dbb6
2021-03-04 23:31:32 -05:00
William Wilgus
10b6707131 Talk Fix outright disable after first clip
Oops Sorry bout that ;P

Change-Id: I2618e2565a218dd5640351dfef3b7cc2a64617d4
2021-03-04 21:57:21 -05:00
William Wilgus
b2732222e9 Talk.c Guard against use after free / failure to load voicefile
load_voicefile_data wasn't checked for success leading
to a use after free situation

get_clip now checks for valid index_handle before using it

Change-Id: Id66dba6dbd6becfc9e0fe922fbc1d0adec1f0393
2021-03-05 02:22:20 +00:00
Solomon Peachy
ca326896d0 Fix compile warnings (set-but-not-used) on big endian targets
Change-Id: Ia433122d6c0af68a47d2f4a531a0787a9d3d9f72
2020-10-13 13:37:23 -04:00
William Wilgus
1f9e16e4df InvalidVoice prompt Fix red for devices w/o physical hold buttons
left in there from debugging

Change-Id: I6b9b7cb92848d2a7a72f6b1d688e61dc81c7c27b
2020-09-20 16:44:24 -04:00
William Wilgus
2ffe87902d Add Invalid Voice Announcement to the voice system FS#13216
When a voice file is invalid or fails to load the voice system splash a
message 'Invalid Voice'

Now we supply a single voice file (currently only english is used)
the support for other languages is in but I haven't set it up to
look for anything but InvalidVoice_english.talk

Also adds a one time kill voice thread function
 ie. it doesn't allow re-init after killing the voice thread & queue

Change-Id: I7b43f340c3cc65c65110190f0e0075b31218a7ac
2020-09-20 16:08:49 -04:00
Solomon Peachy
5d40d97585 voice: rename mp3_play_* functions to voice_play_*
Remove mp3_is_playing() entirely, in favor of pcm_is_playing()
Remove mp3_play_pause() entirely, as it's a dummy/no-op call
Remoce some archos-specific comments

Change-Id: I4e9ff323490a93add00809efd19e0d4e3f198b2d
2020-09-20 14:52:30 +00:00
Solomon Peachy
8cb555460f [3/4] Completely remove HWCODEC support
'swcodec' is now always set (and recording_swcodec for recording-capable
units) in feature.txt so the manual and language strings don't need to
all be fixed up.

Change-Id: Ib2c9d5d157af8d33653e2d4b4a12881b9aa6ddb0
2020-07-24 21:20:13 +00:00
Solomon Peachy
092c340a20 [1/4] Remove SH support and all archos targets
This removes all code specific to SH targets

Change-Id: I7980523785d2596e65c06430f4638eec74a06061
2020-07-24 21:20:13 +00:00
Solomon Peachy
09f40e266b talk: Force-shutdown the voice system before loading a new voice
Otherwise we might actually be talking when we try to switch, or
otherwise trash the state of the running talk thread, leading to
memory corruption or an outright crash

(This fixes a panic observed on the xDuoo X3)

Change-Id: I78e4232085c5c160c9ee4f18167dad8dad2b9287
2020-07-24 03:31:11 +00:00
Solomon Peachy
a5df94beb5 build: Tweaks to better support non-English as primary language
* get rid of $(LANGUAGE) in top-level makefile (and configure script)
 * un-hardcode English-as-primary-language in a couple more places
 * allow DEFAULT_VOICE_LANG to be overriden

To actually change the primary from English, one must change:

 * $english in voice.pl
 * hardcoded 'english' in rbutil
 * $ENGLISH in apps/lang/lang.make
 * DEFAULT_VOICE_LANG in apps/talk.c
 * configure script (default prompt)

Of course, if one wants to change the default UI language, it's simpler
to change the default language setting variable at compile time, or
perhaps by adding a configuration file with the desired value into the
.rockbox directory when the .zip is assembled.

Change-Id: If5cf76019d416e838628a2eccd4ec7d6cbaeeb74
2020-07-21 17:22:45 +00:00
Solomon Peachy
688c89cfe1 genlang: More voice-related fixes.
* Use consistent ID numbering
 * Use consistent logic for voicelist and voicebin files
 * Fix situations where English <-> English would fail in strange ways
 * Delete leftover tmpfile.
 * Off-by-one error in voice validation code
 * Off-by-one error in voicelist generation

Change-Id: Ib3cea2c6612138b1cbe614dacbe51000199cc9ad
2020-07-21 11:59:47 +00:00
Solomon Peachy
0e97132314 talk: only show the "failed reading .voice" splash if talking is enabled
Change-Id: I4046294e39c621ddeeceeb6f21eab05a1e687cb5
2020-07-15 03:02:28 +00:00
Peter Sealy
b64a286a81 voice file not loading
>
> I ran into an issue where my voice file would only load if I changed language while playing music. It seems to happen because when no other file is open, file.c alloc_filestr returns the first free handle which is 0. In talk.c this is treated as an invalid handle, so the voice file is not loaded.

Change-Id: I42db40b10cc7a900bdd72012d99265300e783e44
2020-07-09 14:07:37 +00:00
William Wilgus
dcf8154c32 talk.h add failed to load splash
Change-Id: Ie355a52bb6c687d302dc3e39693b9ab40e2dd699
2020-05-22 07:52:01 -05:00
William Wilgus
74f358cf8b talk.h add init status to debug menu
g#2272 adds checks for incompatible version & proper number of clips

Currently incompatible talk files will logf when failure to load occurs

Adds a message to Debug > Talk engine stats
'Talk Status: OK'
'Talk Status: ERR Incompatible voice file'
'Talk Status: ERR (#)' -- OOM, Alloc Error

Change-Id: Ifd2c1f38f710541c9cd929b8abf67bba4363ca53
2020-05-22 06:35:22 -05:00
William Wilgus
c93666d08e talk.h make voice files check for proper number of entries on load
In addition to version and target also check id1_max & id2_max
for proper length before allowing voice file to be loaded

Change-Id: I36016059d07781b0bb43dd9873bbb6e565298d76
2020-04-17 07:30:23 +02:00
Solomon Peachy
e6b03ffa82 Respect age when freeing thumbnails from clip cache.
Otherwise they could get freed while queued.

Patch by Igor Poretsky

Change-Id: I436b074d81a85cfeb68a07a17320a3c9c0a43e1e
2019-08-06 13:37:20 +02:00
Solomon Peachy
3b7ae5e06b Improved robustness in talk code
Patch by Igor Poretsky

Change-Id: I5c0dcc693b647c7573379e33406a7b9d4b192725
2019-08-05 05:01:11 +02:00
Solomon Peachy
55eb1c54eb FS#7704 - Talk support for plugins
Original patch by Mario Lang
Heavily updated by Igor Poretsky
Further updated by myself

  This patch breaks binary API compatibility by placing the new
  functions where they make the most logical sense. IMO this is
  the better approach to take given the scope of the changes needed
  for talk support.

  Since binary API is changing, the patch also moves some other
  functions around to more logical locations.

  As well as voice support in plugins, this patch voice-enables several
  simple plugins.  There will be follow-up patches for many plugins that
  build on this one.

Change-Id: I18070c06e77e8a3c016c2eb6b6c5dbe6633b9b54
2019-07-20 08:48:35 +02:00
William Wilgus
a06d9c85f7 Auto-Ranging Time Formatting For Menus (hh:mm:ss:mss)
Unifies time formatting in settings_list.c allows time format to
display as HH:MM:SS.MSS or any consecutive combination thereof
(hh:mm:ss, mm:ss, mm:ss.mss, ss.mss, hh, mm, ss ,mss)
works in INT and TABLE settings with the addition of flag 'F_TIME_SETTING'

Time is auto-ranged dependent on value

Adds talk_time_intervals to allow time values to be spoken similar to
display format:  x Hours, x Minutes, x Seconds, x Milliseconds

Table lookups merged or removed from recording, clip meter and lcd timeout
-String_Choice replaced with TABLE_SETTING or INT_SETTING for these
functions as well, cleaned-up cfg_vals that get saved to cfgfile

RTL Languages ARE supported

Negative values ARE supported

Backlight on/off are now Always and Never to share formatter with LCD
Timeout

Added flag to allow ranged units to be locked to a minimum index

Added flag to allow leading zero to be supressed from the largest unit

merged talk_time_unit() and talk_time_intervals()

optimized time_split()

optimized format_time_auto()

Backlight time-out list same as original

Change-Id: I59027c62d3f2956bd16fdcc1a48b2ac32c084abd
2018-12-22 12:27:21 -06:00
Solomon Peachy
c2308bdf40 Fix HWCODEC builds.
Change-Id: I7abed5dab9b4d0d053c274404dc4dc06864aa060
2018-12-15 13:09:51 -05:00
Solomon Peachy
4adad0bc1f FS#6323: Speech for ID3 viewer, playlist catalog and playlist viewer
Modified from original ticket, Taken from Igor Poretsky's tree, and
further modified by myself to incorporate feedback.

Change-Id: Ibc2180e52af76890b1448d23f79386fd0f88f709
2018-12-15 18:00:23 +01:00
William Wilgus
62a5ed49cc Fix possible truncation misc.c->output_dyn_value + use Kibytes
output_dyn_value now requires the count for number of units

Binary scale now shows Kibibytes instead of kilobytes (g#1742)

Fixes output for negative values as well

Change-Id: I8aa896860e97d2453fa35069e2dfe1caac60109f
2018-12-09 22:54:55 -06:00
Thomas Martitz
0b7a90722a talk: On hwcodec disabling DMA interrupt is required during buflib move
Even though the DMA buffer itself does not move the ISR copies from a movable
buffer into the static commit buffer. To ensure this copying yields consistent
data it must not be interrupted by this ISR..

Also bump the commit buffer size to 2k, this should reduce the overhead
considerably because many clips are smaller than that (especially on
swcodec/speex).

Change-Id: I4e1ab83074f31fc91b51a58baa1df55ce659ac73
2014-02-03 12:43:05 +01:00
Thomas Martitz
10b3bc78f6 Fix warnings.
Change-Id: If3cbcd7557797684f1b7fea8e1bb134777680dee
2014-02-03 12:33:33 +01:00
Thomas Martitz
e5eb74592e talk/voice: Reduce the size of the commit buffer.
The voice engine can now request more voice data during decoding, it does
not require the entire clip to be available before start of decoding anymore.
Therefore the commit buffer does not need to hold an entire voice clip anymore,
and can be made greatly smaller.

Change-Id: I3eca9026448e725b9b8d0dae1efca0ad185371da
2014-02-02 19:40:39 +01:00
Thomas Martitz
af02a674c5 talk.c: The new cache management is good enough to use it for .talk clips as well.
This unifies the talk.c for all possible voice payload. .talk clips are placed
onto the same unified clip cache, along with normal clips. This allows for more
effecient memory usage.

The cache handling makes a slight difference between normal clips and .talk
ones: .talk clips can be cached multiple and are always freed first.The extra
logic to avoid loading multiple copies of .talks is not necessary because the
will be freed first anyway.

Change-Id: I88d056a0a613b129f5875f50fdb757b58bac0a42
2014-02-02 19:40:39 +01:00
Thomas Martitz
03f373c9cd talk.c: The new cache management is good enough to use it on all targets.
This unifies the talk.c for all targets. The only separation is left is
TALK_PROGRESSIVE_LOAD: When this is defined the talk buffer will not be
initially prefilled. This is useful for super slow storage or when the buffer
is not large enough to prefill it with useful clips (the prefill code could
be made smarter too).

The buffer size can be adjusted. By default lowmem uses 100k while
other targets load the entire file. The bigger the more clips can be cached
but with diminishing returns.

Change-Id: Ife38fb101c53093117e6638c40c65f7d177a31d4
2014-02-02 19:40:39 +01:00
Thomas Martitz
c46f9be10a talk: Smarter cache management for TALK_PARTIAL_LOAD.
Previously the clip cache of TALK_PARTIAL_LOAD reserved space N clips, each slot
was as big as the maximum sized clip which was necessary to replace clips
in-memory in MRU-style.

The cache management now uses buflib to allocate and free each clip, using the
clip's real size. This allows the clip cache to be much more compact, because
no space is wasted for the max. sized clip. This makes use of buflib's ability
to easily manage differently-sized memory chunks by moving them to make free
space.

As an example: for english.voice TALK_PARTIAL_LOAD allocated 288k in advance.
for just 64 clips. With this patch ~70 clips can be stored in a 100k buffer.
This, the memory usage is cut by 2/3 and almost optimal (there's still the
buflib per-alloc cookie overhead).

As a result the TALK_PARTIAL_LOAD buffer is restricted to 100k which still
allows for more clips than previously, on average.

Change-Id: I257654071e9a95770cd6db2c2765f020befce412
2014-02-02 19:40:39 +01:00
Thomas Martitz
dac40fdd60 talk: Add debug menu entry to view statistics about talk engine.
This engine includes voicefile, memory usage and cache
hits/misses for TALK_PARTIAL_LOAD.

Change-Id: I331981ddda39ea30c57b4b74504accb3c556c3b9
2014-02-02 19:40:39 +01:00
Thomas Martitz
57000b513b talk: Make talk_voice_required() local to talk.c
Change-Id: I3a04760d550efab7f011a917597ef29c039b05bd
2014-02-02 19:40:39 +01:00
Thomas Martitz
60dea95cad talk/hwcodec: Do always free the clip buffer in shrink_callback().
This is necessary because when voice is active audio is disabled. But only
audio was able to shrink it's buffer to let other memory allocs succeed.
talk needs to be able to do this too when it owns the audio buffer exclusively.

Change-Id: Idea8ab90da7169f977c0c766cccb42c4fe6d6e81
2014-02-02 19:40:39 +01:00
Thomas Martitz
efc20ec164 talk: When no voice file is loaded don't even attempt to load the clip, it's hopeless.
Change-Id: I420155d7f01ca0ea301c0678ac7245d251d365b0
2014-01-27 10:05:48 +01:00
Thomas Martitz
543027564c hwcodec/talk.c: Give the thumbnail buffer regardless of the talk buffer policy.
When the policy is not set, it'll by default not give the clip buffer away.
Callers of core_alloc_maximum() suffer from this. However, the thumbnail
buffer can be easily freed when needed because nothing needs to be
reloaded from disk when it is reallocated (thumbnail clips are loaded on
demand, when in the file browser). Do this to give core_alloc_maximum() callers
a better chance to succeed with the default talk buffer policy.

Change-Id: I8c0da29c520612ca903f6c930bd7c74ae97eca3b
2014-01-26 19:14:47 +01:00
Thomas Martitz
5827e41904 hwcodec: core_alloc_maximum() returned 0 bytes if talk.c controls the audio buffer.
On hwcodec talk.c has the entire audio buffer (not just parts of it), therefore
it must give up everything and cannot count on core_alloc_maximum() to return
the remaining space. This is equivalent to it was handled before 22e802e.

You could probaby do smarter and shrink for example the .talk clip buffer
but is it really worth it?

Change-Id: Idc3431c59fb41b05338559c615093358c5d8ed9b
2013-12-24 01:16:10 +01:00
Thomas Martitz
a4d1849e24 Fix yellow.
Change-Id: Ib46e4d0896de4227a508abf5806c00ec3d59db51
2013-12-23 12:54:36 +01:00
Thomas Martitz
22e802e800 playback,talk: Share audiobuffer via core_alloc_maximum().
This fixes the radioart crash that was the result of buffering.c working
on a freed buffer at the same time as buflib (radioart uses buffering.c for the
images). With this change the buffer is owned by buflib exclusively so this
cannot happen.

As a result, audio_get_buffer() doesn't exist anymore. Callers should call
core_alloc_maximum() directly. This buffer needs to be protected as usual
against movement if necessary (previously it was not protected at all which
cased the radioart crash), To get most of it they can adjust the willingness of
the talk engine to give its buffer away (at the expense of disabling voice
interface) with the new talk_buffer_set_policy() function.

Change-Id: I52123012208d04967876a304451d634e2bef3a33
2013-12-23 12:17:38 +01:00
Dominik Riebeling
de6f96229b Add comment to clarify calculation.
Change-Id: Ie0eaa2bb1c672c974246b3e97b5d5f3b9e1f9925
2012-06-05 22:53:21 +02:00
Michael Sevakis
652b39b9e1 More snafu fix. Need a couple more patchups for now.
Must restore talk buffer explicitly when not taking it and promote
the buffer state.

Change-Id: Ia0341ede05837e6e94885a9ad62460c415ec6f00
2012-05-24 20:59:05 -04:00
Michael Sevakis
4b97437c23 Correct snafu in talk.c
When allocating the voice buffer, it's supposed to start at the beginning
of the audio buffer, not at the end of the voice buffer. ;-D

Might clear up a thing or two.

Change-Id: I94796ff21090bcc56813cdc569957a1a9178abcd
2012-05-24 20:47:40 -04:00
Michael Sevakis
da6cebb6b0 Use buflib for the allocation of voice PCM resources.
Buffers are not allocated and thread is not created until the first
call where voice is required.

Adds a different callback (sync_callback) to buflib so that other
sorts of synchonization are possible, such as briefly locking-out the
PCM callback for a buffer move. It's sort of a messy addition but it
is needed so voice decoding won't have to be stopped when its buffer
is moved.

Change-Id: I4d4d8c35eed5dd15fb7ee7df9323af3d036e92b3
2012-05-02 17:22:28 -04:00
Michael Sevakis
d18a5cad7f Tweak paramters of mp3_play_data and callback.
Use generic void * and size_t and make mp3_play_data and its callback
agree on types. Use mp3_play_callback_t instead of prototyping
right in the function call (so it's not so messy to look at). Change
doesn't appear to require plugin API version increment.

Change-Id: Idcab2740ee316a2beb6e0a87b8f4934d9d6b3dd8
2012-03-04 14:50:47 -05:00
Boris Gjenero
bda8a963ad Add conditionals for functions only needed on SWCODEC targets.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31296 a1c6a512-1295-4272-9138-f99709370657
2011-12-15 20:58:14 +00:00
Jens Arnold
ae601954aa Make usage of TALK_PARTIAL_LOAD actually Ondio specific. MMC is not always slow.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30917 a1c6a512-1295-4272-9138-f99709370657
2011-11-06 14:25:33 +00:00