Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Thank You for your continued support and contributions!

+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Skip to next track after deleting playing track by auto
« previous next »
  • Print
Pages: [1]

Author Topic: Skip to next track after deleting playing track by auto  (Read 1964 times)

Offline seamoon2

  • Member
  • *
  • Posts: 8
Skip to next track after deleting playing track by auto
« on: October 16, 2017, 08:39:39 AM »
I have made several modification on binary code so I'm familiar compiling and editing. I want automatically skip to next track after deleting playing track  by automatically. Which file contains the delete function and what line should I add for skip to the next track. Could you help me about this?
Logged

Offline Bilgus

  • Developer
  • Member
  • *
  • Posts: 731
Re: Skip to next track after deleting playing track by auto
« Reply #1 on: October 16, 2017, 12:08:06 PM »
What would modifying binary code have to do with compiling and editing the code?

here is the menu where it gets called
https://github.com/Rockbox/rockbox/blob/03dd4b92be7dcd5c8ab06da3810887060e06abd5/apps/onplay.c#L1382
and the code it calls
https://github.com/Rockbox/rockbox/blob/03dd4b92be7dcd5c8ab06da3810887060e06abd5/apps/onplay.c#L687

A cursory look at the code you probably need to call a new function that takes into consideration the context of the menu call or at least the type of file so you don't have the thing skipping tracks any time you delete any file
Logged

Offline seamoon2

  • Member
  • *
  • Posts: 8
Re: Skip to next track after deleting playing track by auto
« Reply #2 on: October 16, 2017, 02:22:22 PM »
As a file type I always use separate mp3 tracks, it's not problem for me however I don't know the skip next track command so I could add it the code below.

BTW As you can see the code below I removed confirmation step in my code and carried delete menu item to top so two press on select button it deletes the playing file however pressing next button inside a pocket with Sansa Clip Zip is very difficult that's why I want auto skip to next track after delete finishes. 


Code: [Select]
static int delete_file_dir(void)
{


    clear_display(true);
    splash(HZ/2, str(LANG_DELETING));
    splash(HZ/2, ID2P(LANG_DELETING));


    int rc = -1;

    if (selected_file_attr & ATTR_DIRECTORY) { /* true if directory */
        struct dirrecurse_params parm;
        parm.append = strlcpy(parm.path, selected_file, sizeof (parm.path));

        if (parm.append < sizeof (parm.path)) {
            cpu_boost(true);
            rc = remove_dir(&parm);
            cpu_boost(false);
        }
    } else {
        rc = remove(selected_file);
    }

    if (rc < OPRC_SUCCESS) {
        splash_failed(LANG_DELETE);
    } else if (rc == OPRC_CANCELLED) {
        splash_cancelled();
    }

    if (rc != OPRC_NOOP) {
        /* Could have failed after some but not all needed changes; reload */
        onplay_result = ONPLAY_RELOAD_DIR;
    }

    return 1;
}
.
« Last Edit: October 16, 2017, 02:33:52 PM by seamoon2 »
Logged

Offline Bilgus

  • Developer
  • Member
  • *
  • Posts: 731
Re: Skip to next track after deleting playing track by auto
« Reply #3 on: October 16, 2017, 03:07:28 PM »
personally instead of deleting the file outright I think I'd just set a tag and skip to next track and later delete all the files with a particular tag

or perhaps auto rename it to DELETE_<filename>.<ext>

The track skip functionality is exposed in playback.c as void audio_skip(direction)
https://github.com/Rockbox/rockbox/blob/03dd4b92be7dcd5c8ab06da3810887060e06abd5/apps/playback.c#L3470

you'll need to include playback.h in onplay.c
onplay.c..
#include "playback.h"

Logged

Offline seamoon2

  • Member
  • *
  • Posts: 8
Re: Skip to next track after deleting playing track by auto
« Reply #4 on: October 16, 2017, 04:23:04 PM »
I added bold line to onplay.c file and #include "playback.h" it worked. Many thanks Bilgus.  :)

rc = remove(selected_file);
audio_skip(1);
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Skip to next track after deleting playing track by auto
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.025 seconds with 16 queries.