Commit graph

49 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
b6f15f2c95 pcmbuf: moved some functions around, no functional changes yet
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23565 a1c6a512-1295-4272-9138-f99709370657
2009-11-08 04:27:27 +00:00
Jeffrey Goode
37adbee236 pcmbuf: sorted functions into logical sections for readability. Tiny changes, nothing functional
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23541 a1c6a512-1295-4272-9138-f99709370657
2009-11-06 04:13:36 +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
cf19ba5599 Replace limiter with dynamic range compressor
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22832 a1c6a512-1295-4272-9138-f99709370657
2009-09-25 15:46:38 +00:00
Jeffrey Goode
2b7ef6b928 FS#10199: Adds limiter DSP function
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22394 a1c6a512-1295-4272-9138-f99709370657
2009-08-18 03:24:45 +00:00
Dan Everton
d52c6614c5 Commit FS#10335 from Jeffrey Goode.
Ensure that the PCM buffer is flushed at the end of the last track in a
playlist.



git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21316 a1c6a512-1295-4272-9138-f99709370657
2009-06-17 08:47:51 +00:00
Björn Stenberg
6427d127aa Calculate watermark from bitrate and harddisk spinup time.
Use a smaller PCM buffer on targets with 2MB or less ram.
(FS#9703)


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19743 a1c6a512-1295-4272-9138-f99709370657
2009-01-10 21:10:56 +00:00
Daniel Stenberg
2acc0ac542 Updated our source code header to explicitly mention that we are GPL v2 or
later. We still need to hunt down snippets used that are not. 1324 modified
files...
http://www.rockbox.org/mail/archive/rockbox-dev-archive-2008-06/0060.shtml


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17847 a1c6a512-1295-4272-9138-f99709370657
2008-06-28 18:10:04 +00:00
Bertrik Sikken
7f4a713af4 Removed unused function get_pcmbuf_descsize from pcmbuf.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17175 a1c6a512-1295-4272-9138-f99709370657
2008-04-19 23:08:13 +00:00
Steve Bavin
135cc757bd Revert my earlier const madness, we'll keep the parameter lists simple.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16863 a1c6a512-1295-4272-9138-f99709370657
2008-03-28 12:51:33 +00:00
Steve Bavin
c9df8fd87b The const police raid playback.c, should be no change to behaviour.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16860 a1c6a512-1295-4272-9138-f99709370657
2008-03-28 11:24:24 +00:00
Michael Sevakis
99617d71ba Make speex the new voice format for SWCODEC targets (non-Archos). Remove codec swapping and build speex voice decoding directly into the core binary.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15668 a1c6a512-1295-4272-9138-f99709370657
2007-11-18 17:12:19 +00:00
Dave Chapman
f02cba8096 Code cleaning - remove some unnecessary defined(SIMULATOR) checks
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13369 a1c6a512-1295-4272-9138-f99709370657
2007-05-10 13:16:08 +00:00
Michael Sevakis
e1dd10ddfb SWCODEC: Get rid of extra swap buffer and get back 512K of RAM or 100K if the players RAM is <= 1MB. Make any needed changes to things to stabilize and facilitate this including removing flattening out initialization. Comment some things heavily. Fix a few logfs I didn't want to see the compiler complaining about.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12843 a1c6a512-1295-4272-9138-f99709370657
2007-03-19 22:04:17 +00:00
Michael Sevakis
aba6ca0881 Fix resampling clicking as much as possible at the moment. 1) Upsampling clicked because of size inaccuracies returned by DSP. Fix by simplifying audio system to use per-channel sample count from codec to pcm buffer. 2) Downsampling affected by 1) and was often starting passed the end of the data when not enough was available to generate an output sample. Fix by clamping input range to last sample in buffer and using the last sample value in the buffer. A perfect fix will require a double buffering scheme on the resampler to sufficient data during small data transients on both ends at all times of the down ratio on input and the up ratio on output.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12218 a1c6a512-1295-4272-9138-f99709370657
2007-02-07 00:51:50 +00:00
Michael Sevakis
0f5cb94aa4 Big Patch adds primarily: Samplerate and format selection to recording for SWCODEC. Supprort for samplerates changing in playback (just goes with the recording part inseparably). Samplerates to all encoders. Encoders can be configured individually on a menu specific to the encoder in the recording menu. File creation is delayed until flush time to reduce spinups when splitting. Misc: statusbar icons for numbers are individual digits to display any number. Audio buffer was rearranged to maximize memory available to recording and properly reinitialized when trashed. ColdFire PCM stuff moved to target tree to avoid a complicated mess when adding samplerate switching. Some needed API changes and to neaten up growing gap between hardware and software codecs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11452 a1c6a512-1295-4272-9138-f99709370657
2006-11-06 18:07:30 +00:00
Miika Pekkarinen
7058752789 Removed ugly boosting solutions from playback code and let scheduler
handle unboosting instead.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11226 a1c6a512-1295-4272-9138-f99709370657
2006-10-15 11:57:52 +00:00
Steve Bavin
10befc8e6e Don't unboost CPU in an ISR
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11224 a1c6a512-1295-4272-9138-f99709370657
2006-10-15 11:03:26 +00:00
Dave Chapman
0a7ded3e29 Memory size checks in .c/.h files should use MEM, not MEMORYSIZE
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10557 a1c6a512-1295-4272-9138-f99709370657
2006-08-13 09:19:24 +00:00
Tomasz Malesinski
28910e7e17 Various lower limits and sizes for targets with 1MB of RAM (Iriver iFP7xx).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10556 a1c6a512-1295-4272-9138-f99709370657
2006-08-12 23:01:52 +00:00
Brandon Low
ddaf5f096c Revert a previous change, works around the problem of freezing on stop-while-paused, and skipping with crossfade
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9889 a1c6a512-1295-4272-9138-f99709370657
2006-05-08 11:03:19 +00:00
Brandon Low
6c0908b416 Rework crossfade to properly follow pcmbuf chunks instaed of blindly inserting into the ring buffer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9780 a1c6a512-1295-4272-9138-f99709370657
2006-04-23 22:54:34 +00:00
Brandon Low
f3bc1efc49 First commit of reworking voice to be mroe stable on swcodec
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9758 a1c6a512-1295-4272-9138-f99709370657
2006-04-22 14:40:13 +00:00
Brandon Low
9535a9a639 Fix some of the voice and beep bugs that people have noticed since my new pcmbuf code went in, reduce code duplication, and improve performance while I'm at it
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8775 a1c6a512-1295-4272-9138-f99709370657
2006-02-22 01:56:44 +00:00
Brandon Low
413da2a3d9 Rework PCM buffer
* Linked list instead of static array buffer pointers
* Variable sized chunks
* Improved mix handling
* Reduction in duplicated code
* Reduced IRAM usage w/o sacrificing performance
* Converted to almost entirely unsigned math
* Add pause function to reduce pcm_* exposure to playback.

This WILL break playback on the iPod until linuxstb makes a followup commit.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8612 a1c6a512-1295-4272-9138-f99709370657
2006-02-07 20:38:55 +00:00
Miika Pekkarinen
4408b6b70c Reduce latency when configuring the EQ.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8609 a1c6a512-1295-4272-9138-f99709370657
2006-02-07 19:17:51 +00:00
Miika Pekkarinen
a4f8d1c621 Don't use crossfader mix mode when skipping tracks manually.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8470 a1c6a512-1295-4272-9138-f99709370657
2006-01-27 16:25:44 +00:00
Brandon Low
a3868d35d3 Continue to update playback status after decoding is complete (the progress bar makes it to 100%!)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8407 a1c6a512-1295-4272-9138-f99709370657
2006-01-21 22:42:44 +00:00
Miika Pekkarinen
e7461b3609 iRiver: New crossfader with more configuration capability. Might still
have small bugs, but those will be fixed as soon as possible. Config
block version bumped; please SAVE YOUR SETTINGS.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7765 a1c6a512-1295-4272-9138-f99709370657
2005-11-06 16:40:20 +00:00
Miika Pekkarinen
65d43a2d22 Define empty macros for cpu boosting on targets with no such a feature.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7412 a1c6a512-1295-4272-9138-f99709370657
2005-08-28 19:55:30 +00:00
Miika Pekkarinen
29aad55d97 Fixed iriver cpu boosting problems.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7410 a1c6a512-1295-4272-9138-f99709370657
2005-08-28 14:16:03 +00:00
Miika Pekkarinen
159c52dd36 Initial voice ui support for software codec platforms. Added also a
beep when changing tracks.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7360 a1c6a512-1295-4272-9138-f99709370657
2005-08-20 11:13:19 +00:00
Miika Pekkarinen
90161c92dd It's now possible to select the crossfading mode: "Off, Crossfade,
Mix". If set to mix, no fading is applied but tracks are mixed up.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7224 a1c6a512-1295-4272-9138-f99709370657
2005-07-22 16:46:27 +00:00
Miika Pekkarinen
f090dc3829 Crossfade (and pcm buffer size) length is now configurable.
Implemented anti-skip buffer setting for iriver also. Settings block
bumped up, PLEASE SAVE YOUR SETTINGS BEFORE UPGRADING.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7210 a1c6a512-1295-4272-9138-f99709370657
2005-07-21 11:44:00 +00:00
Miika Pekkarinen
20b3897474 Separated buffering stuff from pcm_playback to pcmbuf. Renamed some
function calls (audiobuffer -> pcmbuf etc.).


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7131 a1c6a512-1295-4272-9138-f99709370657
2005-07-13 12:48:22 +00:00