• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Codecs
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Adam Gashlin - 2006-10-05

FS#6122 - NSF player

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.

Closed by  Steve Bavin
2007-01-25 18:57
Reason for closing:  Accepted
Additional comments about closing:  


Paul Louden commented on 2006-10-05 22:02

What’s in the archive?

Adam Gashlin commented on 2006-10-06 03:30

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.

Adam Gashlin commented on 2006-10-06 15:17

Fixed broken mirroring (why SMB3, Wizardry, etc. didn’t work).
Fixed DMC (was all but dead, now try out Journey to Silius!)

Adam Gashlin commented on 2006-10-07 22:25

Speed improvements, VRC6 support (not full speed for everything, but the first few tracks of Madara run through great).

Adam Gashlin commented on 2006-10-08 02:19

Cleaned up warnings, removed some unused stuff (might help speed a bit), added FME-07 support.

Adam Gashlin commented on 2006-10-08 07:54

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.

Adam Gashlin commented on 2006-10-08 08:28

Fixed metadata.c reading of number of tracks in NSFe files (had the wrong offset, durr)

Adam Gashlin commented on 2006-10-09 06:41

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.

Adam Gashlin commented on 2006-10-10 03:20

Fixed a bug, failed to clear out the bank array when loading from an NSFe.

Adam Gashlin commented on 2006-10-12 04:59

Fixed some more endian issues, haven’t tested this latest version on a big endian target, though.

Adam Gashlin commented on 2006-10-12 16:33

Backing out some bits that were meant to improve speed but, on further examination, slowed things down. Madara and Gimmick! run full speed again.

Adam Gashlin commented on 2006-10-12 20:26

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:

Adam Gashlin commented on 2006-10-13 00:39

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.

Adam Gashlin commented on 2006-10-14 07:01

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.

Paul Louden commented on 2006-10-18 00:41

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.

Adam Gashlin commented on 2006-10-18 01:23

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?

Paul Louden commented on 2006-10-18 02:34

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.

Adam Gashlin commented on 2006-10-23 07:11

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.

Adam Gashlin commented on 2006-10-23 14:42

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.

Adam Gashlin commented on 2006-10-26 01:04

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.

Paul Louden commented on 2006-10-26 02:32

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)

Adam Gashlin commented on 2006-10-26 04:46

sorry, I’m getting that when cleanly applying the patch too, must’ve screwed up while making it

Adam Gashlin commented on 2006-10-26 05:35

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.

Paul Louden commented on 2006-10-26 05:49

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.

Adam Gashlin commented on 2006-10-26 06:05

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.

Adam Gashlin commented on 2006-10-26 07:40

NSFE playlists supported (as long as repeat != one, this is assumed to be fully manual mode)

Adam Gashlin commented on 2006-10-26 11:58

Force reinit of nsf core on track change, changed some related variable names around to make things more clear.

Adam Gashlin commented on 2006-10-27 04:22

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).

Adam Gashlin commented on 2006-10-27 05:14

Quick fix, I broke the third FME07 channel when moving the mix tables around. Should be good now.

Adam Gashlin commented on 2006-10-28 20:39

Fixed to compile with current CVS (dithering is no longer controlled by the codec). No other changes.

Adam Gashlin commented on 2006-11-07 15:34

Sync’d to CVS again.

Adam Gashlin commented on 2006-11-27 03:39

Sync’d to CVS again.

Adam Gashlin commented on 2006-11-27 08:02

Problems with IRAM fixed, and more stuff moved into IRAM for additional speediness.

Project Manager
Linus Nielsen Feltzing commented on 2006-11-27 08:35

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.

Adam Gashlin commented on 2006-11-27 08:46

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.

Project Manager
Linus Nielsen Feltzing commented on 2006-11-27 08:49

Apart from the formatting, how ready for CVS do you feel it is?

Adam Gashlin commented on 2006-11-27 08:52

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.

Adam Gashlin commented on 2007-01-01 11:19

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.

Adam Gashlin commented on 2007-01-02 00:54

FDS now implemented with fixed point math. Metadata loading cleaned up. More formatting fixes.

Adam Gashlin commented on 2007-01-02 03:25

Whoops, typo broke builds with ICODE.

Tom Ross commented on 2007-01-08 23:28

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.


Available keyboard shortcuts


Task Details

Task Editing