Commit graph

27 commits

Author SHA1 Message Date
Michael Sevakis
80d5267a9b More strictly enforce "no PCM insert" rules for codecs.
Takes care of when codecs try to sneak-in another PCM buffer insert
at the wrong time. Codecs are wiley and just can't always be trusted
to cooperate.

Change-Id: Idc2f51238a5fd69a9d9c0741fbc29addc6615bdf
2012-05-13 03:25:55 -04:00
Michael Sevakis
51a73d81cd Stop clickiness on manual track changes as best as possible.
Get the DSP_FLUSH sprinkled in the right spot so that history-
keeping prcessing stages are cleared on a forced stop. They already
were on a seek.

Change-Id: I560f1bc5fd813a4142fa099bf53ee1658e49cd8c
2012-05-07 04:13:50 -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
6a67707b5e Commit to certain names for cache coherency APIs and discard the aliases.
Wouldn't surprise me a bit to get some non-green.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31339 a1c6a512-1295-4272-9138-f99709370657
2011-12-17 07:27:24 +00: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
Andree Buschmann
e88d24a840 Submit parts of FS#12189 regarding codec API. Replaces access to global settings with a dedicated function to determine if the current track shall be looped. Used by several synthesizer codecs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30391 a1c6a512-1295-4272-9138-f99709370657
2011-08-30 19:40:09 +00:00
Michael Sevakis
7ad2cad173 Commit work started in FS#12153 to put timing/position information in PCM
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-28 07:45:35 +00:00
Michael Sevakis
96f02a9aa9 is_codec_thread() is not needed anymore since PCM buffer calls other than 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-21 22:25:09 +00:00
Andree Buschmann
1ee4e89627 Renaming for the sake of consistency.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29846 a1c6a512-1295-4272-9138-f99709370657
2011-05-09 19:34:45 +00:00
Andree Buschmann
d68d02ec11 Move implementation of codec_get_buffer() to codec.c, make related variables static.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29839 a1c6a512-1295-4272-9138-f99709370657
2011-05-08 20:18:35 +00:00
Michael Sevakis
c537d5958e Commit FS#12069 - Playback rework - first stages. Gives as thorough as 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-04-27 03:08:23 +00:00
Michael Sevakis
56dd75d204 Purge buffer and codec APIs existing exclusively in support of mpa.codec and fix that to not require them: buf_get_offset and ci.advance_buffer_loc. Sort APIs; everything must become incompatible. :(
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29595 a1c6a512-1295-4272-9138-f99709370657
2011-03-16 05:38:37 +00:00
Michael Sevakis
7d2ab2df5f Remove malloc_buf references from playback.c since it's no longer used for anything and align the codec slack space buffer that is now use as the malloc buffer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29533 a1c6a512-1295-4272-9138-f99709370657
2011-03-06 02:03:37 +00:00
Thomas Martitz
cc889e9d60 Change the thread api a bit.
* Remove THREAD_ID_CURRENT macro in favor of a thread_self() function, this allows thread functions to be simpler.
* thread_self_entry() shortcut for kernel.c.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29521 a1c6a512-1295-4272-9138-f99709370657
2011-03-05 17:48:06 +00:00
Michael Sevakis
6510973223 Give playback engine better control over the codec. Codec simply follows 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
2011-02-23 14:31:13 +00:00
Michael Sevakis
b15aa47c56 All kernel objects in code shared amongs targets (core, plugins, codecs) should be declared SHAREDBSS_ATTR as any core could potentially touch them even though they seem only to involve threads on one core. The exception is target code for particular CPUs where proper allocation is fixed. playlist.c was a little odd too-- use one mutex for the current playlist and a separate one for created playlists (still pondering the necessity of more than one).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29305 a1c6a512-1295-4272-9138-f99709370657
2011-02-14 11:27:45 +00:00
Andree Buschmann
7345ac124e Submit FS#11918: Add 2 more codec types to be able to differentiate between AAC / AAC-HE and MPC SV7 / SV8. Additionally handle ATARI soundfiles in get_codec_base_type() as intended.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29199 a1c6a512-1295-4272-9138-f99709370657
2011-02-03 08:28:23 +00:00
Jeffrey Goode
0db3308cb5 pcmbuf: bug fix with pcmbuf flush, code cleanup, added comments
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23608 a1c6a512-1295-4272-9138-f99709370657
2009-11-11 07:02:18 +00:00
Jeffrey Goode
9e0953432a Crossfade: carved out crossfade related code with lots of HAVE_CORSSFADE 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-10 03:46:08 +00:00
Jeffrey Goode
5c69a42d51 pcmbuf: more refactoring
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23588 a1c6a512-1295-4272-9138-f99709370657
2009-11-09 17:11:53 +00:00
Jeffrey Goode
20db9cc39e Playback: removed duplicate functions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23576 a1c6a512-1295-4272-9138-f99709370657
2009-11-09 05:43:19 +00:00
Jeffrey Goode
04b01e1831 pcmbuf: clarify and simplify crossfade code, etc.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23538 a1c6a512-1295-4272-9138-f99709370657
2009-11-05 21:59:36 +00:00
Jeffrey Goode
013fe35992 pcmbuf: better latency calculation, added debug code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23537 a1c6a512-1295-4272-9138-f99709370657
2009-11-05 17:32:32 +00:00
Jeffrey Goode
5ce8e2cb0d Clarify track transition code in pcmbuf and playback. No functional changes yet.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23506 a1c6a512-1295-4272-9138-f99709370657
2009-11-04 03:58:33 +00:00
Jeffrey Goode
e8eefe98bf Code cleanup in codec_thread, playback and pcmbuf; more elegant solution to leftover samples
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23471 a1c6a512-1295-4272-9138-f99709370657
2009-11-01 19:39:23 +00:00
Jeffrey Goode
9a4420bf96 FS#10739: playback.c code split
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23444 a1c6a512-1295-4272-9138-f99709370657
2009-10-31 19:17:36 +00:00