Commit Graph

56 Commits

Author SHA1 Message Date
William Wilgus cb2ee6b6cb voice_thread.c ensure cpu gets re-boosted after Q_VOICE_STOP event
when the voice system is doing queued voice clips you can get a
voice_stop event which cancels the cpu boost
but the quiet count was not reset to 0
next clip may play unboosted causing stuttering

just boost unconditionally on Q_PLAY
it'll unboost after timeout if unneeded

Change-Id: Ib39df5d9f8a9e41299147a885048cf1361180dd6
2021-09-29 01:18:00 -04:00
William Wilgus fe5c1c8126 Revert "voice_thread.c ensure cpu gets re-boosted after Q_VOICE_STOP event"
This reverts commit 4695f80230.

Reason for revert: Something else is unboosting the thread this is a red herring

Change-Id: I0e71e0065b13129bbf59d45416c15799c446dcad
2021-09-28 01:27:52 -04:00
William Wilgus 4695f80230 voice_thread.c ensure cpu gets re-boosted after Q_VOICE_STOP event
reset quiet counter after Q_VOICE_STOP

when the voice system is doing un-queued voice clips you can get a
voice_stop event which cancels the cpu boost but the quiet count was not reset
next clip will play unboosted causing stuttering

Change-Id: Icaada443e2399bf146e30bebee599db5b379063a
2021-09-27 23:36:49 -04:00
Solomon Peachy 207514fb25 voice: Allow voice prompt volume to be configurable
It defaults to 100%, allow it to be dialed back

Change-Id: If997fb7d3057472a7fac0be4ae7d1e8fce654c49
2021-03-07 12:51:36 +00:00
Solomon Peachy c842a13651 voice: Fix accidental warnings
Change-Id: I9663b4febd60c79a533ace1bad593c543c7dcf1d
2020-12-17 13:29:58 -05:00
Solomon Peachy 1aaa2824b6 voice: Increase voice thread stack size on hosted targets
Fixes a stack overflow on Sony NWZ players when loading the voice file

Change-Id: Id545517b827e757922b4cde043763ee7316435e6
2020-12-17 13:11:43 -05: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 c06766bbeb voice: Increase voice stack size a bit for MIPS by 256 bytes.
MIPS is stack hungry due to the large number of GPRs we have to save.
With this extra headroom we now _idle_ at 75% stack use of a 2K stack!

Change-Id: I197b730c817d948230010f18dba60747088487ba
2020-08-25 12:15:53 +00:00
Michael Sevakis c8564f1ca8 Get voice event out of playback.c
Purpose: A step in removing all voice references from playback code
and prelude to other changes.

Change-Id: Ic3ad7f7a33b979693e18a3456ced37eb1d2281a4
2017-12-12 20:28:56 -05: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 57000b513b talk: Make talk_voice_required() local to talk.c
Change-Id: I3a04760d550efab7f011a917597ef29c039b05bd
2014-02-02 19:40:39 +01:00
Thomas Martitz 281d1fadb3 Do not include kernel.h in system.h.
system.h doesn't need it on its own and this change makes it less
dependant on Rockbox internals.

Change-Id: I4e1e4108a52a7b599627a829204eb82b392fc6d6
2014-01-05 19:35:23 +01:00
Michael Sevakis d37bf24d90 Enable setting of global output samplerate on certain targets.
Replaces the NATIVE_FREQUENCY constant with a configurable frequency.

The user may select 48000Hz if the hardware supports it. The default is
still 44100Hz and the minimum is 44100Hz. The setting is located in the
playback settings, under "Frequency".

"Frequency" was duplicated in english.lang for now to avoid having to
fix every .lang file for the moment and throwing everything out of sync
because of the new play_frequency feature in features.txt. The next
cleanup should combine it with the one included for recording and
generalize the ID label.

If the hardware doesn't support 48000Hz, no setting will be available.

On particular hardware where very high rates are practical and desireable,
the upper bound can be extended by patching.

The PCM mixer can be configured to play at the full hardware frequency
range. The DSP core can configure to the hardware minimum up to the
maximum playback setting (some buffers must be reserved according to
the maximum rate).

If only 44100Hz is supported or possible on a given target for playback,
using the DSP and mixer at other samperates is possible if the hardware
offers them.

Change-Id: I6023cf0c0baa8bc6292b6919b4dd3618a6a25622
Reviewed-on: http://gerrit.rockbox.org/479
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested-by: Michael Sevakis <jethead71@rockbox.org>
2013-07-06 04:22:04 +02:00
Michael Sevakis 98c34d8723 Argh, move a comment to the (now) proper location. :)
Change-Id: I13847b99d9aeaa05efa5b22a8e4842f193f01a3c
2013-05-31 19:01:24 -04:00
Michael Sevakis e62cb56644 Have voice fire an event when it starts and stops playing.
Further decouples voice_thread.c from other playback areas. Also allows
other audio sources, such as FM radio, to be attenuated when voice is
playing by implementing a callback.

Defined as another playback event rather than a new event class:
PLAYBACK_EVENT_VOICE_PLAYING

Change-Id: I2e3e218be6cd6bebbf39e7883a8c0e4ed42b62bb
2013-05-31 18:45:51 -04:00
Thomas Martitz b985d5cee8 Fix FS#12743 - 'Data Abort' on USB connection
Because a pointer was uninitialized the move_callback() corrupted memory
by derefencing it and moving stuff to uninitialized value.

This reverts part of 8bbd4d9, where the offending line was removed. I can
only guess it was removed by accident.

Change-Id: I83cee5b396cf3cc99b000e5284fac72fb8ca8db2
2012-09-11 06:39:53 +02:00
Michael Sevakis 77220147b5 Get voice PCM queue indexes updating in right order...
...from the compiled code standpoint anyway. frame_out was being
incremented before updating size...sometimes...depending on what
GCC was up to. This seems to help.

Change-Id: Ie4ee3337a2937bd2c26f0a9c4a1a00467954821b
2012-05-30 12:55:26 -04:00
Michael Sevakis 8bbd4d91a0 Zero out voice buffer memory immediately after allocation.
Can't wait for the voice thread to initialize it since it concievably
could be moved before the voice thread actually does so and the move
callback accesses data that must be first set up in the voice thread
function.

Change-Id: Ia0d09539854db85e132e09d26cb129f02f5d93ff
2012-05-17 11:16:20 -04:00
Michael Sevakis c0208f0f64 Oops, need to init the voice_buf indexes too. :-)
Change-Id: I12e48e9e7d70e779511aac05be6e6145d30f456a
2012-05-02 18:25:34 -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 56f17c4164 Make rbcodec/dsp includes more specific.
Change-Id: Idb6af40df26f5b8499a40e8b98602261ef227044
2012-04-29 17:31:30 -04:00
Michael Sevakis c9bcbe202d Fundamentally rewrite much of the audio DSP.
Creates a standard buffer passing, local data passing and messaging
system for processing stages. Stages can be moved to their own source
files to reduce clutter and ease assimilation of new ones. dsp.c
becomes dsp_core.c which supports an engine and framework for effects.

Formats and change notifications are passed along with the buffer so
that they arrive at the correct time at each stage in the chain
regardless of the internal delays of a particular one.

Removes restrictions on the number of samples that can be processed at
a time and it pays attention to destination buffer size restrictions
without having to limit input count, which also allows pcmbuf to
remain fuller and safely set its own buffer limits as it sees fit.
There is no longer a need to query input/output counts given a certain
number of input samples; just give it the sizes of the source and
destination buffers.

Works in harmony with stages that are not deterministic in terms of
sample input/output ratio (like both resamplers but most notably
the timestretch). As a result it fixes quirks with timestretch hanging
up with certain settings and it now operates properly throughout its
full settings range.
Change-Id: Ib206ec78f6f6c79259c5af9009fe021d68be9734
Reviewed-on: http://gerrit.rockbox.org/200
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested-by: Michael Sevakis <jethead71@rockbox.org>
2012-04-29 10:00:56 +02:00
Michael Sevakis 97a535d83c Oops, Shoulda been "int16_t" not "uint16_t".
Change-Id: Ic2a54e9f283acb1c362857a3f1422ed3c532249f
2012-04-26 16:24:12 -04:00
Michael Sevakis cfc32fe75f Adjust some typing in voice_thread.c. Constants are also counts, not sizes.
Change-Id: I05700f6c87c775e98f05323d2ab0550fad8befd7
2012-04-26 16:04:44 -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
Michael Sevakis 286a4c5caa Revise the PCM callback system after adding multichannel audio.
Additional status callback is added to pcm_play/rec_data instead of
using a special function to set it. Status includes DMA error
reporting to the status callback. Playback and recording callback
become more alike except playback uses "const void **addr" (because
the data should not be altered) and recording  uses "void **addr".
"const" is put in place throughout where appropriate.

Most changes are fairly trivial. One that should be checked in
particular because it isn't so much is telechips, if anyone cares to
bother. PP5002 is not so trivial either but that tested as working.

Change-Id: I4928d69b3b3be7fb93e259f81635232df9bd1df2
Reviewed-on: http://gerrit.rockbox.org/166
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested-by: Michael Sevakis <jethead71@rockbox.org>
2012-03-03 07:23:38 +01:00
Michael Sevakis 6d3a6f71d1 Remove obsolete init cruft from audio system because of diminished dependencies. All talk/voice dependency in playback.c should be imminently removable.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30401 a1c6a512-1295-4272-9138-f99709370657
2011-09-01 07:32:07 +00:00
Michael Sevakis 456170afdf Clean up and simplify the voice thread code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30386 a1c6a512-1295-4272-9138-f99709370657
2011-08-30 15:35:25 +00:00
Michael Sevakis d8cb05e31e Voice doesn't have to consume 100% CPU while waiting for an output buffer to be available. Use 'sleep(0)' instead of 'yield()' while polling.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30132 a1c6a512-1295-4272-9138-f99709370657
2011-07-08 23:39:01 +00:00
Michael Sevakis a2b6703a36 Commit FS#12150 - Fully-functional audio mixer - and finally whip old limitations about playback of voice and other sounds when paused. Channels are independent in state and amplitude. Fade on stop/pause is handled by the channel's volume control rather than global volume which means it now works from anywhere. Opens up the possibility of plugin sounds during music playback by merely adding an additional channel enum. If any PCM drivers were not properly modified, see one of the last comments in the task for a description of the simple change that is expected. Some params are tunable in firmware/export/pcm-mixer.h as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30097 a1c6a512-1295-4272-9138-f99709370657
2011-06-29 06:37:04 +00:00
Thomas Martitz 44cdce9b29 Base voice thread stack size on DEFAULT_STACK_SIZE, it's otherwise likely to overflow on app targets.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28783 a1c6a512-1295-4272-9138-f99709370657
2010-12-10 15:14:11 +00:00
Jeffrey Goode c8944c09c2 Voice buffer can be much, much smaller. Code cleanup, logf fix
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26354 a1c6a512-1295-4272-9138-f99709370657
2010-05-28 13:21:24 +00:00
Michael Sevakis d56999890f Make PCM->driver interface about as simple as it will get. Registered callback, zero data, alignment and stops are handled entirely inside pcm.c; driver merely calls fixed pcm.c callback. Remove pcm_record_more and do it just like playback; the original reason behind it isn't very practical in general. Everything checks out on supported targets. There wer some compat changes I can't check out on many unsupoorted but if there's a problem it will be a minor oops. Plugins become incompatible due to recording tweak-- full update. Sorted API.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26253 a1c6a512-1295-4272-9138-f99709370657
2010-05-24 16:42:32 +00:00
Thomas Martitz 50a6ca39ad Move c/h files implementing/defining standard library stuff into a new libc 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
2010-05-06 21:04:40 +00:00
Jeffrey Goode ab0a0bf0ad Another logf fix in voice_thread.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25832 a1c6a512-1295-4272-9138-f99709370657
2010-05-05 16:45:55 +00:00
Jeffrey Goode 09cd188596 Fix logf behavior in voice_thread.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25810 a1c6a512-1295-4272-9138-f99709370657
2010-05-04 14:43:01 +00:00
Michael Sevakis 8cfbd3604f Use cookies for thread identification instead of pointers directly which gives a buffer against wrongly identifying a thread when the slot is recycled (which has been nagging me for awhile). A slot gets 255 uses before it repeats. Everything gets incompatible so a full update is required.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19377 a1c6a512-1295-4272-9138-f99709370657
2008-12-10 08:57:10 +00:00
Michael Sevakis effceea229 Remove the event object in the kernel since it's rather extraneous at the moment. This makes the codecs and the plugins incompatible, so update fully.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18867 a1c6a512-1295-4272-9138-f99709370657
2008-10-23 13:13:00 +00:00
Stéphane Doyon c893affeef Accept FS#8918: Voice multiple thumbnails and talk race fixes.
-Allows loading multiple thumbnails back-to-back in the one thumbnail buffer.
-Mutex to prevent race conditions with talk queue indices and
thumbnail buffer state.
-Synchronous shutup.
-Shutup is a noop if no voice is queued.
-mp3_play_stop() does nothing until the audio thread is ready.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18046 a1c6a512-1295-4272-9138-f99709370657
2008-07-15 14:06:11 +00:00
Daniel Stenberg 2acc0ac542 Updated our source code header to explicitly mention that we are GPL v2 or
later. We still need to hunt down snippets used that are not. 1324 modified
files...
http://www.rockbox.org/mail/archive/rockbox-dev-archive-2008-06/0060.shtml


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17847 a1c6a512-1295-4272-9138-f99709370657
2008-06-28 18:10:04 +00:00
Michael Sevakis 05099149f1 Enable nocache sections using the linker. PP5022/4 must use SW_CORELOCK now with shared variables in DRAM (it seems swp(b) is at least partially broken on all PP or I'm doing something very wrong here :\). For core-shared data use SHAREDBSS/DATA_ATTR. NOCACHEBSS/DATA_ATTR is available whether or not single core is forced for static peripheral-DMA buffer allocation without use of the UNCACHED_ADDR macro in code and is likely useful on a non-PP target with a data cache (although not actually enabled in config.h and the .lds's in this commit).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16981 a1c6a512-1295-4272-9138-f99709370657
2008-04-06 04:34:57 +00:00
Nicolas Pennequin 4fd277481a Correct some windows line endings back to unix.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16877 a1c6a512-1295-4272-9138-f99709370657
2008-03-29 14:09:14 +00:00
Steve Bavin c9df8fd87b The const police raid playback.c, should be no change to behaviour.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16860 a1c6a512-1295-4272-9138-f99709370657
2008-03-28 11:24:24 +00:00
Michael Sevakis 27cf677339 Add a complete priority inheritance implementation to the scheduler (all mutex ownership and queue_send calls are inheritable). Priorities are differential so that dispatch depends on the runnable range of priorities. Codec priority can therefore be raised in small steps (pcmbuf updated to enable). Simplify the kernel functions to ease implementation and use the same kernel.c for both sim and target (I'm tired of maintaining two ;_). 1) Not sure if a minor audio break at first buffering issue will exist on large-sector disks (the main mutex speed issue was genuinely resolved earlier). At this point it's best dealt with at the buffering level. It seems a larger filechunk could be used again. 2) Perhaps 64-bit sims will have some minor issues (finicky) but a backroll of the code of concern there is a 5-minute job. All kernel objects become incompatible so a full rebuild and update is needed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16791 a1c6a512-1295-4272-9138-f99709370657
2008-03-25 02:34:12 +00:00
Michael Sevakis a9d73e5e68 A final queue_post in voice_stop via. talk_force_shutup can try stopping PCM too late and interfere PCM playback after plugins init IRAM or calling audio_get_buffer. Send the NULL message to the voice thread to ensure all messages are done.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15911 a1c6a512-1295-4272-9138-f99709370657
2007-12-11 14:04:03 +00:00
Thom Johansen 91c35ff773 Attempt at fixing the statusbar showing up late in some screens and circumstances.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15872 a1c6a512-1295-4272-9138-f99709370657
2007-12-04 15:11:45 +00:00
Stéphane Doyon 686b1144ba Have voice_wait wait for the PCM buffer to drain. It can only do this if
playback is NOT in progress, but that is indeed the case for the only caller
(shutting down message).


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15790 a1c6a512-1295-4272-9138-f99709370657
2007-11-24 14:21:04 +00:00
Thom Johansen 5076723120 Don't do lookahead skipping when stringing voice clips together.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15740 a1c6a512-1295-4272-9138-f99709370657
2007-11-21 17:21:38 +00:00