Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#6122 - NSF player

Attached to Project: Rockbox
Opened by Adam Gashlin (AdamGashlin) - Thursday, 05 October 2006, 09:17 GMT+2
Task Type Patches
Category Codecs
Status Closed
Assigned To No-one
Player Type All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Private No

Details

Here's an NSF player, based on NotSo Fatso by Disch.
At the moment it only supports the pAPU, the expansion chip and FDS code is there but I'm working on optimizing the minimal stuff first. Not everything will play real time on my 4g ipod.

Not by any stretch is this "done", but I figured I should get it out there.
   nsf2.patch (18.1 KiB)
 apps/codecs/Makefile  |   15 ++++-
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     |  140 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   14 +++++
 apps/tree.c           |    1 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 tools/configure       |   34 ++++++------
 8 files changed, 188 insertions(+), 20 deletions(-)

   nsf0.1.tar.bz2 (92.8 KiB)
This task depends upon

Closed by  Steve Bavin (pondlife)
Thursday, 25 January 2007, 19:57 GMT+2
Reason for closing:  Accepted
Additional comments about closing:  Committed.
Comment by Paul Louden (darkkone) - Friday, 06 October 2006, 00:02 GMT+2
What's in the archive?
Comment by Adam Gashlin (AdamGashlin) - Friday, 06 October 2006, 05:30 GMT+2
The archive is the emulation library, libNotSo (from NotSo Fatso), goes in /apps/codecs/. I'd have it in the patch, but I don't know how to get directories in a patch.

Now full speed for most stuff, sacrificing some accuracy. Wizardry doesn't work at the moment for reasons to be explored shortly.
   nsf0.2.tar.bz2 (93.2 KiB)
   nsf3.patch (18.8 KiB)
 apps/codecs/Makefile  |   15 +++-
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     |  166 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   14 ++++
 apps/tree.c           |    1 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 tools/configure       |   34 +++++-----
 8 files changed, 214 insertions(+), 20 deletions(-)

Comment by Adam Gashlin (AdamGashlin) - Friday, 06 October 2006, 17:17 GMT+2
Fixed broken mirroring (why SMB3, Wizardry, etc. didn't work).
Fixed DMC (was all but dead, now try out Journey to Silius!)
Comment by Adam Gashlin (AdamGashlin) - Sunday, 08 October 2006, 00:25 GMT+2
Speed improvements, VRC6 support (not full speed for everything, but the first few tracks of Madara run through great).
Comment by Adam Gashlin (AdamGashlin) - Sunday, 08 October 2006, 04:19 GMT+2
Cleaned up warnings, removed some unused stuff (might help speed a bit), added FME-07 support.
Comment by Adam Gashlin (AdamGashlin) - Sunday, 08 October 2006, 09:54 GMT+2
Added FDS, N106, and VRC7 support (though the latter two are pretty much unusable on my iPod due to them being rather powerful synthesizers in their own right).
Added NSFe loading, track lengths and fade times are read from NSFe. No playlist support yet.
Artist, game name, and company (copyright info) are loaded and displayed as artist, track name, and album, respectively.
I noticed that the loading code is quite endian-dependent (as the files are little endian and the code is written assuming little endian loading of 32 bit integers), this will have to be remedied. Part of this is the reason why there are now warnings shown again.
Oh, and the progress bar will now correctly report the current track as play advances.
   nsf0.8.tar.bz2 (93.4 KiB)
   nsf4.patch (19.9 KiB)
 apps/codecs/Makefile  |   15 +++-
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     |  184 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   30 ++++++++
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 tools/configure       |   34 ++++-----
 8 files changed, 249 insertions(+), 20 deletions(-)

Comment by Adam Gashlin (AdamGashlin) - Sunday, 08 October 2006, 10:28 GMT+2
Fixed metadata.c reading of number of tracks in NSFe files (had the wrong offset, durr)
   nsf5.patch (19.9 KiB)
 apps/codecs/Makefile  |   15 +++-
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     |  184 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   30 ++++++++
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 tools/configure       |   34 ++++-----
 8 files changed, 249 insertions(+), 20 deletions(-)

Comment by Adam Gashlin (AdamGashlin) - Monday, 09 October 2006, 08:41 GMT+2
Cleaned up endian dependency in the NSFe loading, removed a bunch of stuff related to stereo which isn't needed (since I only render mono).

I haven't had this tested on a big endian system, though, if anyone can perform such a test and let me know how it works out I'd very much appreciate it. In fact, it hasn't been tested on anything but ipods so far. So please give it a go, it is very usable now and could use testing. If anyone is squemish about building the source I can put together a custom build for you.
Comment by Adam Gashlin (AdamGashlin) - Tuesday, 10 October 2006, 05:20 GMT+2
Fixed a bug, failed to clear out the bank array when loading from an NSFe.
Comment by Adam Gashlin (AdamGashlin) - Thursday, 12 October 2006, 06:59 GMT+2
Fixed some more endian issues, haven't tested this latest version on a big endian target, though.
   nsf0.13.tar.bz2 (92.8 KiB)
   nsf6.patch (20 KiB)
 apps/codecs/Makefile  |   15 +++-
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     |  186 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   30 ++++++++
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 tools/configure       |   34 ++++-----
 8 files changed, 251 insertions(+), 20 deletions(-)

Comment by Adam Gashlin (AdamGashlin) - Thursday, 12 October 2006, 18:33 GMT+2
Backing out some bits that were meant to improve speed but, on further examination, slowed things down. Madara and Gimmick! run full speed again.
Comment by Adam Gashlin (AdamGashlin) - Thursday, 12 October 2006, 22:26 GMT+2
0.14 wouldn't build on coldfire targets due to some bug within gcc, so I changed a number of parameters to const which was probably a good idea to do anyway. Nicer speed and now builds for all targets I've tried.
Builds here: http://hcs64.com/rockbox/
Comment by Adam Gashlin (AdamGashlin) - Friday, 13 October 2006, 02:39 GMT+2
The fellow testing on his H120 for me reported that the last build actually slowed down, so I've added some conditional code to disable certain changes I made on coldfire targets. It is still running slower than it should, but he reports it is back up to the performance of 0.13.
Comment by Adam Gashlin (AdamGashlin) - Saturday, 14 October 2006, 09:01 GMT+2
A new mode of operation, inspired by a similar setting on the ADX decoder, causes somewhat different behavior when Repeat One is enabled. First, track limits are not enforced (this includes silence detection). Second, since pressing the button to advance to the next track in Repeat One mode has no effect, it is now used to switch to the next song in the NSF, making operation easier than seeking. This is done in a moderately hacky way.
To try to keep things consistent, I've named the patch nsf0.17.patch, to show that it comes after the nsf0.16.tar.bz2 (libNoSo). You'll need the latest numbered version of both the patch and the .tar.bz2 archive to build.
   nsf0.17.patch (20.5 KiB)
 apps/codecs/Makefile  |   15 ++-
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     |  204 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   30 +++++++
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 tools/configure       |   34 ++++----
 8 files changed, 269 insertions(+), 20 deletions(-)

Comment by Paul Louden (darkkone) - Wednesday, 18 October 2006, 02:41 GMT+2
In testing the player, I've found it to lock up my H120 while skipping .nsf file (tapping next while not in repeat-1 mode). It was then necessary to reset it using the reset pinhole. The player was unresponsive though the backlight would still brighten and dim with button presses and timeouts.
Comment by Adam Gashlin (AdamGashlin) - Wednesday, 18 October 2006, 03:23 GMT+2
Do you recall what/how many NSFs you were skipping between? I've been unable to reproduce this yet on my ipod, but the architecture is quite a bit different. Does this always happen when skipping?
Comment by Paul Louden (darkkone) - Wednesday, 18 October 2006, 04:34 GMT+2
I cannot easily reproduce it. It seems to be able to happen only on multiple skips so far. If I skip forward, and then skip again before music can start playing (such as seeing that the next NSF file isn't the one I want) as it seems to take several seconds from skipping into a file before playback starts.

Unfortunately I'm not wholly sure which NSF may have caused the problem. Part of my mind is saying Ninja Gaiden 2, and another part Castlevania 1, but it could easily be neither of those.
Comment by Adam Gashlin (AdamGashlin) - Monday, 23 October 2006, 09:11 GMT+2
Made "repeat one" work a bit more reasonably.
All code is now in a single file (no libNotSo, and now there's a single patch), tidied up a bit.
Enabled processing of undocumented opcodes (Loopz now works).
Speed seems to have taken a slight hit, much work to be done along those lines.
   nsf0.20.patch (131.9 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4730 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   30 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 7 files changed, 4767 insertions(+)

Comment by Adam Gashlin (AdamGashlin) - Monday, 23 October 2006, 16:42 GMT+2
Oh, something I failed to remember when writing the last comment: VRC7 support is removed, as only one game uses it, it takes up a whole lot of space, and it will likely never run full speed.
Comment by Adam Gashlin (AdamGashlin) - Thursday, 26 October 2006, 03:04 GMT+2
I've put some profiling code in (disabled by default), helped me find a lot of things to speed up. Mostly at the cost of approximation, though, so if anything sounds off let me know (I haven't been able to hear the difference). Speed is very much better.
   nsf0.21.patch (135.6 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4889 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |    2 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 7 files changed, 4898 insertions(+)

Comment by Paul Louden (darkkone) - Thursday, 26 October 2006, 04:32 GMT+2
Okay, tried patch 21. On a clean build of Rockbox I applied JUST that .patch file, compile, .nsf files are recognized as music (have the notes next to them) but when I play them it goes to the WPS and says "No File."

Was I supposed to apply 21 over 20 or anything? (Tested with an H120, just to clarify)
Comment by Adam Gashlin (AdamGashlin) - Thursday, 26 October 2006, 06:46 GMT+2
sorry, I'm getting that when cleanly applying the patch too, must've screwed up while making it
Comment by Adam Gashlin (AdamGashlin) - Thursday, 26 October 2006, 07:35 GMT+2
There were sufficient changes to metadata.c that the patch didn't go in, and I was only testing rebuilding the codec itself, so I didn't notice. This new one should work.
   nsf0.22.patch (136.6 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4889 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   27 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 7 files changed, 4923 insertions(+)

Comment by Paul Louden (darkkone) - Thursday, 26 October 2006, 07:49 GMT+2
Just wanted to follow up to confirm that it's working here as well. Though, it feels like playback is a good deal slower than it was with 17. I'm not 100% sure, but at the very least on H120 the first song of the metroid .nsf is halting quite a bit, it's not realtime, and I *think* that I played it succesfully with 17, but I'm honestly not absolutely positive.
Comment by Adam Gashlin (AdamGashlin) - Thursday, 26 October 2006, 08:05 GMT+2
Fixed an issue with the triangle wave running even when silenced, causes unpleasant clicks when it comes back on, esp noticable in Zelda 2 track 2.
Speaking of track numbers, is zero-based ok for everyone?

I don't know what to say about your speed issues... everything is running much faster on ARM. I'd like you to run the profiled version (uncomment #define NSF_PROFILE) so I can get an idea where the problem is, but it uses the portalplayer's USEC_TIMER, and I don't know of an equivalent mechanism on the coldfile. Could you try removing the whole #if CONFIG_CPU==etc. block at the beginning? One tester was reporting those helped with speed, but that was several versions back.
   nsf0.23.patch (135.6 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4861 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   27 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 7 files changed, 4895 insertions(+)

Comment by Adam Gashlin (AdamGashlin) - Thursday, 26 October 2006, 09:40 GMT+2
NSFE playlists supported (as long as repeat != one, this is assumed to be fully manual mode)
   nsf0.24.patch (137 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4879 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   39 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 7 files changed, 4925 insertions(+)

Comment by Adam Gashlin (AdamGashlin) - Thursday, 26 October 2006, 13:58 GMT+2
Force reinit of nsf core on track change, changed some related variable names around to make things more clear.
   nsf0.25.patch (137.6 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4890 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   39 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 7 files changed, 4936 insertions(+)

Comment by Adam Gashlin (AdamGashlin) - Friday, 27 October 2006, 06:22 GMT+2
Fixed an issue with repeat one mode, wasn't behaving properly when selecting a new file.
Moved a lot of stuff into IRAM, helped speed a lot for someone on an H120.
Cleaned up a bunch of code related to mixing that isn't needed now (since every channel is played at full volume).
   nsf0.27.patch (134.7 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4774 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   39 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 7 files changed, 4820 insertions(+)

Comment by Adam Gashlin (AdamGashlin) - Friday, 27 October 2006, 07:14 GMT+2
Quick fix, I broke the third FME07 channel when moving the mix tables around. Should be good now.
   nsf0.28.patch (134.7 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4774 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   39 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 7 files changed, 4820 insertions(+)

Comment by Adam Gashlin (AdamGashlin) - Saturday, 28 October 2006, 22:39 GMT+2
Fixed to compile with current CVS (dithering is no longer controlled by the codec). No other changes.
   nsf0.29.patch (134.7 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4773 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   39 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    2 
 7 files changed, 4819 insertions(+)

Comment by Adam Gashlin (AdamGashlin) - Tuesday, 07 November 2006, 16:34 GMT+2
Sync'd to CVS again.
   nsf0.30.patch (134.4 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4773 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   37 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    3 
 7 files changed, 4818 insertions(+)

Comment by Adam Gashlin (AdamGashlin) - Monday, 27 November 2006, 04:39 GMT+2
Sync'd to CVS again.
   nsf0.31.patch (134.4 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4766 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   37 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    3 
 7 files changed, 4811 insertions(+)

Comment by Adam Gashlin (AdamGashlin) - Monday, 27 November 2006, 09:02 GMT+2
Problems with IRAM fixed, and more stuff moved into IRAM for additional speediness.
   nsf0.34.patch (134.3 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4759 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   37 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    3 
 7 files changed, 4804 insertions(+)

Comment by Linus Nielsen Feltzing (linusnielsen) - Monday, 27 November 2006, 09:35 GMT+2
One question: how much have you changed in the original source code?

The reason I am asking is because nsf.c breaks just about every rule we have regarding source code formatting, e.g mixed case identifiers, TAB characters and // comments.

We allow this kind of formatting if it helps us maintain the code, for example patches from the main project, but if you have rewritten large portions of it anyway, we certainly prefer having the code follow our guidelines.
Comment by Adam Gashlin (AdamGashlin) - Monday, 27 November 2006, 09:46 GMT+2
True to form I got some stuff backwards, VRC6 should work correctly now.

It has been substantially rewritten, so I'm going to need to clean it up.
   nsf0.35.patch (134.3 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4757 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   37 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    3 
 7 files changed, 4802 insertions(+)

Comment by Linus Nielsen Feltzing (linusnielsen) - Monday, 27 November 2006, 09:49 GMT+2
Apart from the formatting, how ready for CVS do you feel it is?
Comment by Adam Gashlin (AdamGashlin) - Monday, 27 November 2006, 09:52 GMT+2
It's working reliably on several targets (ipods and h120s), the biggest thing holding it back for me is the use of floating point in some inconvenient places. It'd be nice to have some more information in the metadata prefetch, as well, but I don't think that is critical.
Comment by Adam Gashlin (AdamGashlin) - Monday, 01 January 2007, 12:19 GMT+2
Did some formatting, no tabs and 80 characters per line, got rid of the #define this stuff, removed a bunch of commented code and moved every comment to /* */ format. I specifically didn't change the capitalization of many variable names, because I think they are most readable in their current form, and the #defines in the CPU emulator are still mixed case.
If this is in good enough shape I'd like it to be considered for CVS.
(application/octet-stream)    nsf0.36.patch (150.5 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4507 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   37 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    3 
 7 files changed, 4552 insertions(+)

Comment by Adam Gashlin (AdamGashlin) - Tuesday, 02 January 2007, 01:54 GMT+2
FDS now implemented with fixed point math. Metadata loading cleaned up. More formatting fixes.
(application/octet-stream)    nsf0.37.patch (149.7 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4513 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   11 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    3 
 7 files changed, 4532 insertions(+)

Comment by Adam Gashlin (AdamGashlin) - Tuesday, 02 January 2007, 04:25 GMT+2
Whoops, typo broke builds with ICODE.
(application/octet-stream)    nsf0.38.patch (149.7 KiB)
 apps/codecs/Makefile  |    1 
 apps/codecs/SOURCES   |    1 
 apps/codecs/nsf.c     | 4513 ++++++++++++++++++++++++++++++++++++++++++++++++++
 apps/metadata.c       |   11 
 apps/tree.c           |    2 
 firmware/export/id3.h |    1 
 firmware/id3.c        |    3 
 7 files changed, 4532 insertions(+)

Comment by Tom Ross (midgey34) - Tuesday, 09 January 2007, 00:28 GMT+2
Just some feedback for you from a coldfire user (H320). I queued two NSF files, The Legend of Zelda and Super Mario Bros., let them play and went to the audio debug screen. After letting it play for a while, I got a boost ratio of 10% or so. Nice job, keep it up.

Loading...