Commit graph

173 commits

Author SHA1 Message Date
Christian Soffke
69d08be083 Additional Single Mode options
In addition to the existing behavior of pausing
after each song, this adds options to pause
after playing current:

Album,
Album Artist,
Artist,
Composer,
Grouping / Work, or
Genre.

Allows you, for example, to only listen to the
remaining movements of a classical work
without having to purge your playlist of any
upcoming songs.

Change-Id: If18f4a5d139320026cc5fcc9adf29dd8e4e028a8
2021-12-11 11:43:39 -05:00
Moshe Piekarski
13ac485625 Add single playback mode
(FS#482)

Change-Id: I8b4c3e4ffb6975122153e82f2b9848c382195163
2021-11-05 09:20:04 -04:00
Michael Sevakis
5e4532c87c Fix a problem with audio not starting on a list of short files
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
2017-04-06 19:32:35 -04:00
Michael Sevakis
bc4c13ee8a Fix previous errors for targets with no crossfade.
Change-Id: I1c10f5588f3fe06c7071f3f07b68e3d552c44f05
2017-01-05 03:22:47 -05:00
Michael Sevakis
6c837394ca Playback: Fix problems with crossfade on short tracks.
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
2017-01-05 02:37:14 -05: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
662f7576bf Fix a bug in pcmbuf.c when doing offset with modulus.
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-28 02:17:58 -04:00
Michael Sevakis
363f96b95b Fix whitespace for next commit
Change-Id: I8773ff7275372882321ebf2e66462781735cddc6
2013-06-28 02:17:17 -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
fdd363481f Fix up some more type stuff in pcmbuf.c.
(Never seem to find it all at once :-)

Change-Id: I4b3d145c6d90be13f9afc8a72d8d87a92de88d88
2012-04-27 16:51:54 -04: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
72c41a3e72 crosfade_mix_fade should be returning size_t, not int.
'Twas a leftover from trying out counts instead of bytes when converting to
timestamping that should have been reverted.

Change-Id: I658c1a19e283025d991b7600378f97c6fc37db34
2012-02-21 05:05:00 -05:00
Michael Sevakis
5833cc181b pcmbuf minor cleaning
Group functions a bit better and expunge some obsolete function prototypes.

Change-Id: Ifaf8a265dbe0a9f081e524b2e646e2dc50c6aa43
2012-02-20 00:47:21 -05:00
Michael Sevakis
c7f3a0b360 Neaten up pcmbuf a bit with regards to differences determined by MEMORYSIZE.
Change-Id: Ie7ba930e3331fd48186c245bd8a30731017d688e
2012-01-20 18:10:12 -05:00
Michael Sevakis
a43df152c2 Collect the 16-bit signed range sample clipping routines scattered about, 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-12-04 18:19:39 +00:00
Michael Sevakis
11cbffa584 Do a bandaid fix for the moment to address FS#12250 : Playback freezes when 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-09-30 06:46:19 +00:00
Michael Sevakis
31567306e7 Restore functionality of pcmbuf_is_lowdata. It fell out of sync since the 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-28 14:26:59 +00:00
Michael Sevakis
9384cda2bb Remove INT_MAX from pcmbuf.c. Win32 sim compained about it and it isn't 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-28 08:59:14 +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
697aa7f499 Do sync between pcmbuf volume controls without explicit IRQ masking, which 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-25 00:12:19 +00:00
Michael Sevakis
4d903f27c3 Fix a miscomment in pcmbuf.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30341 a1c6a512-1295-4272-9138-f99709370657
2011-08-23 05:58:28 +00:00
Michael Sevakis
5078d460c6 Fix FS#12238 - WPS delay on pause introduced by r30097 which was the excuse 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-08-23 01:37:59 +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
Michael Sevakis
a802ebac06 The voice PCM buffer has nothing to do with the playback PCM buffer any 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-09 01:49:00 +00:00
Michael Sevakis
185fddbd66 Fix FS#12179 - Simulator build fails when using "configure --sdl-threads". 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-07-06 02:21:25 +00:00
Michael Sevakis
5ff641fb81 Do some adjustments to alleviate IRAM congestion on some targets from 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-29 09:39:13 +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
Jeffrey Goode
8cb4b36ee3 Fix whitespace and some comment typos
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29850 a1c6a512-1295-4272-9138-f99709370657
2011-05-09 21:52:06 +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
ba8ce00bfc pcmbuf: Clear last_chunksize at stop so we don't think there's a buffer in progress.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29395 a1c6a512-1295-4272-9138-f99709370657
2011-02-25 03:51:52 +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
Thomas Martitz
9afb55ad95 Redo raising the priority of the codec (and voice) thread to fix audio 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-12-22 16:03:15 +00:00
Thomas Martitz
35e8b1429a Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with #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-06-21 16:53:00 +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
Steve Bavin
b2dc7f004e Fix crash when crossfading at natural track transition - FS#10814
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23758 a1c6a512-1295-4272-9138-f99709370657
2009-11-26 14:41:31 +00:00
Jeffrey Goode
84ca236c30 pcmbuf: better debug info, reinstate flush variable clear
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23665 a1c6a512-1295-4272-9138-f99709370657
2009-11-18 20:56:19 +00:00
Jeffrey Goode
db82be4390 Cleanup audio.h, related functions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23651 a1c6a512-1295-4272-9138-f99709370657
2009-11-16 20:09:46 +00:00
Jeffrey Goode
ba9280d5f4 pcmbuf cleanup
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23649 a1c6a512-1295-4272-9138-f99709370657
2009-11-16 04:42:34 +00:00
Jeffrey Goode
873c5b6d18 pcmbuf: consolidate some similar code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23628 a1c6a512-1295-4272-9138-f99709370657
2009-11-15 04:57:40 +00:00
Jeffrey Goode
d1963e14de Crossfade: crossfaded manual skips now start fading immediately
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23622 a1c6a512-1295-4272-9138-f99709370657
2009-11-13 21:58:41 +00:00
Jeffrey Goode
29d2711115 Crossfade: fix shuffle OR manual skip functionality, verbiage and manual
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23621 a1c6a512-1295-4272-9138-f99709370657
2009-11-12 15:42:37 +00:00
Jeffrey Goode
15351e8137 pcmbuf: consolidated some crossfade code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23618 a1c6a512-1295-4272-9138-f99709370657
2009-11-12 04:24:41 +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
664dc90e71 Crossfade: added a new option, rewrote decision logic, updated manual and 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-11 00:48:17 +00:00
Jeffrey Goode
dd93ef41bb HAVE_CROSSFADE defs: fix yellow and red
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23598 a1c6a512-1295-4272-9138-f99709370657
2009-11-10 04:21:40 +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
cc4d92c270 pcmbuf: simplify crossfade logic
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23593 a1c6a512-1295-4272-9138-f99709370657
2009-11-09 19:34:01 +00:00
Jeffrey Goode
874c911464 pcmbuf: refactoring
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23592 a1c6a512-1295-4272-9138-f99709370657
2009-11-09 18:12:20 +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