summaryrefslogtreecommitdiff
path: root/apps/talk.c (follow)
Commit message (Collapse)AuthorAge
* talk: On hwcodec disabling DMA interrupt is required during buflib moveThomas Martitz2014-02-03
| | | | | | | | | | | | 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
* Fix warnings.Thomas Martitz2014-02-03
| | | | Change-Id: If3cbcd7557797684f1b7fea8e1bb134777680dee
* talk/voice: Reduce the size of the commit buffer.Thomas Martitz2014-02-02
| | | | | | | | | 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
* talk.c: The new cache management is good enough to use it for .talk clips as ↵Thomas Martitz2014-02-02
| | | | | | | | | | | | | | | 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
* talk.c: The new cache management is good enough to use it on all targets.Thomas Martitz2014-02-02
| | | | | | | | | | | | | | 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
* talk: Smarter cache management for TALK_PARTIAL_LOAD.Thomas Martitz2014-02-02
| | | | | | | | | | | | | | | | | | | | | | 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
* talk: Add debug menu entry to view statistics about talk engine.Thomas Martitz2014-02-02
| | | | | | | This engine includes voicefile, memory usage and cache hits/misses for TALK_PARTIAL_LOAD. Change-Id: I331981ddda39ea30c57b4b74504accb3c556c3b9
* talk: Make talk_voice_required() local to talk.cThomas Martitz2014-02-02
| | | | Change-Id: I3a04760d550efab7f011a917597ef29c039b05bd
* talk/hwcodec: Do always free the clip buffer in shrink_callback().Thomas Martitz2014-02-02
| | | | | | | | 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
* talk: When no voice file is loaded don't even attempt to load the clip, it's ↵Thomas Martitz2014-01-27
| | | | | | hopeless. Change-Id: I420155d7f01ca0ea301c0678ac7245d251d365b0
* hwcodec/talk.c: Give the thumbnail buffer regardless of the talk buffer policy.Thomas Martitz2014-01-26
| | | | | | | | | | | 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
* hwcodec: core_alloc_maximum() returned 0 bytes if talk.c controls the audio ↵Thomas Martitz2013-12-24
| | | | | | | | | | | | | 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
* Fix yellow.Thomas Martitz2013-12-23
| | | | Change-Id: Ib46e4d0896de4227a508abf5806c00ec3d59db51
* playback,talk: Share audiobuffer via core_alloc_maximum().Thomas Martitz2013-12-23
| | | | | | | | | | | | | | | | 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
* Add comment to clarify calculation.Dominik Riebeling2012-06-05
| | | | Change-Id: Ie0eaa2bb1c672c974246b3e97b5d5f3b9e1f9925
* More snafu fix. Need a couple more patchups for now.Michael Sevakis2012-05-24
| | | | | | | Must restore talk buffer explicitly when not taking it and promote the buffer state. Change-Id: Ia0341ede05837e6e94885a9ad62460c415ec6f00
* Correct snafu in talk.cMichael Sevakis2012-05-24
| | | | | | | | | 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
* Use buflib for the allocation of voice PCM resources.Michael Sevakis2012-05-02
| | | | | | | | | | | | | 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
* Tweak paramters of mp3_play_data and callback.Michael Sevakis2012-03-04
| | | | | | | | | 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
* Add conditionals for functions only needed on SWCODEC targets.Boris Gjenero2011-12-15
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31296 a1c6a512-1295-4272-9138-f99709370657
* Make usage of TALK_PARTIAL_LOAD actually Ondio specific. MMC is not always slow.Jens Arnold2011-11-06
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30917 a1c6a512-1295-4272-9138-f99709370657
* Voice related fixes and cleaupJens Arnold2011-11-06
| | | | | | | | | | | * Fix .talk clips on hwcodec. Voice does have the entire audio buffer available there. * Get rid of the separate TALK_PROGRESSIVE_LOAD in favour of the more advanced TALK_PARTIAL_LOAD i.e. use the latter on the Ondios as well. This gets rid of quite some ifdefing, and has the advantage that the voice file can be larger than the buffer (at a slight binsize cost). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30916 a1c6a512-1295-4272-9138-f99709370657
* Fix warning and typos.Thomas Martitz2011-11-06
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30912 a1c6a512-1295-4272-9138-f99709370657
* Fix broken voice when .talk files are used and voice buffer calculation.Thomas Martitz2011-11-06
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30909 a1c6a512-1295-4272-9138-f99709370657
* Properly initialize variable to get voice going again. GCC didn't catch this ↵Thomas Martitz2011-11-03
| | | | | | one introduced r30840. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30894 a1c6a512-1295-4272-9138-f99709370657
* Fix FS#12241. Voice stopped working after audio_get_buffer() calls.Thomas Martitz2011-10-26
| | | | | | | | | | Since r30308 the talk buffer was set to NULL if e.g. a plugin called audio_get_buffer() to steal the talk buffer. Since there's no audio_release_buffer() kind of function the talk buffer was never set back again. When trying to talk try to get the audio buffer with audio_get_buffer() as well, which works until the audio buffer gets properly reinitialized. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30840 a1c6a512-1295-4272-9138-f99709370657
* Make a few local functions staticBertrik Sikken2011-10-12
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30744 a1c6a512-1295-4272-9138-f99709370657
* GSoC/Buflib: Add buflib memory alocator to the core.Thomas Martitz2011-08-30
| | | | | | | | | | | | | | | | | The buflib memory allocator is handle based and can free and compact, move or resize memory on demand. This allows to effeciently allocate memory dynamically without an MMU, by avoiding fragmentation through memory compaction. This patch adds the buflib library to the core, along with convinience wrappers to omit the context parameter. Compaction is not yet enabled, but will be in a later patch. Therefore, this acts as a replacement for buffer_alloc/buffer_get_buffer() with the benifit of a debug menu. See buflib.h for some API documentation. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30380 a1c6a512-1295-4272-9138-f99709370657
* Move stuff a bit down to fix red on TALK_PARTIAL_LOAD.Thomas Martitz2011-08-22
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30339 a1c6a512-1295-4272-9138-f99709370657
* Fix red on hwcodec.Thomas Martitz2011-08-22
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30338 a1c6a512-1295-4272-9138-f99709370657
* Talk: Unify hwcodec and swcodec handling.Thomas Martitz2011-08-21
| | | | | | | | | Do it the hwcodec way which doesn't need a buffer_alloc(). The buffer for the .talk files is now allocated together with the voicefile buffer. Should also fix a panic when the .talk file buffer was allocated late at runtime. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30335 a1c6a512-1295-4272-9138-f99709370657
* Add change that got lost somehow in r30308.Thomas Martitz2011-08-14
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30312 a1c6a512-1295-4272-9138-f99709370657
* Fix remaining problems.Thomas Martitz2011-08-14
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30311 a1c6a512-1295-4272-9138-f99709370657
* Fix errors and warnings.Thomas Martitz2011-08-14
| | | | | | | The buffer_offset paramter of audio_init_recording() is removed as it was unused in both implementations. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30310 a1c6a512-1295-4272-9138-f99709370657
* GSoC/Buflib: Replace all direct accesses to audiobuf with buffer API functions.Thomas Martitz2011-08-14
| | | | | | | | | | | | | | | | | | | | | | | Namely, introduce buffer_get_buffer() and buffer_release_buffer(). buffer_get_buffer() aquires all available and grabs a lock, attempting to call buffer_alloc() or buffer_get_buffer() while this lock is locked will cause a panicf() (doesn't actually happen, but is for debugging purpose). buffer_release_buffer() unlocks that lock and can additionally increment the audiobuf buffer to make an allocation. Pass 0 to only unlock if buffer was used temporarily only. buffer_available() is a replacement function to query audiobuflen, i.e. what's left in the buffer. Buffer init is moved up in the init chain and handles ipodvideo64mb internally. Further changes happened to mp3data.c and talk.c as to not call the above API functions, but get the buffer from callers. The caller is the audio system which has the buffer lock while mp3data.c and talk mess with the buffer. mpeg.c now implements some buffer related functions of playback.h, especially audio_get_buffer(), allowing to reduce #ifdef hell a tiny bit. audiobuf and audiobufend are local to buffer.c now. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30308 a1c6a512-1295-4272-9138-f99709370657
* FS#11939: Simplify talk_time_unit().Andree Buschmann2011-02-20
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29347 a1c6a512-1295-4272-9138-f99709370657
* Undo unwanted commit r29310.Andree Buschmann2011-02-15
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29311 a1c6a512-1295-4272-9138-f99709370657
* All AAC-HE files will double the frame sample count, not only AAC-HE files ↵Andree Buschmann2011-02-15
| | | | | | with SBR upsampling. This change fixes issues with some m4a files reported in the forums. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29310 a1c6a512-1295-4272-9138-f99709370657
* Do not fiddle with audiobuf in talk_init() when no voice file is present. ↵Andree Buschmann2011-02-13
| | | | | | Avoids stopping of audio playback when changing languages without using voice files. Closes FS#10479. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29300 a1c6a512-1295-4272-9138-f99709370657
* Clean up multiple definitions of RAM size. Remove -DMEM (make) and MEM ↵Andree Buschmann2011-02-02
| | | | | | (code), use the already defined MEMORYSIZE instead. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29189 a1c6a512-1295-4272-9138-f99709370657
* FS#11587 : voice for SWCODEC and low memoryRafaël Carré2010-09-01
| | | | | | | | On these targets the full voice file can't be loaded so only load 64 clips at a time (the size of the queue) Voice now works on clipv1 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27962 a1c6a512-1295-4272-9138-f99709370657
* lang.h voice comments were off by 1, fixedJeffrey Goode2010-05-26
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26296 a1c6a512-1295-4272-9138-f99709370657
* Oops, didnt mean to enable logf in talk.cJeffrey Goode2010-05-26
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26295 a1c6a512-1295-4272-9138-f99709370657
* Fix crash in talk.c logf line when outputting voice only clips, more ↵Jeffrey Goode2010-05-26
| | | | | | comments in lang.h git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26294 a1c6a512-1295-4272-9138-f99709370657
* fix inverted logic in r26047: voice works againRafaël Carré2010-05-15
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26049 a1c6a512-1295-4272-9138-f99709370657
* talk_init() : don't try to load the voice file if it won't fit in memoryRafaël Carré2010-05-15
| | | | | | now playback still works if voicing is enabled on the clipv1 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26047 a1c6a512-1295-4272-9138-f99709370657
* Move c/h files implementing/defining standard library stuff into a new libc ↵Thomas Martitz2010-05-06
| | | | | | | | directory, also standard'ify some parts of the code base (almost entirely #include fixes). This is to a) to cleanup firmware/common and firmware/include a bit, but also b) for Rockbox as an application which should use the host system's c library and headers, separating makes it easy to exclude our files from the build. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25850 a1c6a512-1295-4272-9138-f99709370657
* Add logf line to talk.cJeffrey Goode2010-05-04
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25808 a1c6a512-1295-4272-9138-f99709370657
* Kill some global variablesBertrik Sikken2010-02-24
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24888 a1c6a512-1295-4272-9138-f99709370657
* FS#10739: playback.c code splitJeffrey Goode2009-10-31
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23444 a1c6a512-1295-4272-9138-f99709370657