Rockbox

Tasklist

FS#6188 - Tracklock: audio book mode, avoid unintentional track skips

Attached to Project: Rockbox
Opened by Stephane Doyon (sdoyon) - Sunday, 15 October 2006, 02:25 GMT
Last edited by Stephane Doyon (sdoyon) - Sunday, 04 May 2008, 13:49 GMT
Task Type Patches
Category Music playback
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

While playing an audio book, I wish to avoid unintentionally pressing the
joystick and skipping to the next or previous track. This happens to me
now and then when I'm on the bus, adjusting the volume, and the bus hits
a bump. It's particularly annoying for audio books because they tend to
have such long tracks.

This patch implements one possible solution, which I'll be trying out. It
adds a mode which I call "tracklock" to the WPS, which can be on or
off. Off is the usual behavior: SKIPPREV/NEXT skip tracks.. ON causes
SKIPPREV and SKIPNEXT to jump forward or backward in the same track by
5seconds, which I think might be nice when you just need to have the last
sentence repeated. I added an ACTION_WPS_TRACKLOCK that causes the
tracklock mode to toggle (and the new mode to be announced). I also added
a setting (in the playback section) that indicates what the tracklock
mode should be set to initially when entering the WPS.

If anyone would like to try it out and comment... Is the 5seconds quick
skip a good idea, or am I mixing to features together? Is this useful for
other things then audio books, perhaps long concert tracks...?

TODO:
-I've put in a button binding for ACTION_WPS_TRACKLOCK only for the X5: I
used the POWER button. Other players are TODO.
-No visual indication of the current mode. How could that best be done?
-The amount of instant skipping could be made configurable... but maybe
that's just too much detail.
This task depends upon

Closed by  Stephane Doyon (sdoyon)
Sunday, 04 May 2008, 13:49 GMT
Reason for closing:  Accepted
Comment by Paul Louden (darkkone) - Sunday, 15 October 2006, 08:41 GMT
It sounds very similar to the "Study" mode from the iRiver firmware.

With that you could set a length for the skips (from I believe 5s to 10 minutes) and if that length was longer than your track it went to the next track.

To me this was handy because I could set it to 10 minutes, and if I was listening to audiobooks I could use it to quickly skip around to where I'd been before if I lost my position, but if I used it with normal music skipping behaved like normal.

Anyway, I think with an adjustable time the feature becomes quite useful (also, giving 0 as an option for the time, so you can adjust the volume with absolutely no fear of skipping forward/backward at all).

At that point, it needs a new name (quick-seek, skip-seek, or something like that?)
Comment by Stephane Doyon (sdoyon) - Monday, 16 October 2006, 01:26 GMT
OK I especially like the bit about setting it to 0 to get only the
locking effect.

Here's a second version with the skip step configurable.

I'm not sure about very high settings like minutes though. At that point,
it seems to me, it becomes just a coarse navigation function, and you'll
also need lower skips. (Although a coarse navigation function is also
something I would find useful.)

About skipping to the next track when the end of the current track has
been reached: I suppose there's no reason it shouldn't do it, but the
backwards case is somewhat tricky to implement and I haven't done it
(same issue as rewind going back to the end of the previous track...).
Comment by Stephane Doyon (sdoyon) - Thursday, 23 November 2006, 03:00 GMT
I hadn't bothered to update this given the lack of interest, but now that
something similar has come up (F#6377)... Anyway here's a version against
CVS (well of a day or two ago), and which fixes a little glitch:
audio_{prev,next}_dir actions must also be inhibited when tracklock is
enabled.

I myself have been using this happily for a month.

Key mapping stil only for x5. I'm willing to add more if someone with a
different player is interested. You can still use this without a
dedicated key, but you need to go to the playback settings menu to toggle
it.
Comment by Douglas Valentine (Dwyloc) - Thursday, 23 November 2006, 10:45 GMT
Yes I am definitely interested in your patch as I use both my H120 and my ipod nano
to listen to audiobooks far more than I use them for listening to music and I the only
think I miss about the stock iRiver firmware is the study mode.

For my use on the h120 the most important part of using the study mode is that it stopped
me from skipping directory by accident with the h120 remote using the skip directory buttons.
Comment by Stephane Doyon (sdoyon) - Friday, 14 September 2007, 05:04 GMT
Here's an update for this patch.

Note that for a while I worked on a more feature-full version of this in
P#6377 multi-mode reverse and forward, but interest
for that seems to have died out.

One setting for the mode: traditional (normal) or study (track skipping
disabled, instead skips inside the track by a few seconds). Second
setting indicates how much to skip in study mode, default 5seconds.

I dropped the idea of having a dedicated button to toggle the mode. For
convenience I use a .cfg file with just the mode change in it.

I've kept a feature from P#6377: in study mode, doing a left tap followed
closely by a LONG RIGHT wil skip to the next track, and the reverse to go
backward. Inspired from the next/prev directory functionality. The
"counter-gesture" is a bit convoluted but at least it's a way to skip
tracks without having to go change the seek mode, and there's little risk
of hitting it by mistake.

I've been using this for close to a year now and I like it a lot.

Perhaps the summary should be changed to "Study mode", since this seems
to evoke the right idea for iRiver users.
Comment by Stephane Doyon (sdoyon) - Wednesday, 26 September 2007, 01:15 GMT
Use the NEXTDIF and PREVDIR keys to skip tracks when in study mode.

Plus a sim fix.
Comment by Sofian Babai (sofianbabai) - Friday, 28 September 2007, 01:35 GMT
hi,

really nice feature i've just discovered. I'm listening to fims on my player and i've the same problem as in audio books . but now, it's really cool. but, how could I back to the normal mode while playing without entering the menus?

and personnally, i prefer the name track lock since "study mode" means nothing for me lol. and I can't figure out how to translate it in french !
thx sdoyon.
Comment by Daniel Dalton (ddalton) - Thursday, 04 October 2007, 09:50 GMT
You said
"No visual indication of the current mode. How could that best be done?" in your first description. Would a gui_syncsplash work? Or is this comment out of date? Can you make the voice say what the setting is set to when entering the wps? Why don't you like the idea of a button to change the setting? If I had a go at implementing this for the h300 would it be ok? (If I can work out how)
And finally is it ok to rename "study mode" to "Track lock"?
Thanks.
Comment by Daniel Dalton (ddalton) - Thursday, 04 October 2007, 09:58 GMT
One more thing. Would it be best to have this setting in the wps context menu?
Comment by Sofian Babai (sofianbabai) - Thursday, 04 October 2007, 11:33 GMT
ddalton wrote:
> One more thing. Would it be best to have this setting in the wps context menu?

hmm since i like the hokey creationidea, yeah it could be easier to access while playing an audiobook. I could avoid to create a specific hotkey. but, I don't know how difficult it coul be to implement. I'm not a programmer, but a translater ! :) However, i think this proposal should be seriously considered.
Comment by Daniel Dalton (ddalton) - Friday, 05 October 2007, 08:12 GMT
A long press of play in the wps will now toggle the study mode setting.

I am happy to add this to other targets just tell me which one you have.
Also can I change the string in english.lang to track lock and not change all the variable names to tracklock? Would that be bad programming?
Comment by Daniel Dalton (ddalton) - Friday, 05 October 2007, 08:14 GMT
Sdoyon:
How would I move the study mode settings to the wps context menu?
Comment by Sofian Babai (sofianbabai) - Friday, 05 October 2007, 09:55 GMT
hello daniel,

on my iaudio x5, a long press of play is made to stop playback. for the iaudio, a long press of rec should be better IMHO although i should check if it's not used be something else.
Comment by Daniel Dalton (ddalton) - Friday, 05 October 2007, 11:54 GMT
Hi,

Not sure if my last comment got through.
I have another idea for rec so want to keep it free. Talk to me on irc or email me for details.
Do you think the power button would work? That's what Stephane used before. Let me know if you want that and I will write you a patch.
Comment by Sofian Babai (sofianbabai) - Friday, 05 October 2007, 12:04 GMT
i think stephane used the power button but a short press on it. actually, if you do a long press on the power button, it shuts down the unit.
Comment by Daniel Dalton (ddalton) - Friday, 05 October 2007, 12:28 GMT
Yes your right about the short press. As shown in his code. This should work with a short press.
Let me know if it works. Sorry haven't got an x5 to test on.
Here it is...
Comment by Steve Bavin (pondlife) - Friday, 05 October 2007, 12:40 GMT
Does this need a button mapping? Why not just put it into the setting menus (and perhaps the quickscreen)? I can imagine people accidentally enabling it...
Comment by Sofian Babai (sofianbabai) - Friday, 05 October 2007, 12:44 GMT
ddalton wrote :

> Yes your right about the short press. As shown in his code. This should work with a short press. Let me know if it works. Sorry haven't got an x5 to test
> on. Here it is...
if you can wait until monday i'll test that no prob. I won't have enough time now. I'm supposed to work now ! :)
Comment by Daniel Dalton (ddalton) - Friday, 05 October 2007, 21:45 GMT
It is already in the settings menu. I wanted to move it to the wps context menu but I am not sure how.
Also if it was going to get committed I would still have my own patch for the button press.
Comment by Daniel Dalton (ddalton) - Friday, 05 October 2007, 21:46 GMT
sofianbabai:

I think there is an error. I forgot to rename the action. I will upload a correct version just give me 10 minutes.
Comment by Daniel Dalton (ddalton) - Friday, 05 October 2007, 22:02 GMT
Attached is a correct version. It compiles but you will need to see if it works. I think it should.
Comment by Stephane Doyon (sdoyon) - Monday, 08 October 2007, 04:59 GMT
>Comment by Daniel Dalton (ddalton) - Thursday, 04 October 2007, 09:50 GMT
>You said
>"No visual indication of the current mode. How could that best be done?" in
>your first description. Would a gui_syncsplash work?

I thought perhaps the statusbar, although I'm really not familiar with
it. I thought a sighted person might want to glance at the screen to
confirm study mode just before pressing LEFT/RIGHT. Would need sighted
advice.

>of date? Can you make the voice say what the setting is set to when entering
>the wps?

That would be really annoying, don't you think?

> Why don't you like the idea of a button to change the setting?

Because button mappings are a scarce resource. You can always think of
some other function that could also use a hot key. And then of course
people don't agree on priorities. I don't think it would be included in
Rockbox with a hot key.

You need to change it only when going from books/films/podcasts to
music. You'd usually go hours without touching it.

But you are right that the settings is really too deep in the menus and
some shortcut would be needed.

>Comment by Daniel Dalton (ddalton) - Thursday, 04 October 2007, 09:58 GMT
>One more thing. Would it be best to have this setting in the wps context
>menu?

That's how I had done it in P#6377. That'd be better. But it seems
unfortunate to add one more option at the base of that menu for just a
toggle... It doesn't seem to fit under any submenu though.

Well, either that or perhaps my new quickscreen idea...
Comment by Stephane Doyon (sdoyon) - Tuesday, 11 March 2008, 00:33 GMT
I've had a request so here's an updated version.

No special hotkeys in this one.

Myself I just use two .cfg files with just "Study mode: on" and "Study
mode: off" in them.
Comment by John Major (major4579) - Friday, 21 March 2008, 22:13 GMT
I added this patch (and only this patch) to Build 16629 for my Sansa e250. It is exactly what I was looking for as I mostly listen to podcasts and the Skip Forward/Skip Backward a specified number of seconds has been wonderful. I use it all the time.
Comment by Stephane Doyon (sdoyon) - Thursday, 17 April 2008, 01:06 GMT
Got yet another request, so here's a sync.

I've been reasonably happy with this for a long time, finding it very
useful, and there's some demand for it. So I'm considering committing
this patch. Any comments from devs?
Comment by Linus Nielsen Feltzing (linusnielsen) - Thursday, 17 April 2008, 06:11 GMT
I think it looks useful, and I have no comments about the code. I'm not sure the Fast-Forward/Rewind menu is the best place for the settings though.
Comment by Claudio Capriati (claudiocpr) - Thursday, 17 April 2008, 17:07 GMT
Hi all,
I'm a blind user. I applied this patch and compiled rockbox whith kygwin.
I'm not a programmer but a simple user. I think that this function is very usefull for disabled sight people like me, in fact when i listen to an audiobook sometimes i need to hear last phrase or when I forgot to enter the bookmark i need Go forward for not listen to a part read above.
With the traditional commands it may return respectively at the beginning of file or moving to the next thing and this is very nerve-wracking because usually
the audiobook's files are very long.
This patch assigns the accidental actions described above to power / menu + left and power/menĂ¹ + right combinations, pressing two keys simultaneously
prevent their accidental.
Now this patch works through a row of config.cfg file to be loaded when needed, it would be a good idea to find a solution to activate "study mode" or "tracklock" function while
playing, for example with a hot-key associated with a voice message or with a specific item in the context menu .

Greetings

Comment by Claudio Capriati (claudiocpr) - Friday, 18 April 2008, 08:48 GMT
hi all,
i'm not a programmers but an rockbox user. I mixed last release of tracklock.diff with tracklock.patch published on 5th october 2007 that assigns a hot key to this function for x5.
I just added those lines of code that are in the second and not the first with the exception of file's code lines "settings_list.c" which has been profoundly changed
after publication of tracklock.patch. The only change necessary was the keymap-e200.c file, I copied the row that was to change the file keymap-x5.c into keymap-e200.c adapting it in the name of the button. when playing you have to use play-pause long pressed To toggle from study mode to traditional mode: because in sansa e200 this button is free.
The patch is without unk failed, the compilation shows no errors, it works well on sansa e200. Now I don't know if there are unnecessary lines of code or if there are bugs, this patch is a temporary and personal solution until the developers decide to add the feature with a short way to toggle during playback: that's my dream. If someone has a different player will be enough to find a free button during playback and write a line of code similar to the one written by me that assigns it to the function.
I would like a programmer reads this patch and fixes it if necessary.

I'm sorry for my bad english.

greetings
Comment by Stephane Doyon (sdoyon) - Sunday, 20 April 2008, 02:25 GMT
OK, so noone is really happy with the setting menu entries for this thing.

Linus:
>I'm not sure the Fast-Forward/Rewind menu is the best place for the
>settings though.

I could have a study mode submenu, with just the two study mode settings
in it, if it's worth having a submenu just for that. I could put it as
the last entry, so it can quickly be accessed by wrapping upwards. This
is reasonably accessible, with the shortcut as context menu on "Now
Playing".

I can also add a quick toggle function in the WPS context menu . I could
make it a dynamic menu item, so there wouldn't have to be a submenu.

The attached patch does both these things. Please comment.

I placed the context menu entry in last position, again so it is quickly
accessible by moving upwards just once and wrapping around. So this would
steal this sweet spot and push the equalizer menus one entry up.

Voice users note: a context menu glitch was introduced not too long ago
causing the current menu item to be spoken once on leaving the context
menu. Can be quite confusing. So for example if you click on enable study
mode, it'll say disable study mode, but you'll really have dropped out of
the context menu. This isn't an issue with this item being dynamic, it's
a context menu bug. It happens with other context menu items too. I'll
have to track this down separately.
Comment by John Major (major4579) - Monday, 21 April 2008, 13:06 GMT
Stephane,

I wouldn't say no one was happy - for me it didn't really make a difference as I'm always in 'Study Mode'. Using the 2 button (short RR, Long FF) I can always skip to the next track, so I never see the need to alter the settings. Not sure what I'm missing in the current discussion. Still it's been awhile since I did a compile so I'll try your new version as soon as I get the time to do it.

I did come across a problem when I'm almost to the end of the track, when the remaining playtime is less then the Study Mode jump time, shouldn't it jump to the next track? It's not... then again I am seeing a discrepancy in the time remaining showing on th WPS and the actual time remaining. The WPS display often goes into negative numbers as it's obviously out of sync with the actual mp3.

What number is tracklock looking at the (the same as the WPS displayed number or something else) to determine the remaining time?

I have found your patch to be incredibly handy as I use it all the time and it makes using my Sansa/Rockbox much more enjoyable - thanks.

John
Comment by Stephane Doyon (sdoyon) - Monday, 21 April 2008, 15:35 GMT
John Major (major4579) wrote:
>I wouldn't say no one was happy - for me it didn't really make a
>difference as I'm always in 'Study Mode'. Using the 2 button (short RR,
>Long FF) I can always skip to the next track, so I never see the need
>to alter the settings.

OK, good to know!

I find it annoying enough to switch when browsing through music, if I'm
going to skip tracks a lot. Generally my E200 remains in study mode, but
the skip gesture feels more awkward on my X5.

>Still it's been awhile since I did a compile so I'll try
>your new version as soon as I get the time to do it.

Appreciated.

>I did come across a problem when I'm almost to the end of the track,
>when the remaining playtime is less then the Study Mode jump time,
>shouldn't it jump to the next track? It's not...

Well that was on purpose actually. It should beep at that point. I made
it that way because it's currently rather hard to navigate to the end of
a track. In particular for blind users there's no feedback on position
and one is very likely to fast forward to the very end, and playback
will switch tracks as soon as you release the key.

It happens often enough that I need to go back to the end of a track,
because I missed something, or to check that the track isn't
truncated. Losing one's position on a very long track can be frustrating.

I wanted to allow skipping
around with no fear of inadvertently jumping to the next track. Otherwise
you not only lose your position but also might not notice the track skip.

If we had the ability to skip back to the end of the previous track,
which seems somewhat more complicated to implement, and we could emit a
beep when moving to another track, then I would agree that skipping
forward should automatically go to the next track. Until we have these
features though I'd prefer to keep the current implementation.

A separate function to jump to near the end of a track would also be a
nice addition. It's somewhere down my infinite TODO list. Also perhaps
the fast forward function could optionally be made to not go passed the
last 3 secs at the end of a track.

> then again I am seeing
>a discrepancy in the time remaining showing on th WPS and the actual
>time remaining. The WPS display often goes into negative numbers as
>it's obviously out of sync with the actual mp3.

Hmm that sounds like a bug. I'll have to check this out.

>I have found your patch to be incredibly handy as I use it all the time
>and it makes using my Sansa/Rockbox much more enjoyable - thanks.

Ah thanks! This kind of feedback is very encouraging.
Comment by Claudio Capriati (claudiocpr) - Tuesday, 22 April 2008, 00:05 GMT
Hi Stephane,

i tested your last patch. it's wonderfull! it allows both a quick change through context menĂ¹ and the preferred setting of function through settings - general settings - playback menu. I saw that now it is possible to set the step preferred too! it's ok!
I have only a little suggestion for you: in menu settings - general settings - playback you should modify "study mode" words because the same words are used in tthe first level of menu and in the second one. In fact a blind user could feel disoriented: he wouldn't know where he is. then you could change words or in the first level or in the second one.

thank you very much for this digital jewel! :)
you must commit your patch!!
Comment by Stephane Doyon (sdoyon) - Wednesday, 30 April 2008, 01:15 GMT
major4579 wrote:
> then again I am seeing
>a discrepancy in the time remaining showing on th WPS and the actual
>time remaining. The WPS display often goes into negative numbers as
>it's obviously out of sync with the actual mp3.

I don't see anything obviously wrong in the code to cause this. I made
a quick attempt with sighted assistance and could not reproduce the
problem. You said your version is older, so hoping this got fixed
since then. Otherwise I'll need more info. Lots of people have been
happy with this despite this potential glitch, so I won't consider it
a show stopper.

claudiocpr:
>in menu settings - general
>settings - playback you should modify "study mode" words because the
>same words are used in tthe first level of menu and in the second one.
>In fact a blind user could feel disoriented:

Good point. I'll use "enable study mode" for the lower level menu.

I intend to commit this soon.
Comment by John Major (major4579) - Wednesday, 30 April 2008, 13:01 GMT
Stephane,

The time discrepancy definitely is not a show stopper. I just rebuilt using a very recent version of Rockbox, 17252, and just your patch from April 19. I will watch for the time display issue and let you know.

I actually think the time issue is part of the rockbox code and/or the Sansa e200 series and not part of your patch.

You previous said that when you are almost to the end of the track and the remaining playtime is less then the Study Mode jump time, you specifically wrote the patch to not jump to the next track. If I wanted to play with changing that behavior where in your patch would I look?

Thanks again for a great addition to rockbox,
John
Comment by Stephane Doyon (sdoyon) - Saturday, 03 May 2008, 02:55 GMT
Thanks for the feedback.

John Major
>You previous said that when you are almost to the end of the track and
>the remaining playtime is less then the Study Mode jump time, you
>specifically wrote the patch to not jump to the next track. If I wanted
>to play with changing that behavior where in your patch would I look?

if(direction == 1
&& wps_state.id3->length - wps_state.id3->elapsed < STEP+1000) ...

As I said before, I'll be thrilled if you can make it so I can jump back
from the beginning of one track back to the end of the previous one.

There's a glitch with the pcmbuf_beep() function, particularly on
e200. It was an issue for the key click feature among other things. This
week I noticed that if you have it beep a couple of times in quick
succession at the end of a track, you can get it to sort of hang. When
that happens you can press stop to get out of it, it's not a hard
hang. I'll see if I can work around it, but it's apparently an issue with
pcm buffering and beeping, not a bug in this patch.

The issue I mentioned earlier with confusing messages in the context menu
was fixed in r17293.

Loading...