Commit Graph

14 Commits

Author SHA1 Message Date
Solomon Peachy 3027cead01 hosted: Improve buffer underrun handling in the ALSA driver
* Bump internal mix buffer size by 4x, to 1K frames (matching ALSA period)
 * Handle an underrun that occurs when filling the audio buffer
 * Log underruns and make them available in the debug info

Change-Id: I28d56dd35d88851fa167ad92368a5882937a758f
2020-11-18 14:38:12 -05:00
Solomon Peachy 90a4f28c27 jz47xx: Audio path tweaks:
* Increase audio buffer size to better handle IRQ latency (256->2048)
 * Ensure DMA engine is idle prior to starting transfers
 * Set AIC to repeat last sample in case of underflows

Change-Id: I9c45c20481ee072e5882b7586fb7d50bd8ef2f35
2020-09-04 15:57:00 -04:00
Udo Schläpfer dbabd0d9c3 iBasso DX50/DX90: Major code cleanup and reorganization.
Reorganization

- Separated iBasso devices from PLATFORM_ANDROID. These are now standlone
  hosted targets. Most device specific code is in the
  firmware/target/hosted/ibasso directory.
- No dependency on Android SDK, only the Android NDK is needed.
  32 bit Android NDK and Android API Level 16.
- Separate implementation for each device where feasible.

Code cleanup

- Rewrite of existing code, from simple reformat to complete reimplementation.
- New backlight interface, seperating backlight from touchscreen.
- Rewrite of device button handler, removing unneeded code and fixing memory
  leaks.
- New Debug messages interface logging to Android adb logcat (DEBUGF, panicf,
  logf).
- Rewrite of lcd device handler, removing unneeded code and fixing memory leaks.
- Rewrite of audiohw device handler/pcm interface, removing unneeded code and
  fixing memory leaks, enabling 44.1/48kHz pthreaded playback.
- Rewrite of power and powermng, proper shutdown, using batterylog results
  (see http://gerrit.rockbox.org/r/#/c/1047/).
- Rewrite of configure (Android NDK) and device specific config.
- Rewrite of the Android NDK specific Makefile.

Misc

- All plugins/games/demos activated.
- Update tinyalsa to latest from https://github.com/tinyalsa/tinyalsa.

Includes

- http://gerrit.rockbox.org/r/#/c/993/
- http://gerrit.rockbox.org/r/#/c/1010/
- http://gerrit.rockbox.org/r/#/c/1035/

Does not include http://gerrit.rockbox.org/r/#/c/1007/ due to new backlight
interface and new option for hold switch, touchscreen, physical button
interaction.

Rockbox needs the iBasso DX50/DX90 loader for startup, see
http://gerrit.rockbox.org/r/#/c/1099/

The loader expects Rockbox to be installed in /mnt/sdcard/.rockbox/. If
/mnt/sdcard/ is accessed as USB mass storage device, Rockbox will exit
gracefully and the loader will restart Rockbox on USB disconnect.

Tested on iBasso DX50.
Compiled (not tested) for iBasso DX90.
Compiled (not tested) for PLATFORM_ANDROID.

Change-Id: I5f5e22e68f5b4cf29c28e2b40b2c265f2beb7ab7
2015-02-02 21:57:55 +01: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 88aeef9127 Remove pointless IRAM allocation from voice DSP.
It's always used in MONO mode and doesn't need the IRAM sample/
resample buffers and 1280 bytes can be freed.

M5 can now have its PCM mixer downmix buffer in IRAM.

Change-Id: I0af08be5b212b7dfe382bba588a6585eb328a038
2012-05-04 22:00:44 -04: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 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
Thomas Jarosch 33d3f05d77 Nokia N900: Increase the number of samples for the software mixer
This lowers the CPU usage back to normal by around 15%.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31191 a1c6a512-1295-4272-9138-f99709370657
2011-12-09 20:04:41 +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 8c47ed15e9 Get M5 building again by moving the downmix buffer out of IRAM for now. Everything should still work. It doesn't have any apparently measurable effect on pure playback CPU usage as seen from the buffering thread screen compared to earlier tests on the same file.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30101 a1c6a512-1295-4272-9138-f99709370657
2011-06-29 13:43:47 +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