summaryrefslogtreecommitdiff
path: root/apps/pcmbuf.c
AgeCommit message (Collapse)Author
2017-01-05Fix previous errors for targets with no crossfade.Michael Sevakis
Change-Id: I1c10f5588f3fe06c7071f3f07b68e3d552c44f05
2017-01-05Playback: Fix problems with crossfade on short tracks.Michael Sevakis
Addresses issues brought up in this thread: http://forums.rockbox.org/index.php/topic,51605.0.html While we're at it, improve the quality with a sample-level fader. Change-Id: I73dde60d6858a1c9042812e26d490739e3906a1e
2013-07-06Enable setting of global output samplerate on certain targets.Michael Sevakis
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-06-28Fix a bug in pcmbuf.c when doing offset with modulus.Michael Sevakis
Causes the track change to go in the wrong buffer (and even be missed by playback) if the current descriptor for the write index is descriptor 0 because the offset used is "-1" upon track change. Got nailed by implicit conversion of the % operator dividend to unsigned. Change-Id: I32538db801ac9d790c8b1b5bd041b09ad4b64d2e
2013-06-28Fix whitespace for next commitMichael Sevakis
Change-Id: I8773ff7275372882321ebf2e66462781735cddc6
2012-04-29Make rbcodec/dsp includes more specific.Michael Sevakis
Change-Id: Idb6af40df26f5b8499a40e8b98602261ef227044
2012-04-29Fundamentally rewrite much of the audio DSP.Michael Sevakis
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-27Fix up some more type stuff in pcmbuf.c.Michael Sevakis
(Never seem to find it all at once :-) Change-Id: I4b3d145c6d90be13f9afc8a72d8d87a92de88d88
2012-03-03Revise the PCM callback system after adding multichannel audio.Michael Sevakis
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-02-21crosfade_mix_fade should be returning size_t, not int.Michael Sevakis
'Twas a leftover from trying out counts instead of bytes when converting to timestamping that should have been reverted. Change-Id: I658c1a19e283025d991b7600378f97c6fc37db34
2012-02-20pcmbuf minor cleaningMichael Sevakis
Group functions a bit better and expunge some obsolete function prototypes. Change-Id: Ifaf8a265dbe0a9f081e524b2e646e2dc50c6aa43
2012-01-20Neaten up pcmbuf a bit with regards to differences determined by MEMORYSIZE.Michael Sevakis
Change-Id: Ie7ba930e3331fd48186c245bd8a30731017d688e
2011-12-04Collect the 16-bit signed range sample clipping routines scattered about, ↵Michael Sevakis
which can be optimized on armv6 and create firmware/export/dsp-util.h (for lack of better place right now). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31142 a1c6a512-1295-4272-9138-f99709370657
2011-09-30Do a bandaid fix for the moment to address FS#12250 : Playback freezes when ↵Michael Sevakis
using speed or pitch change. Task should remain open for now since this is just a brute force buffer increase rather than (re)endowing the DSP with the expected behavior. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30621 a1c6a512-1295-4272-9138-f99709370657
2011-08-28Restore functionality of pcmbuf_is_lowdata. It fell out of sync since the ↵Michael Sevakis
mixer code and then an incorrect change unintentionally remained in r30366. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30369 a1c6a512-1295-4272-9138-f99709370657
2011-08-28Remove INT_MAX from pcmbuf.c. Win32 sim compained about it and it isn't ↵Michael Sevakis
specifically important enough for another #include - it just needs a great enough value to cover any remaining data. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30367 a1c6a512-1295-4272-9138-f99709370657
2011-08-28Commit work started in FS#12153 to put timing/position information in PCMMichael Sevakis
buffer chunks. * Samples and position indication is closely associated with audio data instead of compensating by a latency constant. Alleviates problems with using the elapsed as a track indicator where it could be off by several steps. * Timing is accurate throughout track even if resampling for pitch shift, whereas before it updated during transition latency at the normal 1:1 rate. * Simpler PCM buffer with a constant chunk size, no linked lists. In converting crossfade, a minor change was made to not change the WPS until the fade-in of the incoming track, whereas before it would change upon the start of the fade-out of the outgoing track possibly having the WPS change with far too much lead time. Codec changes are to set elapsed times *before* writing next PCM frame because time and position data last set are saved in the next committed PCM chunk. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30366 a1c6a512-1295-4272-9138-f99709370657
2011-08-25Do sync between pcmbuf volume controls without explicit IRQ masking, which ↵Michael Sevakis
is nicer and also allows pcmbuf.c to compile again as thumb code. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30344 a1c6a512-1295-4272-9138-f99709370657
2011-08-23Fix a miscomment in pcmbuf.cMichael Sevakis
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30341 a1c6a512-1295-4272-9138-f99709370657
2011-08-23Fix FS#12238 - WPS delay on pause introduced by r30097 which was the excuse ↵Michael Sevakis
I wanted anyway to do a better PCM fade on stop/pause implementation. New fade is asynchronous tick-based. Restores skin update points in the WPS that were removed when fading mechanism was changed. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30340 a1c6a512-1295-4272-9138-f99709370657
2011-07-21is_codec_thread() is not needed anymore since PCM buffer calls other than ↵Michael Sevakis
volume level are no longer made by the voice thread. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30189 a1c6a512-1295-4272-9138-f99709370657
2011-07-09The voice PCM buffer has nothing to do with the playback PCM buffer any ↵Michael Sevakis
longer. Allocate it independently from the playback engine's PCM buffer and only when voice is required. Additionally, allocate actual space for the crossfade buffer only when using crossfade. Will save 18.3KB when neither is needed (10.3KB for voice and 8.0KB for crossfade). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30133 a1c6a512-1295-4272-9138-f99709370657
2011-07-06Fix FS#12179 - Simulator build fails when using "configure --sdl-threads". ↵Michael Sevakis
HAVE_PRIORITY_SCHEDULING checks were missing to exclude priority calls when building without priority. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30124 a1c6a512-1295-4272-9138-f99709370657
2011-06-29Do some adjustments to alleviate IRAM congestion on some targets from ↵Michael Sevakis
r30097. Include removing pointless IRAM declarations in pcmbuf.c because that callback code runs at a fairly relaxed pace. M5 is still the biggest problem. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30100 a1c6a512-1295-4272-9138-f99709370657
2011-06-29Commit FS#12150 - Fully-functional audio mixer - and finally whip old ↵Michael Sevakis
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-05-09Fix whitespace and some comment typosJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29850 a1c6a512-1295-4272-9138-f99709370657
2011-04-27Commit FS#12069 - Playback rework - first stages. Gives as thorough as ↵Michael Sevakis
possible a treatment of codec management, track change and metadata logic as possible while maintaining fairly narrow focus and not rewriting everything all at once. Please see the rockbox-dev mail archive on 2011-04-25 (Playback engine rework) for a more thorough manifest of what was addressed. Plugins and codecs become incompatible. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29785 a1c6a512-1295-4272-9138-f99709370657
2011-02-25pcmbuf: Clear last_chunksize at stop so we don't think there's a buffer in ↵Michael Sevakis
progress. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29395 a1c6a512-1295-4272-9138-f99709370657
2011-02-23Give playback engine better control over the codec. Codec simply follows ↵Michael Sevakis
commands and doesn't concern itself with audio state. Get track change notification in on the actual last buffer insert of the track because now audio simply waits for a track change notify from PCM on the last track and it must be sent reliably. This is still at an intermediate stage but works. Codecs and plugins become incompatible. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29387 a1c6a512-1295-4272-9138-f99709370657
2010-12-22Redo raising the priority of the codec (and voice) thread to fix audio ↵Thomas Martitz
dropouts under heavy UI load, such as during kinetic scrolling or pictureflow. Now it'll raise the priority gradually when under 70% and gradually decrease again in the same way. Previously it raised gradually when under 17% (way too late) and went straight back to default priority above 17% again. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28877 a1c6a512-1295-4272-9138-f99709370657
2010-06-21Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with ↵Thomas Martitz
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) (or equivalently). The simulator defines PLATFORM_HOSTED, as RaaA will do (RaaA will not define SIMULATOR). The new define is to (de-)select code to compile on hosted platforms generally. Should be no functional change to targets or the simulator. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27019 a1c6a512-1295-4272-9138-f99709370657
2010-05-28Voice buffer can be much, much smaller. Code cleanup, logf fixJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26354 a1c6a512-1295-4272-9138-f99709370657
2009-11-26Fix crash when crossfading at natural track transition - FS#10814Steve Bavin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23758 a1c6a512-1295-4272-9138-f99709370657
2009-11-18pcmbuf: better debug info, reinstate flush variable clearJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23665 a1c6a512-1295-4272-9138-f99709370657
2009-11-16Cleanup audio.h, related functionsJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23651 a1c6a512-1295-4272-9138-f99709370657
2009-11-16pcmbuf cleanupJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23649 a1c6a512-1295-4272-9138-f99709370657
2009-11-15pcmbuf: consolidate some similar codeJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23628 a1c6a512-1295-4272-9138-f99709370657
2009-11-13Crossfade: crossfaded manual skips now start fading immediatelyJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23622 a1c6a512-1295-4272-9138-f99709370657
2009-11-12Crossfade: fix shuffle OR manual skip functionality, verbiage and manualJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23621 a1c6a512-1295-4272-9138-f99709370657
2009-11-12pcmbuf: consolidated some crossfade codeJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23618 a1c6a512-1295-4272-9138-f99709370657
2009-11-11pcmbuf: bug fix with pcmbuf flush, code cleanup, added commentsJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23608 a1c6a512-1295-4272-9138-f99709370657
2009-11-11Crossfade: added a new option, rewrote decision logic, updated manual and ↵Jeffrey Goode
menus. Translators please note that updated translations may be required for some crossfade menu items! git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23605 a1c6a512-1295-4272-9138-f99709370657
2009-11-10HAVE_CROSSFADE defs: fix yellow and redJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23598 a1c6a512-1295-4272-9138-f99709370657
2009-11-10Crossfade: carved out crossfade related code with lots of HAVE_CORSSFADE ↵Jeffrey Goode
conditionals, eliminated fade buffer on low memory targets git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23597 a1c6a512-1295-4272-9138-f99709370657
2009-11-09pcmbuf: simplify crossfade logicJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23593 a1c6a512-1295-4272-9138-f99709370657
2009-11-09pcmbuf: refactoringJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23592 a1c6a512-1295-4272-9138-f99709370657
2009-11-09pcmbuf: more refactoringJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23588 a1c6a512-1295-4272-9138-f99709370657
2009-11-09pcmbuf: eliminate add_chunk as a separate functionJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23582 a1c6a512-1295-4272-9138-f99709370657
2009-11-09pcmbuf: fix yellow. More renaming.Jeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23579 a1c6a512-1295-4272-9138-f99709370657
2009-11-09pcmbuf: refactoring, renamed confusing variables, moved some code around, ↵Jeffrey Goode
but still no functional changes git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23577 a1c6a512-1295-4272-9138-f99709370657