- %Rf printed the sample rate with "%lu.%1lu", a field width rather
than a precision: 44100 Hz came out as "44.100", 22050 Hz as "22.50".
It is now in kHz without trailing zeros: "44.1", "22.05", "48".
- %Re switched on the format setting plus one, so its text named the
next format: "aiff" for WAV up to nothing for MP3. It now names the
format set, MP3 as "mp3" like the others.
- %Rb printed the index of the MP3 bitrate setting, "12" for 128 kbps.
It now prints the bitrate in kbps. Dead code from 2009 goes.
- %Rm was true for stereo: rec_channels is 0 for stereo. The classic
status bar has shown the mono icon for stereo recordings since 2009.
- %Rn counted the minutes on past 59, so %Rh:%Rn:%Rs showed 01:61:05
after an hour. It now counts within the hour, as %Rs does.
As conditionals %Rf, %Re and %Rb keep their values, so the classic
status bar's sample rate, format and bitrate icons are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Change-Id: Id9fb5c0b71fc0a44c5c7b3239a74397cb71090bf
Most of the churn here occurs because 'filesize' is one of
the redefined filesystem functions, but some of the structs
used by the native FS code also include a 'filesize' member
variable which gets renamed by the macro in some but not all
source files.
It's easier to rename 'filesize()' to 'ffilesize()' rather
than try to clean up the macro mess or renaming the struct
members.
There is weirdness with root_realpath() which now breaks on
native builds because it was assumed to be unprefixed there.
dir_get_info() was unprefixed everywhere but this just seems
inconsistent; make it follow the FS_PREFIX() convention too.
Change-Id: Ic3700c6234ea45f32679c1a8429d70fdb8f4088a
Top, bottom, and right icons were displayed too far to
the left. Apparently a long-standing issue.
Icon width is 7, so subtract 7/2 = 3 pixels, instead
of 4, from calculated center, and only 7 pixels, instead
of 8, from the right vp edge.
Change-Id: I8440a4fef4778a66d56117a05b3fe4c36ac8dadd
Remove trailing whitespace from int settings, so
that right-aligned or centered values look correct
in Quickscreen for settings such as Brightness.
Change-Id: I006cf3c3e8b30be2246e7370f26e0428fa47e54b
Add some hardcoded flick gestures in the list UI:
Top -> open quickscreen
Left -> go back
Right -> go to the WPS
The WPS also gets a set of hardcoded flick shortcuts:
Top -> open quickscreen
Left -> go to file / database browser
Right -> view playlist
Bottom -> context menu
These are enabled by default in pointing mode but can
be disabled using the "Touchscreen Flick Shortcuts"
option.
Change-Id: Ib30a338ebb9662cd136985da6d34ed5b041e4077
Reduces GNU complexity score from 7 to 2.
Use separate inline functions that group setting
- x-position and width for left and right text viewport
- y-position and height for all text viewports
- position/dimensions for icons viewport
Change-Id: I14f4eee1f4d6fefa9acbf4a37970a535e77990b1
The parent vp wasn't set before checking the string size,
so, in certain scenarios, the size was calculated using a
different font than the one configured for the UI viewport.
Change-Id: I66bb2e496598811f6169a118de5cb83b451fa292
Eliminate special case for transition to the Shortcuts menu.
The SBS refresh doesn't cause a screen update anymore, and
has negligible cost, so do it regardless.
Reverts the changes to quickscreen.c introduced in commit
dfd9c10 ("Eliminate skin updates in between activities")
+ simplify quickscreen_draw_item (no effect on behavior)
Change-Id: I3fca976de554c720cb69a41566fd0d0a7e6ea92d
Fixes possible crash in case of pathological
UI vp dimensions, when attempting to clear a
QS item's vp.
E.g. https://github.com/federicoplg/musicOS
(commit c5e8570) configures a 1x1 UI viewport
at x=319 y=239, resulting in left/right item
viewports that have negative width or height.
Minor additional simplifications with no
effect on behavior:
- Combine actions requiring cleanup in a setup function.
Put it below the existing cleanup function
- Rename quick_screen_quick to quickscreen_show, and
quickscreen_run to quickscreen_main
- Iterate over items using FOR_QS_ITEMS macro
- Remove quickscreen_draw_item's int_value
- quickscreen_update: immediately continue if qs skinned
- Remove some obsolete #includes
Change-Id: I49aea3be837b861bdcd5132e84fef858df72327b
When an SBS uses the new %QT tag (added in 96f42a5)
to retrieve the name of the top Quickscreen setting
(thus likely wants to draw its own QS UI), we disable
the built-in interface until a new SBS file is applied.
Fixes lag encountered in Themify 2 due to invisible
built-in Quickscreen UI that kept being re-drawn.
Change-Id: Id4f295f959c2d16d1650f6fc066c3ceca6685405
Keep track of the type of skin file being parsed,
in case a tag needs this info.
E.g. %Lt should be ignored in any skin other than
SBS files.
Change-Id: Ib7e52c3e6810196cb566adb65619a1b847cf20ef
If volume was set as one of the Quickscreen items,
the value wasn't updated when pressing ACTION_QS_VOLUP
or -DOWN.
Change-Id: Ie6531535745592d7b53006560f1db8c5b7dbfb97
For each setting adjustment, the whole QS was
redrawn, including icons that never change at
all. Only redraw the viewports that contain a
setting that has been adjusted.
Change-Id: I74188fbf382a92c6e8bf517d9518c3a96bdd21ef
Reduces GNU Complexity score from 6 to 2.
Slightly adjusts behavior:
1) With TIMEOUT_NOBLOCK and peak meters enabled,
skin_wait_for_action always returned BUTTON_NONE,
and did nothing else. Presumably unintentional.
WPS was not affected, since it always uses HZ/5 for the
timeout. The FM screen uses TIMEOUT_NOBLOCK only when
fms_do_button_loop is called with update_screen == true.
skin_wait_for_action now returns the result of get_action
in any given scenario.
2) fixes incorrect next_refresh calculation when peak_meters
are enabled on multiple screens
3) button loop now refreshes peak meters when
current_tick >= next_refresh, instead of when
current_tick > next_refresh
Change-Id: Iaca37dbdde6057f593659b2feb97b61ac4cc4b02
The splash contrast workaround for the iPod reFresh themes compares
foreground and background colours against hard-coded RGB565 values.
This prevents the workaround from being applied on targets using other
pixel formats, such as XRGB8888 hosted targets.
Use LCD_RGBPACK() and SCREEN_COLOR_TO_NATIVE() to obtain the equivalent
colours for the active screen instead.
Code change and commit message generated by GPT-5.6 Sol. Compiled on
my hosted Eros Q build and confirmed working correctly.
Change-Id: Id15669bc7b8cec11bd4ee645c0b671db4499d2cd
Quickscreen will ignore update_delay so that the SBS
is updated after each button press, without any lag.
The SBS may display settings that are adjusted by the
Quickscreen (e.g. cabbiev2's Shuffle and Repeat icons,
or the brightness slider included in themes like
Adwaitapod and Themify).
Change-Id: I28716e81cb77e235eb009bff91c96f510365f435
Appears to be a regression introduced in e454a39, where
MIN_LINES was increased from 4 to 5, along with changing
nb_lines <= MIN_LINES to nb_lines < MIN_LINES
The top and bottom sections are supposed to switch
from 2 to 1 lines if there are fewer available lines
than MIN_LINES.
Each of the three vertical section uses two lines,
resulting in overlapping viewports, if there are exactly
5 available lines.
Icons mentioned in the comment don't really play into
that.
Change-Id: I3a0e921d9f53a490fece0ce59457feaf84a80d3b
Tune accel/decel/press coefficients and add a braking force which
kicks in when swiping in the opposite direction of scrolling. This
is instead of the usual acceleration force.
Change-Id: I2b220c98674933a6957d6982020406342cd019bd
Add configurable acceleration settings. There are 3 settings which
are applied at different times during scrolling. "accel" is used to
calculate the acceleration applied to the list based on the swipe
speed. "decel" determines the deceleration force applied based on
the list scroll speed, and "press" is an additional deceleration
force applied if you are pressing on the screen.
All settings have the general form:
kinetic scroll accel: <a0> <a1> <delay>
kinetic scroll decel: <a0> <a1> <delay>
kinetic scroll press: <a0> <a1> <delay>
where the formula for the acceleration is "accel = a0 + a1*vel" and
"vel" is the input velocity (swipe speed for accel, list scroll speed
for decel/press).
The delay parameter is a value in milliseconds which acts as a grace
period where the acceleration will *not* be applied. For example, if
you specify 250ms for decel, then deceleration will not kick in until
250ms after scrolling starts. For press, the delay is based on the
duration of the touchscreen press.
All settings have sane default values and don't need to be configured
to enable kinetic scrolling; it is always enabled. But the settings are
there for those who want to tweak the behavior.
Change-Id: I9723b496b2b5d3fb3643af60b169754fdba497f0
Kinetic scrolling now accelerates when repeatedly swiping over
the screen, so you can scroll through large lists easily without
using the scrollbar. Press & hold to slow down and stop.
Menu items can no longer be selected during a kinetic scroll
event, to reduce the chance of accidental selections.
Change-Id: I05b7d5fe6681a9edf53096b1fa265442fb31bf33
Fixes possible crash during playback with
'Auto-Change Directory' setting enabled.
When the currently playing directory changes, the
skin may be updated on the main thread while the
playback thread is executing create_and_play_dir
and has yet to add any indices to the newly created
playlist.
Introduced in commit 41d5ca3.
Change-Id: I6e930f2db546c7690b362ba8c1a4907d0348ff52
Introduce the generic, target-agnostic pieces for a gadget-driven USB
Audio Class DAC, gated by the HAVE_HOST_USB_AUDIO target flag so they stay
inert unless a target opts in.
Rather than adding a new USB mode, reuse the existing usb_audio setting
(never / always / while charge-only / while mass-storage) with its
LANG_USB_DAC string, usb_set_audio() callback and the
PCM_MIXER_CHAN_USBAUDIO mixer channel. HAVE_HOST_USB_AUDIO becomes the
umbrella capability flag for this common code; USB_ENABLE_AUDIO stays the
native usbstack class-driver contract (which needs HAVE_USBSTACK and so
cannot be used by hosted ports whose kernel owns the USB controller).
usb_set_audio() is declared here and implemented by the target (natively
by the usbstack driver, or in the hosted port for gadget targets, as with
usb_audio_get_active()), and applied at settings load. The playback
interlock in wps.c/playback.c keeps local playback from mixing with host
audio while the DAC is active. Simulator stubs for usb_set_audio() and
usb_audio_get_active() keep sim builds linking.
Co-Authored-By: Claude Opus 4.8
Change-Id: I5b7738508c24721d91d4c32379102a1ac7c6228b
not sure if there's a reason these weren't included
in g#3229
- simple lists
- playlist viewer
- browse_id3
- option select
Change-Id: I0e15aaeb563e68ea21bf5df667ce134d01a95195
add get_metadata_afmt function so we don't have to extra functions
remove unneeded bounds check on audio_format in rbcodec_format_is_atomic()
add bounds check on audio_format in get_metadata_afmt()
Change-Id: I76bd869100b000579c6546f0670ba4ba2c541f22
tagcache.c add_tagcache() and potentially
skin_tokens.c wps_playlist_percent_prepare()
make calls to probe_file_format() prior to calling get_metadata_ex
resulting in some small amout of duplicated work
especially in the case of add_tagcache this can add
up to a lot of duplicated work
breaks out audio_fmt so these can supply the afmt other callers just
supply probe_file_format(trackname) in the function call
Change-Id: I8084213b8ee7e04d76dce0986beb83d443ac804b
%pP reports playlist progress by position index, which treats every
track as equally long. For playlists with tracks of unequal length --
audiobooks with chapters anywhere from two minutes to an hour are the
motivating case -- position is a poor proxy for listening progress.
%pX reports the played percentage of the whole playlist by time: the
summed length of all preceding tracks plus the elapsed time in the
current one, relative to the playlist's total duration. It can be
used as a value, in a conditional, with %if(), or as a bar tag like
%pb.
If a playlist contains more than 500 tracks or the scan is taking too
long and the user aborts the tag will fallback to the behavior of %pP
except the progress through the current track will be included in the
returned percentage
--------------------------------------
Computing this needs every track's length, and reading metadata for
every track is too slow and disk-heavy for a tag that refreshes on the
WPS. Instead each track's length is estimated from its file size: the
skin engine scans the playlist in the background, a batch of files each
skin refresh, opening each file only to read its size (directory
metadata, no header parse). Size is turned into time by calibrating one
file of each type -- the first file of each extension is parsed once
with get_metadata to learn its bytes-per-second, and every later file
of that type reuses it. A single-format playlist, the usual audiobook
case, parses exactly one file and stat's the rest.
The result is an estimate -- bitrate varies within a type, especially
for VBR -- but it is cheap and accurate enough for a progress
indicator, and the playing track always contributes its exact elapsed
time. Per-track lengths are stored as two bytes of minutes each in a
movable buffer sized to the track count and allocated only while the
tag is in use; the cache is keyed on the track count and a crc of the
first, middle and last filenames, so a playlist swap or reshuffle is
caught. If the buffer cannot be allocated (a very large playlist on a
low-memory target) the tag falls back to position-based progress.
The buffer is allocated when playback starts (and when the now-playing
screen is opened with playback already active) rather than lazily on the
first WPS refresh, so the one-time allocation happens at a playback
boundary instead of during steady-state playback; it falls back to
allocating on first use if that point is missed.
Until the scan finishes the tag does not blank: it returns an instant
equal-weight estimate -- (completed tracks + fraction through the
current one) / track count -- which sharpens into the size-based value
as the scan fills in. So a theme can just use %pX and it is correct
from the first frame, and %?pX is true whenever a playlist is loaded.
Tested on a Sansa Clip Zip and in the simulator. On a 216-track,
~745 MB single-format audiobook playlist the length scan dropped from
~4150 ms (get_metadata on every track) to ~174 ms (one parse plus 215
file-size stats), roughly 24x lighter.
Change-Id: I6e572e78a10444bd513ddc77e30da04aa5153ef2
The skin is not unloaded using skin_unload_all in
settings_apply_skins anymore since commit 0ca4b38.
usb_screen was last remaining user until commit a969e1f.
Change-Id: I65a41ed220165587a04e699a7f210c575c00a4eb
Moving the skin update from gui_synclist_set_title to
gui_synclist_draw (c41beeb) had the inadvertent side
effect that, if gui_synclist_select_item was called in
between, it may have missed a configured skinlist that
only got enabled by the skin update. Which could lead
to a selection appearing off screen.
This was mainly an issue if you had popped an activity,
which resets the skinlist cfg to NULL, but didn't perform
a skin update before the call to gui_synclist_select_item.
Now that GUI_EVENT_ACTIONREDRAW can be used instead of
GUI_EVENT_ACTIONUPDATE to prevent the display from being
updated, we may as well update the skin immediately in
gui_synclist_set_title again.
Change-Id: Iaee98d670ffb8d7b6590bd2ba11827fef5fba5a8
This disables custom scroll bars when initializing lists
that are currently always un-skinned, in scenarios where
there is neither a new activity to be pushed, nor is the
theme toggled.
Change-Id: I1bb05fc9be956c71e1adb70e764094082d9bb904
Takes care of disabling scroll bars when the current activity
doesn't change, but the theme is toggled. Applies to confirmation
prompts, for example.
Since we're updating the skin immediately afterwards, the cfg
will be reset as needed.
Change-Id: I8a62b6b4ad0abf5176ab6b3e39281021108cb59f
Some themes, such as Themify, FreshOS, iPod reFresh, Jive,
iPodOS, iPone, iClassic, AbsoluteBlack320, and possibly
others, draw a mask over the album art on the foreground
layer, in order to add rounded corners or to apply a fake
camera perspective (instead of taking advantage of the
backdrop layer).
This results in rendering glitches that can be fixed by
drawing the album art first.
Change-Id: Ie373c51304ab0d0a09b8663a8adff343a32ae5bb
Allow setting context menu items
reuses WPS hotkey items
Runs the item
displays the item
Open plugin shows the item name
Pitch shows the pitch speed amount
add 'Show In Files' hotkey item
devices without a hotkey get an extra item
added Manual entries
Change-Id: I427e70e1cad15364ac5d2a7114032e97cc9eee1a
The skin engine is responsible for drawing custom
scroll bars, but isn't kept in sync with list redraws.
Change-Id: Ieb457a4eb8442d4521c67a46a94c4d2132814c64
Eliminate the somewhat circuitous skin_defer_rendering
and skin_render_deferred functions introduced in commit
c145d19e85.
skin_render (and thus skin_update and sb_skin_update),
along with skinlist_draw, list_draw (and thus
gui_synclist_draw), and quickscreen_draw, will never
update the screen anymore. Instead, the skin is only
marked as dirty now.
GUI_EVENT_ACTIONUPDATE redraws the skin as necessary,
and updates the screen afterwards, if the skin is dirty.
This event is sent from get_action, just like before.
A new event, GUI_EVENT_ACTIONREDRAW allows you to redraw
the skin without causing an immediate update at the same
time.
Change-Id: Ib20644853ead901e32f639000f044d6935135bae
- Eliminate separate display update for USB screen UI vp;
wait for skin_render instead
- Eliminate outer loop around handle_usb_events
- Use handle_usb_events in Simulator as well.
Fixes USB screen being dismissed by any button presses,
or by system events.
- When USB keypad mode is changed, only redraw the title viewport
- Delete unused MODE_NAME_LEN #define
- Hide "USB keypad mode:" prefix. Only display current mode setting,
which requires less scrolling and ensures that the new setting
is always visible immediately after it has been changed
- Change comment from:
/* Don't return until we get SYS_USB_DISCONNECTED or SYS_TIMEOUT */
to: /* Don't return until we get SYS_USB_DISCONNECTED */
which reflects existing behavior (comment may have been
copy-pasted from usb_wait_for_disconnect_w_tmo)
- Don't scroll USB keypad mode unless UI vp's width is > 1, since
some themes try to hide the USB viewport and display a custom UI
instead
Change-Id: I9b9703025b00ad807920ee60a843f269f414f6f9