Rockbox

Tasklist

FS#12131 - rockout sampler/drum machine

Attached to Project: Rockbox
Opened by James MacLean (selectohh) - Thursday, 26 May 2011, 23:19 GMT
Task Type Patches
Category Plugins
Status Unconfirmed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Release 3.8.1
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

rockout is a sampler that can play 6 samples at a time (unlimited playback length). sample playback is 16 bit 44.1khz. you can play samples back, you can glitch samples out using the glitch sequencer, there is echo, there is distortion, backwards, and a record loop function. you can load your own samples into rockout (stereo .WAV 16bit 44.1khz files)

rockout currently works on the sansa e200 series and c200 series. don't hold your breath for other players to work, due to their greatly lower amounts of RAM.

---

rar file only includes 1 very small/crappy sample pack. more (better) sample packs available at:

1) the motherload: 10 folders of samples, almost all hand selected/cut by myself:
http://www.megaupload.com/?d=BXMTW9T8

2) individual folders:

https://docs.google.com/leaf?id=0BwiF_VSZhsHjNjY1OWQzZTQtY2M2Zi00M2NhLWJlN2EtOTI0Nzk2MTJiYjI5&hl=en_US

https://docs.google.com/leaf?id=0BwiF_VSZhsHjYjQwMGFmOTMtMjM4YS00YTZjLWJkNzUtZTEzOGEzMTU0YzI0&hl=en_US

https://docs.google.com/leaf?id=0BwiF_VSZhsHjNjE0ZTc3YTUtYTNiZS00ZGJjLThmNTQtNmQ1MWU0NTk3YjRj&hl=en_US

https://docs.google.com/leaf?id=0BwiF_VSZhsHjNjM4NzMxYzQtZTVkZC00OGZhLThiZDUtMjYyZTgzNzFmZWQ2&hl=en_US

https://docs.google.com/leaf?id=0BwiF_VSZhsHjMjFiNDk2ODQtZmU2YS00Yzk0LTg3YTMtNDY1YWMzYjU4ZmM0&hl=en_US

https://docs.google.com/leaf?id=0BwiF_VSZhsHjN2MxZWE0NTAtMmJmMS00YmZjLWFjM2YtMjM1NzlhOWUyMmMz&hl=en_US


This task depends upon

Comment by James MacLean (selectohh) - Thursday, 26 May 2011, 23:20 GMT
documentation (how to install, how to use, programmers guide) in the rockout rar file.
Comment by MichaelGiacomelli (saratoga) - Friday, 27 May 2011, 02:23 GMT
Did you forget the patch?
Comment by James MacLean (selectohh) - Friday, 27 May 2011, 02:53 GMT
oops. here it is
Comment by MichaelGiacomelli (saratoga) - Friday, 27 May 2011, 03:07 GMT
Some quick comments:

1) rockbox style guidelines. They're in docs/CONTRIBUTING. No //, no tabs, 80 characters per line, etc. Take a look.

2) Its really hard to read that because the spacing is broken. If you could go through, fix the tabluation, and then set your text editor to save tabs as 4 spaces it would be much easier to figure out your code.

3) You have an enormous case statement where almost every case is identical. Unless I'm missing something, of those 300 odd cases, you really only need BUTTON_REPEAT, BUTTON_RELEASE and a null one for neither, and then some pointer arithmetic or even if statements in each case to set or zero the flags. You could cut down the size of that patch by perhaps a thousand lines if you got rid of all the redundant ones.
Comment by sideral (sideral) - Friday, 27 May 2011, 07:50 GMT
Hi selectohh,

First, thanks for contributing this plugin! I'd love to see this included in Rockbox. To put my (and saratoga's) comments into context, please remember that the people who criticize your work are the ones interested in it. Figuring that out when I started contributing to Rockbox took me a while. :)

Here are some more comments:

Thanks for including documentation with your patch; that was helpful.

I see nothing in principle that would prevent at least basic support for other players that have enough RAM (RaaA, all AMSv2 players?), except the per-player configuration of the key mapping and the key-repeat timeout.

The patch is missing the required changes to SOURCES or to makefiles (if any).

You are licensing the code under a noncommercial CC license. Are you dual-licensing the code alternatively to the GPL, which you also mention? If not (and the noncommercial restriction is in addition to the GPL), the code cannot be included in Rockbox.

I agree with saratoga that the coding needs to be improved. There is lots of repetition, loops that check for each loop index separately in their body, nondescriptive variable names, hardcoded constants sprinkled throughout the code, etc. Also, the memory management looks rather ad-hoc; consider using buflib.

Some more general remarks:

If you'd like developers to be constructive and productive with your work, you need to optimize for their time investment. Here are some tips:
* Follow saratoga's advice regarding the coding style. Also make sure the patch does not contain DOS line endings (CRLF).
* Convert the developer and user documentation to plain text, and upload them and the patch as separate attachments, rather than asking them to use tools like Rar and Word.
* Consider splitting the code into multiple source files.
* Remove profanity from the code and documentation.
Comment by James MacLean (selectohh) - Friday, 27 May 2011, 11:05 GMT
eh ok thank you for all that. my first c program and my first attempt at a plugin so that is my defense. will see about following as many of these things as possible
Comment by Nick Sant (evilnick) - Friday, 27 May 2011, 13:44 GMT
sideral is 100% correct. The advice given here is not designed to put you off contributing, but just to ensure the consistency of the Rockbox code.
Please don't think that you should be on the defensive.
Also, I have to say that I haven't yet tried this patch but it sounds extremely interesting! So thanks for providing it and I hope that you continue to contribute.
Comment by James MacLean (selectohh) - Friday, 27 May 2011, 20:04 GMT
here is the new patch. i hope this fixes:
a) 80 chars per line
b) unix newlines \n instead of \r\n
c) tabs are all unified and i'm think if i fixed the tabs->spaces problem, i think i did but i can't "see" them
d) no more // comments (only /* */)
e) no more swearing in code/docs
f) docs are now .txt and not word format
g) patch should have SOURCES file diff included (i cut out a chunk of this diff file, i had it on autorock, hopefully it still works + doesn't have formatting from resaving)
h) files are now outside of a rar file.. well.. the code will be. how do you suggest i upload the minimum required samples folders

not fixed:
a) the superlong buttondown case.
b) support for other players that have enough RAM (RaaA, all AMSv2 players?)
c) splitting code into separate files
d) the non-commercial licence. why isn't that CC licence acceptable? is rockbox considered "commercial use"?

i will probably be back to fix b) and d) of the "not fixed".

thanks for your suggestions, please let me know if there's others or if the above fixes didn't work. i suppose it was discouraging to hear all the criticisms but thankfully a good number of them are formatting. although i'm sure if/when you look at the code you will be quite unhappy with my sloppy programming :)
Comment by MichaelGiacomelli (saratoga) - Friday, 27 May 2011, 21:26 GMT
>why isn't that CC licence acceptable?

Your plugin will link against Rockbox, which is GPL, and so must also be GPL. You can dual license of course, but since CC code cannot be used with GPL projects like rockbox, it would be fairly pointless.
Comment by sideral (sideral) - Saturday, 28 May 2011, 23:25 GMT
Hi selectohh,

Thanks, the latest patch is much easier to read! Please don't be shy with your code. I'd say that for a first C program, this plugin is quite an achievement!

I wouldn't waste time porting this to other players just yet.

Instead, I suggest you focus next on removing the code's redundancy. At first glance, it looks like almost all the case differentiations (switch and chained if statements) could be replaced by a single code instance with a lookup table and a little pointer or index arithmetic.

For example, instead of differentiating among stolen_audio_buffer, stolen_audio_buffer1, stolen_audio_buffer2, and so on, you can have a *stolen_audio_buffer[] array indexed with the buffer number. Another example that springs to mind are raw_file{,1,2,3,4,5} variables. Once you know how to factor out common code, you can tackle the huge switch(button_get) statement.

A minor comment: The patch to SUBDIRS is not needed.

Regarding the license: The GPL is incompatible with a noncommercial license because the GPL does not restrict commercial applications, but explicitly disallows restricting the rights granted by the GPL in derived works. That's why it's often said the GPL is “viral”: GPL'd works can only be combined with works under other licenses that put less restrictions on licensing than the GPL itself, and doing so effectively GPLs the resulting derived work.
Comment by James MacLean (selectohh) - Sunday, 29 May 2011, 15:25 GMT
hi sideral, thanks! will do. thanks for being specific about what could be changed it makes it easier for me to understand how to go about it. not sure how much time i have right now but worst case in a month i should have time
Comment by Dominik Riebeling (bluebrother) - Sunday, 05 June 2011, 11:08 GMT
Please update your Flyspray profile to include your real name. We have a real name policy and people are not going to search after your real name. If not this task is likely to get rejected because of no real name soon.
Comment by James MacLean (selectohh) - Wednesday, 22 June 2011, 18:16 GMT
removed reference to creative commons licence and updated real name.

Loading...