Rockbox Development > Starting Development and Compiling
need help with a new feature: checking if next song on playlist is next on album
(1/1)
Falco98:
For a while I've wanted to write one additional option for "crossfade enable", which I think i would call "album mode". Simply put, it would enable crossfade in all circumstances except when the next song on the playlist is the next song from the same album / cd / etc. as the current song.
Problem is, I'm not sure how to write the function. I've written another option for crossfade mode before (i made "shuffle + track skip"), but this one requires a little more coding run-around. Adding the option itself should be simple, but I need someone to advise me in writing a function that basically checks whether the next track is really "next".
I've asked in IRC before, and people make the suggestion that the function simply check that (album_name) is the same, and (tracknumber_next) == (tracknumber_current + 1). This seems pretty solid to me (it should work in nearly all cases where users are using properly tagged songs), but I'm just not sure how to do that specific code. Any pointers, advice, or discussion would be appreciated!
Llorean:
Matching album_name is not necessarily going to be consistent. There are many albums out there simply called "Greatest Hits." While it'd be an uncommon situation, you'd also want to check other factors. For example, compare the artist string too, and make sure "matching because the tags are missing" actually counts as not matching.
Honestly though, how do you justify a feature that is "always crossfade except in the exceedingly rare chance that two songs from the same album show up in shuffle next to each other in order" in terms of added code complexity, especially considering the additional checks that would need to be made? Crossfade's already been a problematic portion of the code.
Falco98:
checking for artist would be pertinent, too, for the reasons you said. I had considered that, but had left it out either because I forgot or to be brief. The checks it does could be tweaked a bit to get the best of all cases, after the core functionality is established.
Regarding the justification for this feature: I have a tendency to listen to big randomized playlists, either a large playlist created then set to shuffle mode, or not in shuffle mode but created using the "insert shuffled" feature (or simply doing a "shuffle list" after constructing a playlist). When listening in this vein, I want every track transition to be crossfaded -- but occasionally I feel like interjecting a whole album into my playlist. At the moment, the only way to have such an insertion played without crossfading would be to manually go in and disable crossfade, and remember to reenable it when the album ends. Perhaps one could simply turn "shuffle mode" off, but what effect would that have on an otherwise-random playlist? (perhaps I should try, i guess).
Also occasionally while listening in shuffle, one song will start which I know transitions smoothely into another, and I'll manually insert that song after the current one. It's kindof a corner case, but another example nonetheless.
This is one that perhaps would be just obscure enough that I'd keep it as a patch for personal use -- though as I see it, it would really add no complexity to code, nor to the crossfade routine itself (it would simply do a binary check based on the aforementioned criteria, and if it matches, disable crossfade for the current transition). In any case, It would be useful to me and it would at least be neat to see if I could get it working, and if I did it well enough it may even be considered for addition to the project. For now I'm just trying to satisfy my curiosity as to what I need to do the checking, just code-wise.
Rincewind:
--- Quote from: Llorean on May 11, 2008, 01:29:35 AM ---Honestly though, how do you justify a feature that is "always crossfade except in the exceedingly rare chance that two songs from the same album show up in shuffle next to each other in order" in terms of added code complexity, especially considering the additional checks that would need to be made? Crossfade's already been a problematic portion of the code.
--- End quote ---
I don't think that this feature only has it's use in shuffle mode, I think it is useful when you listen to whole albums most of the time but sometimes you queue extra songs or manipulate the playlist in other ways. With the feature the OP wants to implement I would turn this on and have always the behavior I want - no crossfade for albums, where the composer (hopefully) made a nice transition. In other situations I like crossfade very much.
I think this option would have the same justification as "crossfade only on manual track change" - it is nice to have. And this can be said about a lot of things in rockbox, which is ok, imho.
Falco98: please put your work on the tracker when it is (partially) usable, I am very interested!
yapper:
I'm another one in favor of this idea. I love crossfade, so any improvement in its behaviour are appreciated.
Navigation
[0] Message Index
Go to full version