Rockbox Technical Forums
Support and General Use => Theming and Appearance Customization => Topic started by: chris_s on February 12, 2019, 03:23:21 PM
-
I'd like to find out if the user has adjusted the bass or treble setting (I'm less interested in the actual value). So far I've been using a comparison that looks like this:
%?if(%St(bass), !=, 7)<>
which works on an iPod 4G where the bass and treble settings each go from -6 dB to 9 dB. For some reason, while an unadjusted bass setting will print out 0 like you would expect, the tag returns a value of 7 when used in the context of a logical comparison.
Unfortunately I've now realized that on the iPod 1/2/3 the scale goes from -24 dB to +24 dB, which means I'd have to use
%?if(%St(bass), !=, 25)<>
to do the same check.
On the iRiver H1x0 devices, the scale is once again different.
Unfortunately the themes automatically show up for these other devices, even though they only work correctly on the iPod 4G.
Does somebody have an idea how to circumvent this issue?
-
I think I figured out a workable and (relatively) clean solution that seems to solve the problem for any device whose scale goes from some negative dB number to some positive dB number. On the other hand, it will falsely detect that an adjustment has been made if the scale only starts at 0 dB (i.e. has no negative values). With regard to 160x128 b&w themes, this seems to only be an issue on the iRiver devices where you can increase but not decrease the amount of bass or treble
(Tested on iPod 4G hardware and simulators for iPods 1G-3G, iAudio M5, iRiver-H100, Samsung YH-920)
%?and(
%if(%ss(0, 1, %St(bass),number), =,1),
%if(%St(bass), !=, 1)
)<
neutral
|
adjusted
>
The trick is to take a substring of the bass setting and (this is important) indicate that it is to be treated as a number. Counterintuitively, as explained in the wiki (https://www.rockbox.org/wiki/CustomWPS#A_37if_40_41_logical_comparison_tag) and in FS#12891 (https://www.rockbox.org/tracker/task/12891), you then need to add 1 to the value you want to compare your result to within an if-statement. This will, strangely, detect both 0dB and the lowest dB setting (e.g. -24dB), the latter of which you exclude by checking that the "first" bass setting isn't selected. Unfortunately this approach fails to work when 0dB is also the lowest setting.