Commit Graph

20 Commits

Author SHA1 Message Date
Solomon Peachy ec2a34b321 pcm_mixer: Fix an idle frame calculation bug introduced in 2e708c48c5
Resulted in playback sometimes hanging after switching tracks

Change-Id: I3d7a3c131cf547206ec536d9818c5060113f2b11
2020-10-24 02:00:50 +00:00
Solomon Peachy 2e708c48c5 pcm: Dynamically-size the mixer buffer at higher audio bitrates.
Basically, existing sizes apply for <= 48KHz audio. Up to 96K,
we double the mix buffer.  up to 192K, we double it again.

Will help reduce the interrupt load and overall latency, keeping it
roughtly constant as a function of time, regardless of bitrate.

(It is acutally a fixed-size buffer, statically-allocated to handle the
 worst-case bitrate the player supports. However, at runtime if we are
 using a lower bitrate we will only use a portion of it in order to keep
 latancies down)

Change-Id: I61ca23180a86502732b0903fe9691c1a8c2aeaea
2020-10-03 14:19:17 -04: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 0f8aedbe94 Add a true waveform display to the oscilloscope plugin.
* Adds some additional niftyness like a floating popup display that
is implemented in an OSD library for use by other plugins.

* Speed changes are now gradual for both views and follow a curve
derived from some fiddling around to get a nice feel.

* Refined a few behavioral things overall.

It needs a bit of help from a direct PCM channel callback so it may
capture PCM for waveform display. Also need a few other core routines
to help out for the OSD.

Messes with some keymaps. Some targets need keymaps to access the
different views. Some devices can't support the additional view
because it requires a large buffer ( > 1 s) for samples.

If the plugin buffer is small, they can still use the popup display
since the plugin is also much smaller in that case.

Slow speed waveform needs some refining so it draws gradually like
a real oscilloscope but I'll stick with what it is, for the moment.

Change-Id: Ieb5b7922a2238264e9b19a58cb437739194eb036
Reviewed-on: http://gerrit.rockbox.org/245
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested-by: Michael Sevakis <jethead71@rockbox.org>
2012-12-05 02:03:58 +01:00
Michael Sevakis e189b33ff4 Clean up peak calculating code.
Mixer needn't keep peak data around that will never be used. Just
pass pcm_peaks structure to it instead of allocating for every
channel. Plugin API becomes incompatible.

vu_meter digital mode was still using global peak calculation;
switch it to playback channel like the rest.

Remove some accumulated soil peaks inside pcm.c and make it more
generic.

Change-Id: Ib4d268d80b6a9d09915eea1c91eab483c1a2c009
2012-05-02 20:53:07 -04:00
Michael Sevakis da6cebb6b0 Use buflib for the allocation of voice PCM resources.
Buffers are not allocated and thread is not created until the first
call where voice is required.

Adds a different callback (sync_callback) to buflib so that other
sorts of synchonization are possible, such as briefly locking-out the
PCM callback for a buffer move. It's sort of a messy addition but it
is needed so voice decoding won't have to be stopped when its buffer
is moved.

Change-Id: I4d4d8c35eed5dd15fb7ee7df9323af3d036e92b3
2012-05-02 17:22:28 -04:00
Michael Sevakis 56f17c4164 Make rbcodec/dsp includes more specific.
Change-Id: Idb6af40df26f5b8499a40e8b98602261ef227044
2012-04-29 17:31:30 -04:00
Michael Sevakis 64bb720edf Coldfire: Optimize emac context save/restore in mixer ISR.
Save only once if emac is used in ISR and restore only once per ISR
call if already saved.

Change-Id: I0e40db5d4aab2a8552480f76873f59ff6ccd9977
Reviewed-on: http://gerrit.rockbox.org/176
Tested-by: Michael Sevakis <jethead71@rockbox.org>
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
2012-03-12 00:16:12 +01: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 9a25a6fe19 beep/mixer code: Code police a bit.
/firmware is in the #include path with makes #include "asm/beep.c" sufficient.

Add a comment to generic beep code and make another express intent better.

Change-Id: I587cd704478b894785927bdfe2e647e28614df62
2012-02-19 00:38:58 -05:00
Michael Sevakis 39eec730b0 PCM mixer: Simplify mixer_channel_play_data.
Streamline it to do fewer PCM lock calls in the case of having a prepared
buffer.

Change-Id: I7fca2b95cc5da314ae257522bb6f1ad7aec6634a
2012-02-17 03:54:45 -05:00
Thomas Martitz 3c17f28eca Move pcm_mixer helper routines to firmware/asm. 2012-01-22 18:46:45 +01:00
Michael Sevakis 395334e876 PCM mixer: Get rid of an obsolete macro cruft.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31577 a1c6a512-1295-4272-9138-f99709370657
2012-01-04 11:03:15 +00:00
Thomas Martitz 249bba03f1 Initial commit of the Samsung YP-R0 port.
This port is a hybrid native/RaaA port. It runs on a embedded linux system,
but is the only application. It therefore can implement lots of stuff that
native targets also implement, while leveraging the underlying linux kernel.

The port is quite advanced. User interface, audio playback, plugins work
mostly fine. Missing is e.g. power mangement and USB (see SamsungYPR0 wiki page).

Included in utils/ypr0tools are scripts and programs required to generate
a patched firmware. The patched firmware has the rootfs modified to load
Rockbox. It includes a early/safe USB mode.

This port needs a new toolchain, one that includes glibc headers and libraries.
rockboxdev.sh can generate it, but e.g. codesourcey and distro packages may
also work.

Most of the initial effort is done by Lorenzo Miori and others (on ABI),
including reverse engineering and patching of the original firmware,
initial drivers, and more. Big thanks to you.

Flyspray: FS#12348
Author: Lorenzo Miori, myself

Merry christmas to ypr0 owners! :)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31415 a1c6a512-1295-4272-9138-f99709370657
2011-12-24 11:56:46 +00:00
Michael Sevakis 906905aa43 Use a macro for aligning PCM chunks instead of explictly coding it each time.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31152 a1c6a512-1295-4272-9138-f99709370657
2011-12-05 13:58:35 +00: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 22b6def065 Use playback channel directly for peakmeters and plugins using peak calculation. Also, for now, don't allow mixer playback to overlap recording, even if full duplex works.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30119 a1c6a512-1295-4272-9138-f99709370657
2011-07-02 11:55:38 +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 40ff07140d Get android to build. Forgo optimized mixing code for app builds for the moment; work it out later.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30099 a1c6a512-1295-4272-9138-f99709370657
2011-06-29 07:47:29 +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