summaryrefslogtreecommitdiff
path: root/apps/codec_thread.c (follow)
Commit message (Collapse)AuthorAge
* Remove I/O priority. It is harmful when used with the new file code.Michael Sevakis2014-08-30
| | | | | | | | | | HAVE_IO_PRIORITY was defined for native targets with dircache. It is already effectively disabled for the most part since dircache no longer lowers its thread's I/O priority. It existed primarily for the aforementioned configuration. Change-Id: Ia04935305397ba14df34647c8ea29c2acaea92aa
* Do not include kernel.h in system.h.Thomas Martitz2014-01-05
| | | | | | | system.h doesn't need it on its own and this change makes it less dependant on Rockbox internals. Change-Id: I4e1e4108a52a7b599627a829204eb82b392fc6d6
* 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>
* SWCODEC Audio: Add some INIT_ATTR's to get a few bytes back.Michael Sevakis2013-06-29
| | | | Change-Id: Ie7b04ecf3b3535e0ed45a6e0e8d81af89e38378e
* Update software recording engine to latest codec interface.Michael Sevakis2013-06-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Basically, just give it a good rewrite. Software codec recording can be implemented in a more straightforward and simple manner and made more robust through the better codec control now available. Encoded audio buffer uses a packed format instead of fixed-size chunks and uses smaller data headers leading to more efficient usage. The greatest benefit is with a VBR format like wavpack which needs to request a maximum size but only actually ends up committing part of that request. No guard buffers are used for either PCM or encoded audio. PCM is read into the codec's provided buffer and mono conversion done at that time in the core if required. Any highly-specialized sample conversion is still done within the codec itself, such as 32-bit (wavpack) or interleaved mono (mp3). There is no longer a separate filename array. All metadata goes onto the main encoded audio buffer, eliminating any predermined file limit on the buffer as well as not wasting the space for unused path queue slots. The core and codec interface is less awkward and a bit more sensible. Some less useful interface features were removed. Threads are kept on narrow code paths ie. the audio thread never calls encoding functions and the codec thread never calls file functions as before. Codecs no longer call file functions directly. Writes are buffered in the core and data written to storage in larger chunks to speed up flushing of data. In fact, codecs are no longer aware of the stream being a file at all and have no access to the fd. SPDIF frequency detection no longer requires a restart of recording or plugging the source before entering the screen. It will poll for changes and update when stopped or prerecording (which does discard now-invalid prerecorded data). I've seen to it that writing a proper header on full disk works when the format makes it reasonably practical to do so. Other cases may have incorrect data sizes but sample info will be in tact. File left that way may play anyway. mp3_enc.codec acquires the ability to write 'Info' headers with LAME tags to make it gapless (bonus). Change-Id: I670685166d5eb32ef58ef317f50b8af766ceb653 Reviewed-on: http://gerrit.rockbox.org/493 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
* Refactor audio thread to run both recording and playback.Michael Sevakis2013-05-31
| | | | | | | | | | | | | | | | Eliminates the pcmrec thread and keeps playback and recording engine operation mutually-exclusive. audio_thread.c contains the audio thread which branches to the correct engine depending upon the request. It also handles the main audio initialization. Moves pcm_init into main.c just before dsp_init because I don't want that one in audio_init in the new file. (Also makes revision df6e1bc pointless ;) Change-Id: Ifc1db24404e6d8dd9ac42d9f4dfbc207aa9a26e1
* More strictly enforce "no PCM insert" rules for codecs.Michael Sevakis2012-05-13
| | | | | | | | 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
* Stop clickiness on manual track changes as best as possible.Michael Sevakis2012-05-07
| | | | | | | | 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
* 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>
* Commit to certain names for cache coherency APIs and discard the aliases.Michael Sevakis2011-12-17
| | | | | | | 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
* Remove obsolete init cruft from audio system because of diminished ↵Michael Sevakis2011-09-01
| | | | | | 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
* Submit parts of FS#12189 regarding codec API. Replaces access to global ↵Andree Buschmann2011-08-30
| | | | | | 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
* 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
* 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
* Renaming for the sake of consistency.Andree Buschmann2011-05-09
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29846 a1c6a512-1295-4272-9138-f99709370657
* Move implementation of codec_get_buffer() to codec.c, make related variables ↵Andree Buschmann2011-05-08
| | | | | | static. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29839 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
* Purge buffer and codec APIs existing exclusively in support of mpa.codec and ↵Michael Sevakis2011-03-16
| | | | | | 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
* Remove malloc_buf references from playback.c since it's no longer used for ↵Michael Sevakis2011-03-06
| | | | | | 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
* Change the thread api a bit.Thomas Martitz2011-03-05
| | | | | | | * 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
* 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
* All kernel objects in code shared amongs targets (core, plugins, codecs) ↵Michael Sevakis2011-02-14
| | | | | | 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
* Submit FS#11918: Add 2 more codec types to be able to differentiate between ↵Andree Buschmann2011-02-03
| | | | | | 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
* 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: 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: more refactoringJeffrey Goode2009-11-09
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23588 a1c6a512-1295-4272-9138-f99709370657
* Playback: removed duplicate functionsJeffrey Goode2009-11-09
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23576 a1c6a512-1295-4272-9138-f99709370657
* pcmbuf: clarify and simplify crossfade code, etc.Jeffrey Goode2009-11-05
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23538 a1c6a512-1295-4272-9138-f99709370657
* pcmbuf: better latency calculation, added debug codeJeffrey Goode2009-11-05
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23537 a1c6a512-1295-4272-9138-f99709370657
* Clarify track transition code in pcmbuf and playback. No functional changes yet.Jeffrey Goode2009-11-04
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23506 a1c6a512-1295-4272-9138-f99709370657
* Code cleanup in codec_thread, playback and pcmbuf; more elegant solution to ↵Jeffrey Goode2009-11-01
| | | | | | leftover samples git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23471 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