summaryrefslogtreecommitdiff
path: root/apps/pcmbuf.c (follow)
Commit message (Collapse)AuthorAge
* Fix a problem with audio not starting on a list of short filesMichael Sevakis2017-04-06
| | | | | | | | | | | | Forced audio start was left out when a third codec attempts to start a second track transition. Only one pending transition is allowed at a time. There wouldn't be enough PCM in the buffer to trigger audio playback and audio would just return without giving the pcm buffer a kick. Fixes FS#13100 - Player failed on short tracks Change-Id: I338b0b12022c591930451fd5ed26a2a73008835f
* Fix previous errors for targets with no crossfade.Michael Sevakis2017-01-05
| | | | Change-Id: I1c10f5588f3fe06c7071f3f07b68e3d552c44f05
* Playback: Fix problems with crossfade on short tracks.Michael Sevakis2017-01-05
| | | | | | | | | 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
* Enable setting of global output samplerate on certain targets.Michael Sevakis2013-07-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix a bug in pcmbuf.c when doing offset with modulus.Michael Sevakis2013-06-28
| | | | | | | | | | 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
* Fix whitespace for next commitMichael Sevakis2013-06-28
| | | | Change-Id: I8773ff7275372882321ebf2e66462781735cddc6
* Make rbcodec/dsp includes more specific.Michael Sevakis2012-04-29
| | | | Change-Id: Idb6af40df26f5b8499a40e8b98602261ef227044
* Fundamentally rewrite much of the audio DSP.Michael Sevakis2012-04-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix up some more type stuff in pcmbuf.c.Michael Sevakis2012-04-27
| | | | | | (Never seem to find it all at once :-) Change-Id: I4b3d145c6d90be13f9afc8a72d8d87a92de88d88
* Revise the PCM callback system after adding multichannel audio.Michael Sevakis2012-03-03
| | | | | | | | | | | | | | | | | | 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>
* crosfade_mix_fade should be returning size_t, not int.Michael Sevakis2012-02-21
| | | | | | | 'Twas a leftover from trying out counts instead of bytes when converting to timestamping that should have been reverted. Change-Id: I658c1a19e283025d991b7600378f97c6fc37db34
* pcmbuf minor cleaningMichael Sevakis2012-02-20
| | | | | | Group functions a bit better and expunge some obsolete function prototypes. Change-Id: Ifaf8a265dbe0a9f081e524b2e646e2dc50c6aa43
* Neaten up pcmbuf a bit with regards to differences determined by MEMORYSIZE.Michael Sevakis2012-01-20
| | | | Change-Id: Ie7ba930e3331fd48186c245bd8a30731017d688e
* Collect the 16-bit signed range sample clipping routines scattered about, ↵Michael Sevakis2011-12-04
| | | | | | 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
* Do a bandaid fix for the moment to address FS#12250 : Playback freezes when ↵Michael Sevakis2011-09-30
| | | | | | 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
* Restore functionality of pcmbuf_is_lowdata. It fell out of sync since the ↵Michael Sevakis2011-08-28
| | | | | | 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
* Remove INT_MAX from pcmbuf.c. Win32 sim compained about it and it isn't ↵Michael Sevakis2011-08-28
| | | | | | 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
* Commit work started in FS#12153 to put timing/position information in PCMMichael Sevakis2011-08-28
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Do sync between pcmbuf volume controls without explicit IRQ masking, which ↵Michael Sevakis2011-08-25
| | | | | | 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
* Fix a miscomment in pcmbuf.cMichael Sevakis2011-08-23
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30341 a1c6a512-1295-4272-9138-f99709370657
* Fix FS#12238 - WPS delay on pause introduced by r30097 which was the excuse ↵Michael Sevakis2011-08-23
| | | | | | 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
* is_codec_thread() is not needed anymore since PCM buffer calls other than ↵Michael Sevakis2011-07-21
| | | | | | 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
* The voice PCM buffer has nothing to do with the playback PCM buffer any ↵Michael Sevakis2011-07-09
| | | | | | 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
* Fix FS#12179 - Simulator build fails when using "configure --sdl-threads". ↵Michael Sevakis2011-07-06
| | | | | | 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
* Do some adjustments to alleviate IRAM congestion on some targets from ↵Michael Sevakis2011-06-29
| | | | | | 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
* Commit FS#12150 - Fully-functional audio mixer - and finally whip old ↵Michael Sevakis2011-06-29
| | | | | | 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
* Fix whitespace and some comment typosJeffrey Goode2011-05-09
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29850 a1c6a512-1295-4272-9138-f99709370657
* Commit FS#12069 - Playback rework - first stages. Gives as thorough as ↵Michael Sevakis2011-04-27
| | | | | | 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
* pcmbuf: Clear last_chunksize at stop so we don't think there's a buffer in ↵Michael Sevakis2011-02-25
| | | | | | progress. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29395 a1c6a512-1295-4272-9138-f99709370657
* Give playback engine better control over the codec. Codec simply follows ↵Michael Sevakis2011-02-23
| | | | | | 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
* Redo raising the priority of the codec (and voice) thread to fix audio ↵Thomas Martitz2010-12-22
| | | | | | | | | 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
* Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with ↵Thomas Martitz2010-06-21
| | | | | | | | | | | #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
* Voice buffer can be much, much smaller. Code cleanup, logf fixJeffrey Goode2010-05-28
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26354 a1c6a512-1295-4272-9138-f99709370657
* Fix crash when crossfading at natural track transition - FS#10814Steve Bavin2009-11-26
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23758 a1c6a512-1295-4272-9138-f99709370657
* pcmbuf: better debug info, reinstate flush variable clearJeffrey Goode2009-11-18
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23665 a1c6a512-1295-4272-9138-f99709370657
* Cleanup audio.h, related functionsJeffrey Goode2009-11-16
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23651 a1c6a512-1295-4272-9138-f99709370657
* pcmbuf cleanupJeffrey Goode2009-11-16
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23649 a1c6a512-1295-4272-9138-f99709370657
* pcmbuf: consolidate some similar codeJeffrey Goode2009-11-15
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23628 a1c6a512-1295-4272-9138-f99709370657
* Crossfade: crossfaded manual skips now start fading immediatelyJeffrey Goode2009-11-13
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23622 a1c6a512-1295-4272-9138-f99709370657
* Crossfade: fix shuffle OR manual skip functionality, verbiage and manualJeffrey Goode2009-11-12
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23621 a1c6a512-1295-4272-9138-f99709370657
* pcmbuf: consolidated some crossfade codeJeffrey Goode2009-11-12
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23618 a1c6a512-1295-4272-9138-f99709370657
* pcmbuf: bug fix with pcmbuf flush, code cleanup, added commentsJeffrey Goode2009-11-11
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23608 a1c6a512-1295-4272-9138-f99709370657
* Crossfade: added a new option, rewrote decision logic, updated manual and ↵Jeffrey Goode2009-11-11
| | | | | | 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
* HAVE_CROSSFADE defs: fix yellow and redJeffrey Goode2009-11-10
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23598 a1c6a512-1295-4272-9138-f99709370657
* Crossfade: carved out crossfade related code with lots of HAVE_CORSSFADE ↵Jeffrey Goode2009-11-10
| | | | | | conditionals, eliminated fade buffer on low memory targets git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23597 a1c6a512-1295-4272-9138-f99709370657
* pcmbuf: simplify crossfade logicJeffrey Goode2009-11-09
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23593 a1c6a512-1295-4272-9138-f99709370657
* pcmbuf: refactoringJeffrey Goode2009-11-09
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23592 a1c6a512-1295-4272-9138-f99709370657
* pcmbuf: more refactoringJeffrey Goode2009-11-09
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23588 a1c6a512-1295-4272-9138-f99709370657
* pcmbuf: eliminate add_chunk as a separate functionJeffrey Goode2009-11-09
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23582 a1c6a512-1295-4272-9138-f99709370657
* pcmbuf: fix yellow. More renaming.Jeffrey Goode2009-11-09
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23579 a1c6a512-1295-4272-9138-f99709370657