Rockbox

Tasklist

FS#6122 - NSF player

Attached to Project: Rockbox
Opened by Adam Gashlin (AdamGashlin) - Thursday, 05 October 2006, 07:17 GMT
Task Type Patches
Category Codecs
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
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.
This task depends upon

Closed by  Steve Bavin (pondlife)
Thursday, 25 January 2007, 18:57 GMT
Reason for closing:  Accepted
Additional comments about closing:  Committed.
Comment by Paul Louden (darkkone) - Thursday, 05 October 2006, 22:02 GMT
What's in the archive?
Comment by Adam Gashlin (AdamGashlin) - Friday, 06 October 2006, 03:30 GMT
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.
Comment by Adam Gashlin (AdamGashlin) - Friday, 06 October 2006, 15:17 GMT
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) - Saturday, 07 October 2006, 22:25 GMT
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, 02:19 GMT
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, 07:54 GMT
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.
Comment by Adam Gashlin (AdamGashlin) - Sunday, 08 October 2006, 08:28 GMT
Fixed metadata.c reading of number of tracks in NSFe files (had the wrong offset, durr)
Comment by Adam Gashlin (AdamGashlin) - Monday, 09 October 2006, 06:41 GMT
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, 03:20 GMT
Fixed a bug, failed to clear out the bank array when loading from an NSFe.
Comment by Adam Gashlin (AdamGashlin) - Thursday, 12 October 2006, 04:59 GMT
Fixed some more endian issues, haven't tested this latest version on a big endian target, though.
Comment by Adam Gashlin (AdamGashlin) - Thursday, 12 October 2006, 16:33 GMT
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, 20:26 GMT
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, 00:39 GMT
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, 07:01 GMT
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.
Comment by Paul Louden (darkkone) - Wednesday, 18 October 2006, 00:41 GMT
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, 01:23 GMT
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, 02:34 GMT
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, 07:11 GMT
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.
Comment by Adam Gashlin (AdamGashlin) - Monday, 23 October 2006, 14:42 GMT
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, 01:04 GMT
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.
Comment by Paul Louden (darkkone) - Thursday, 26 October 2006, 02:32 GMT
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, 04:46 GMT
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, 05:35 GMT
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.
Comment by Paul Louden (darkkone) - Thursday, 26 October 2006, 05:49 GMT
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, 06:05 GMT
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.
Comment by Adam Gashlin (AdamGashlin) - Thursday, 26 October 2006, 07:40 GMT
NSFE playlists supported (as long as repeat != one, this is assumed to be fully manual mode)
Comment by Adam Gashlin (AdamGashlin) - Thursday, 26 October 2006, 11:58 GMT
Force reinit of nsf core on track change, changed some related variable names around to make things more clear.
Comment by Adam Gashlin (AdamGashlin) - Friday, 27 October 2006, 04:22 GMT
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).
Comment by Adam Gashlin (AdamGashlin) - Friday, 27 October 2006, 05:14 GMT
Quick fix, I broke the third FME07 channel when moving the mix tables around. Should be good now.
Comment by Adam Gashlin (AdamGashlin) - Saturday, 28 October 2006, 20:39 GMT
Fixed to compile with current CVS (dithering is no longer controlled by the codec). No other changes.
Comment by Adam Gashlin (AdamGashlin) - Tuesday, 07 November 2006, 15:34 GMT
Sync'd to CVS again.
Comment by Adam Gashlin (AdamGashlin) - Monday, 27 November 2006, 03:39 GMT
Sync'd to CVS again.
Comment by Adam Gashlin (AdamGashlin) - Monday, 27 November 2006, 08:02 GMT
Problems with IRAM fixed, and more stuff moved into IRAM for additional speediness.
Comment by Linus Nielsen Feltzing (linusnielsen) - Monday, 27 November 2006, 08:35 GMT
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, 08:46 GMT
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.
Comment by Linus Nielsen Feltzing (linusnielsen) - Monday, 27 November 2006, 08:49 GMT
Apart from the formatting, how ready for CVS do you feel it is?
Comment by Adam Gashlin (AdamGashlin) - Monday, 27 November 2006, 08:52 GMT
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, 11:19 GMT
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.
Comment by Adam Gashlin (AdamGashlin) - Tuesday, 02 January 2007, 00:54 GMT
FDS now implemented with fixed point math. Metadata loading cleaned up. More formatting fixes.
Comment by Adam Gashlin (AdamGashlin) - Tuesday, 02 January 2007, 03:25 GMT
Whoops, typo broke builds with ICODE.
Comment by Tom Ross (midgey34) - Monday, 08 January 2007, 23:28 GMT
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...