Commit graph

36661 commits

Author SHA1 Message Date
William Wilgus
91c8633e8c [BugFix] font.c filename was movable
stupid bug on my part font_filename was pointing to a movable
alloc therefore that data could be moved out from under the returned pointer

instead pin the internal calls to core_get_data and
remove font_filename in favor of a function that checks if a
filename matches the loaded font as this was all it was used for anyway

Change-Id: Iebb47ffe3f81aa9d5e3968975f26d64283633ffc
2023-02-15 01:15:59 -05:00
William Wilgus
3bb75e0039 tagtree.c optimize get_tag()
store tag length to shortcut strcmp

this is nearly as fast as making a hash table using gperf

its not the hottest path but its
even slightly faster to shortcut
based on string length

    if (tagstr_len > match->len)
        continue;
    else if (tagstr_len < match->len)
        break;

but I found no measurable difference
I don't think its worth the extra constraint of keeping tags sorted

Change-Id: I4bb47cc6c5b8266d5f13c4ac78ae11d55ecb2d67
2023-02-09 06:56:58 -05:00
Solomon Peachy
23cb6139bd SID: Disable SID on 2MB targets, as cRSID needs a lot of RAM.
Also add a note that SID might not play in realtime on all targets

Change-Id: Ic14b20a7c1427e31e38204ae3ecff6bd235ec1b4
2023-02-07 11:25:02 -05:00
Wolfram Sang
88f4f1c8d0 metadata: sid: allow RSIDs as well
cRSID also allows to play RSIDs (hence the name of the library). So,
allow them as well.

Change-Id: Iae8f0ac083ed714771767a4c23f5a09bad637208
2023-02-07 09:19:32 -05:00
Wolfram Sang
70ce734ece codec: sid: use cRSID as a library for playing SID files
Change-Id: Iee70933e47ff8df8f26c9a63112de4da4a8e6c17
2023-02-07 09:19:32 -05:00
Wolfram Sang
15c0f0576e codec: sid: split cRSID header into a public and a private header
Needed to compile cRSID as a proper library.

Change-Id: I276967f46037bd65db1ff38985a781183fc26a00
2023-02-07 09:19:32 -05:00
Wolfram Sang
e8135fea5a codec: sid: add cRSID-1.0 for 21st century SID playback
Plain import of the library parts first. Adaptions to Rockbox will
follow. A *lot* of kudos go to Mihaly Horvath for creating this library
from his already lightweight cSID-light, mainly for Rockbox. Besides a
lot of other things, he made his algorithms integer-only and
significantly improved the C64 emulation, so finally RSIDs could be
played as well as PSIDs. TinySID was nice for what it is, but this is a
quantum leap in SID playback quality for Rockbox. Check for example:

https://hvsc.csdb.dk/MUSICIANS/P/Page_Jason/Eighth.sid
https://hvsc.csdb.dk/MUSICIANS/J/Jeff/Blowing.sid

Change-Id: I353e12fbfd7cd8696b834616e55743e7b844a73e
2023-02-07 09:19:32 -05:00
William Wilgus
1c26f565bf tagnavi make track submenu
add some faster options to the track menu
add a shortcut for basename formatting
sort basename results

filename - by sorted filename
title - just title no formatting untagged items are unsorted as well
title mm:ss - title and duration

Change-Id: I90aea95051f6231580ef7f1fc08cd2d0d69601fb
2023-02-07 08:44:57 -05:00
William Wilgus
b5d93a6605 Revert "tagtree remove unneeded strlen"
This reverts commit 8379c6eb07.

Reason for revert:
tcs.result_len is not the same as strlen(dptr->name) + 1
since it gets filled with filename

Change-Id: I1264afc0a43ffe75adf1de00d27ab98e3adbca19
2023-02-05 06:47:38 -05:00
William Wilgus
d5a84d42b0 [BugFix] tagcache.c fix off by one error in find_entry_disk()
the tagcache counts the null terminator strlen however, does not
no matching entries makes for a terrible amount of disk searching
and a hang on devices without dircache to save them

Change-Id: Id3460037199ee9853de0f11e4763a7ff11130e45
2023-02-04 11:39:43 -05:00
William Wilgus
c955d93075 font.c dynamic path name
only alloc enough space for the path  instead of a fixed buffer

round up the path buffer size to slightly more thna the longest
common path length to reduce reallocations

Change-Id: I51b8b17584d6a905ea3a66a7c38b7b1b9da2e786
2023-01-30 23:36:34 -05:00
Aidan MacDonald
78718aa7eb playlist: Annotate locks as read/write
Distinguish read locks from write locks to aid converting the
mutex to an MRSW lock at some point in the future. Everything
is a write lock for now and a mutex is still used, so there's
no change in behavior.

Change-Id: I25aeed580580bdb0c3048fc7e1eaad1c32c30159
2023-01-29 08:24:48 -05:00
Aidan MacDonald
25bd3bc971 playlist: Optimize playlist_remove_all_tracks()
This was insanely slow for large playlists. Implement it as a
constant-time operation to avoid the O(N!) blowup, and add a
new "clear" command to the control file to avoid flooding it
with individual delete commands.

Change-Id: Ied82d1cba015591edd583f2a2ff6772108f4e176
2023-01-29 07:55:10 -05:00
Aidan MacDonald
2c4546ba99 playlist: Remove unused PLAYLIST_DELETE_CURRENT
Change-Id: I4d1a8798aca249d343ca27a9973213d427b73963
2023-01-29 07:32:26 -05:00
Aidan MacDonald
d85f4b5e1c pdbox: Move core thread off COP
This is all but guaranteed to be broken since pdbox doesn't use
SHAREDBSS_ATTR or SHAREDDATA_ATTR, needed to share memory safely
with COP threads.

Judging by the codec performance comparison on the wiki, if the
iRiver H100 and H300 can run PDbox on one core, PP targets should
have no problem doing it - they are 2-4x faster even on codecs
that don't have multi-core optimizations.

Change-Id: I8f556013146cb670f69cc42e80b1c768ba0f74cd
2023-01-29 07:15:40 -05:00
William Wilgus
4e5fcbe898 fix red #2 d6fb80d4
Change-Id: I147e9b8f7c8e64234f55d39f9ac7c7253b065f9a
2023-01-27 01:12:42 -05:00
William Wilgus
1d6ce5193f fix red d6fb80d4
Change-Id: I805490f660626f48220b41de3ee1026c260d0067
2023-01-27 00:40:20 -05:00
William Wilgus
00e5c81ecb debug_menu database delay redraw
only redraw every 100 entries

Change-Id: Ie0bb54812c1b8341aa4d8303341904d17baa2890
2023-01-27 00:10:47 -05:00
William Wilgus
d6fb80d4ff Tagcache - Ramcache Move ref checks, speed up disk searches
move loading file reference to a separate function

some optimization of the disk search function check tag length before
reading the actual entry & reduce number of lseek calls
this affects startup resume as well before tagcache is done loading

Change-Id: I2bd2fc53c4870416ecd1a4034b34cb6984d8ad51
2023-01-27 00:03:51 -05:00
Aidan MacDonald
1025283042 usb: Fix iPod video connection issues
Apparently a response is coming out of nowhere and tripping this
check. I can't be bothered to look into it; it would be better to
just update the ARC USB driver to the new control request API...

Change-Id: Ic5062443e060534f170d3afe17c00d3c25d1d3bd
2023-01-23 16:04:16 +00:00
Aidan MacDonald
c0c1a6e5f0 Fix yellow 65b3ff81c5
Change-Id: Ibf99e4e6f98021b35d420520219287336bf25f0e
2023-01-23 14:46:02 +00:00
Aidan MacDonald
65b3ff81c5 playlist: Fix dircache scan thread deadlocks
Fix deadlocks in the dircache scan thread caused by incorrect
lock ordering. Mutating operations need to stop the thread to
prevent it from accessing invalid data; this must always be
done before taking the playlist lock to avoid deadlocking the
scan thread.

Change-Id: If719a8b28ed0b0b3eac068073581e606c4a5f58a
2023-01-23 12:24:12 +00:00
Aidan MacDonald
ce52d0c870 playlist: Fix mutex initialization
This is a one-time thing; make sure it doesn't happen more than once.

Change-Id: Ic42f48e5714dff2906c252ecd091989d2d6e5a86
2023-01-23 12:24:12 +00:00
Aidan MacDonald
2a40d42012 playlist: Refactor control cache flush
Make background control file flushing work on non-dircache targets.
It has nothing to do with dircache and doesn't belong in the dircache
scan thread.

Change-Id: I3f39261ccaebb5dce69e7db3d2e0c0c0c54f640b
2023-01-23 12:24:12 +00:00
Aidan MacDonald
551e6aac50 playlist: Remove volatile from indices
This is not necessary. Volatile doesn't create a memory barrier
wrt. non-volatile accesses and there are no interrupts involved,
so there's no reason to use it here.

Change-Id: I78299e2f318e68735364601b3bc2aa036e71130e
2023-01-23 12:24:12 +00:00
Aidan MacDonald
fcb6239aba playlist: Remove current flag
Only current_playlist will have it set, so compare pointers instead.

Change-Id: I46dc7baef9699990962176db7c8796bba1e4809d
2023-01-23 12:24:12 +00:00
Aidan MacDonald
dd2a0aeab0 Use perceptual volume scale for volume bars
Display volume bars using a perceptual scale instead of the
linear dB scale. This makes adjusting volume with the bar a
lot more usable on touchscreen targets.

Change-Id: I2db010486e6ba17f9d08202ee74a0b509f2cb434
2023-01-22 22:10:46 +00:00
Aidan MacDonald
82e26ff2e4 Fix manuals 5b27e2255a
Some targets don't have \ButtonVolUp and \ButtonVolDown so reword
to avoid using them.

Change-Id: I5353d85e579f51e07555e1048b40d90bffa9ae90
2023-01-22 22:10:02 +00:00
Aidan MacDonald
5b27e2255a Add perceptual volume adjustment
The perceived loudness change of a change in volume depends
on the listening volume: at high volumes a 1 dB increment is
noticeable, but at low volumes a larger increment is needed
to get a comparable change in loudness.

Perceptual volume adjustment accounts for this fact, and
divides the hardware volume range into a number of steps.
Each step changes the dB volume by a variable amount, with
most of the steps concentrated at higher volumes. This
makes it possible to sweep over the entire hardware volume
range quickly, without losing the ability to finely adjust
the volume at normal listening levels.

Use "Volume Adjustment Mode" in the system settings menu
to select perceptual volume mode. The number of steps used
is controlled by "Number of Volume Steps". (Number of steps
has no effect in direct adjustment mode.)

It's still possible to set a specific dB volume level from
the sound settings menu when perceptual volume is enabled,
and perceptual volume does not affect the volume displayed
by themes.

Change-Id: I6f91fd3f7c5e2d323a914e47b5653033e92b4b3b
2023-01-22 21:19:57 +00:00
Aidan MacDonald
15c4447b66 Fix red dc83963962
Change-Id: I196268c6f6bc4f6e2d8f2cb7dcc3a12218c5d9d4
2023-01-22 21:19:34 +00:00
Aidan MacDonald
dc83963962 Add helpers for converting to/from normalized (perceptual) volume
These routines were taken from alsamixer and converted to fixed
point for Rockbox.

Change-Id: I64e8bf08da02b1e6e3ef10fdc78254bf8e87ff20
2023-01-22 15:43:00 -05:00
Dana Conrad
66519000f4 ErosQNative: Enable Line Out capabilities on new revision players
The newer players have some changed hardware, but most importantly
the line out now appears to be routed through the stereo switch
instead of being hardwired directly off the DAC.

Disable muting the headphone amp, enable switching the stereo switch,
and rename some of the GPIOs to be more generic since the DAC,
headphone amp, and stereo switch all appear to have changed.

Change-Id: I220fe5e37bcbcd959b544183e1fcf70673a83c13
2023-01-22 15:11:35 -05:00
Aidan MacDonald
c307d98e3f playlist: pin dircache fileref buffer during background scanning
dircache_search() can yield, which would lead to memory corruption
if the playlist dcfrefs buffer is moved at that point. Prevent this
from happening by storing the buflib handle and pinning the buffer
while scanning the dircache.

Change-Id: I28b122de283953dd6d54c1d00598759f5bdcbe93
2023-01-22 13:47:50 +00:00
Christian Soffke
32f365bf3c database: make parent tables work with plugin
Enables the use of PictureFlow and the Properties plugin
with parent tables of ALLSUBENTRIES, such as an album
or album artist, instead of individual tracks.

Change-Id: I18c4779ed116a48c732ae32b9629e7e0d93ce7c8
2023-01-19 15:56:35 -05:00
Christian Soffke
4d53d1b52b PictureFlow: fix_path_part checked too many chars
Shouldn't have any effect if album_name
is null-terminated, but still....

Change-Id: I51acb6c7858347d3bd922758ac4f0fcde349c9e1
2023-01-19 15:36:18 -05:00
Christian Soffke
f441d6bf05 plugins: lrcplayer: eliminate redundant function
Change-Id: I93fff9eb616f08bdad021180f83fea1fdb758870
2023-01-19 15:34:20 -05:00
Christian Soffke
36cef88d47 PictureFlow: id3 functions refactoring
- Move multiple-id3 functionality into lib
- Extract retrieve_id3 function

In preparation for using these functions
from the Properties plugin.

Change-Id: I7252581340680e32df763f1f4b41646a055fe19e
2023-01-19 15:12:57 -05:00
Christian Soffke
6129bfbb95 PictureFlow: Eliminate 'prompt' launch parameter
This was added in commit d553bb1 and
doesn’t seem to be used anymore.

Return PLUGIN_OK since an error message
is already produced.

Change-Id: I5eaf7e7eb7c850a6fa9c3d2717c440e335f5efd1
2023-01-19 14:52:49 -05:00
William Wilgus
1b383ef480 chunk alloc add buflib_get_pinned and chunk caching
Change-Id: Ia581656793b8ce9b80545705cfbba0fb225bb616
2023-01-19 00:04:25 -05:00
Aidan MacDonald
bd7b54a3c4 usb: Attempt to handle overlapped control requests in legacy drivers
It seems connecting an iPod Video to a Mac triggers the null
request check, resulting in a panic. Ignoring the error with
a bare return "fixes" it and allows the iPod to connect. This
isn't ideal though, because it could silently introduce bugs
on other targets.

The likely cause of this is the host sending control requests
too fast, or a driver problem (the Video uses the ARC driver,
which is still on the legacy interface), with multiple requests
getting queued at once. Since the USB core expects to deal with
only one request at a time, the second response trips the check.

Try to handle this situation a bit more gracefully by detecting
overlapped requests and returning a STALL to the host when it
occurs. At this point the USB stack is able to safely handle a
new request.

Link: https://forums.rockbox.org/index.php/topic,54414.0.html
Change-Id: I9a2b7e35620ff540ebdb39f81671377062a4917d
2023-01-18 14:22:26 -05:00
Aidan MacDonald
969e1ef6cd Bump codec API version, remove dummy configure loop in dsp_init()
It turns out removing DSP_INIT broke the codec ABI and caused
old codecs to crash; the loop and mdelay() was a red herring.

This reverts commit 541960a110.

Change-Id: I020d826e7b4beb006d093d9c3d4f45fa5eaac717
2023-01-18 17:52:55 +00:00
Aidan MacDonald
aae34b2e7f playlist: enable queue send
Apparently queue_send() silently falls back to queue_post()
if sending isn't enabled. Doesn't seem like a good idea, as
post and send are definitely *not* interchangeable!

The playlist code relies on queue_send()'s blocking behavior
to prevent the dircache thread from using potentially stale
pointers.

Change-Id: Ibf4b0def3bf9c96cb2fe80cd75043b7ce1dcf250
2023-01-16 16:57:23 +00:00
Aidan MacDonald
a9b93bb4cd buflib_malloc: fixed signed/unsigned comparison
Change-Id: Ie346759a0dda96debd8448fd44ca3e86d40ef348
2023-01-16 16:57:23 +00:00
William Wilgus
d521020d21 [Feature] Add total entries to database info
show total database entries in debug>Database Info

Change-Id: Ic22b6a032ae0ee23e0f38c0da6a9cf1433ba29e2
2023-01-15 22:57:00 -05:00
Solomon Peachy
d39fcf5c89 Update english-us "translation"
Change-Id: I479e1fd337d3384241959782f3f2720e0cac6578
2023-01-15 20:32:14 -05:00
Solomon Peachy
0d8b3fe0b9 FS#13385: Updated Polish Translation (Adam Rak)
I applied the wrong diff, which missed a bunch of stuff.

Change-Id: I3c4da707243c5c0d579ad3130194bfb70fcb4d45
2023-01-15 20:32:14 -05:00
Solomon Peachy
2cb9c7ac29 FS#13385: Updated Polish Translation (Adam Rak)
Change-Id: I346440642c6de0ad5fe73a9cf384dafe266c1e03
2023-01-15 16:41:48 -05:00
Aidan MacDonald
56442f6b7f rbcodec: Fix FLAC out of bounds read
Commit 6bcd830490 ported an optimization to decode_subframe_fixed()
from FFmpeg (upstream commit 08965b22e2). This contains an out of
bounds read, which doesn't affect the decoder output, but makes ASAN
complain.

FFmpeg fixed the out of bounds read (upstream commit 0ec7b71de8) but
that appears to increase code size a lot.

Inlining the initialization of a, b, c, d into the switch produces
similar code as the non-bounds-checked version with only a handful
of instructions of overhead (checked on MIPS & ARM).

Change-Id: I053fac4efc4676b133eb7545c80e23f37fb00d86
2023-01-15 16:11:28 -05:00
Aidan MacDonald
67cb2e3cdc Add core_get_data_pinned(), use it where possible
Change-Id: I1b2f62f27780f99423085d2fffc972ea2701f998
2023-01-15 08:57:45 -05:00
Aidan MacDonald
9e53d5541f "Fix" warble build warnings 800bc000a0
Not really sure how best to deal with the warnings (redefinition of
ARRAYLEN, etc.) short of splitting things out of system.h but this
is good enough for now.

Change-Id: Ibea9f693d128c7995f564f0f5c81d572462a5553
2023-01-15 13:33:22 +00:00