FS#11978 - New Atari SC68/SNDH codec based on the SC68 library by Benjamin Gerard

Attached to Project: Rockbox
Opened by Mauricio Garrido (gama) - Tuesday, 01 March 2011, 22:48 GMT
Task Type Patches
Category Codecs
Status Unconfirmed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Hi, this is a new codec based on the SC68 library
by Benjamin Gerard (

Revision: 29484
Tested on: Sansa Fuze v2


- 44 Khz Stereo sound.
- Supports sc68 and sndh files.
- Support for multi track and single track files.
- Metadata parsing.
- Fade out support.

** This codec needs the sc68 Replay folder to work, just put it in the root of
your player. you can find one here:


1. This is a beta codec, some (big) songs may cause rockbox to crash.
2. When compiling the sc68 library i had a lot of dependencies errors with
missing includes. It is compiling fine now on the vmware image, but not in cygwin.
I still have to find the problem with that.
3. Some songs doesn't work, specially some big sndh files. I'm still working on it.
4. Seek support is broken, i'm working on it.

Please feel free to make any comment or suggestion.

This task depends upon

Comment by JoshuaChang (JoshuaChang) - Wednesday, 02 March 2011, 04:18 GMT
complies fine here, cygwin with gcc 4.4.4 eabi, cowon d2,
ps: codecs.h/c still need to be modified for compiling in non-recording targets
Comment by Postolati Maxim (tails_) - Saturday, 05 March 2011, 13:49 GMT
Just some thoughts about not playing big files: as i understand this program emulates minimal amiga\atari ST hardware then it loads player code and music to emulated RAM (i guess it's 512kb), then maybe it's not enough ram to load big tunes? or this is only rockbox problem? (couldn't get this plyer to work)
Comment by Postolati Maxim (tails_) - Monday, 07 March 2011, 11:32 GMT
Finally got this one to compile :)
Gamma, please note that sc68 is multiformat not only for atari st(e) but for amiga too
attached edited codecs.h\c which works with r29533
Comment by Mauricio Garrido (gama) - Monday, 07 March 2011, 21:45 GMT
> Gamma, please note that sc68 is multiformat ..

I'm a little counfused, what do you mean by multiformat?

And yeah this codec also needs Joshua's patch to compile in all targets,
(the same changes you posted), i just don't have the time to update it right now.
Comment by Postolati Maxim (tails_) - Tuesday, 08 March 2011, 06:17 GMT
Umm I mean it plays tunes made for Atari ST (emulating YM2149F chip) and for Amiga (emulating Paula chip).
Attached tune made for amiga.
Comment by Postolati Maxim (tails_) - Tuesday, 08 March 2011, 06:20 GMT
Also i noticed that i cant select last subtrack, it jumps to next file
Comment by Postolati Maxim (tails_) - Wednesday, 09 March 2011, 06:37 GMT
Noiced now that I can't compile rockbox as application for windows (SDL target, not simulator)
error: make: *** No rule to make target `/home/tails_/rockbox_clean/sdlbuild/emu68/type68.h', needed by `/home/tails_/rockbox_clean/sdlbuild/apps/codecs/libsc68/emu68/emu68.o'. Stop.
Is that only my problem? :S
Comment by Mauricio Garrido (gama) - Wednesday, 09 March 2011, 13:48 GMT
> Noiced now that I can't compile rockbox as application for windows (SDL target, not simulator)

I pointed that out in note2, it seems it is related to the use of subfolders in libsc68, and some files include
headers from other folders,

I don't want to put all files in the one folder but if there is no other option i guess that would be an ugly way to fix it,
and we would still have to change many include directives manually.
Comment by JoshuaChang (JoshuaChang) - Friday, 18 March 2011, 01:34 GMT
fix a compilation error in mips targets, put the file to libsc68 directory:)
Comment by Mauricio Garrido (gama) - Monday, 21 March 2011, 04:13 GMT
Thanks Joshua. That must be affecting the gme codecs too (?). By the way i will spend some time on this codec once i finish
the VGM format from game_music_emu, please let me know if there are any other problems with it.
Comment by JoshuaChang (JoshuaChang) - Monday, 21 March 2011, 04:44 GMT
this file just affect the sc68 codec, other gme codecs are compiled without any problem.
Comment by Postolati Maxim (tails_) - Thursday, 07 April 2011, 11:11 GMT
Hmm how could i change default playtime value? editing two lines in sc68.c changes displayed time but song still stops after 3 minutes

Tip: If you change max amount of memory avaible for codecs big sndh files plays fine
Comment by MichaelGiacomelli (saratoga) - Thursday, 21 April 2011, 17:33 GMT
Looking through this patch, its actually licensed GPLv3 rather then the usual GPLv2. Rockbox is licensed under GPLv2 or later, meaning you can use GPLv3 code with it.

That said, we've never committed GPLv3 code before, and it would be nice to retain GPLv2 compatibility. IMO if this is going to be committed I think it should be entirely enclosed inside #ifdef GPLV3 blocks, so that if someone needs GPLv2 binaries, they can easily disable the v3 bits.
Comment by Mauricio Garrido (gama) - Thursday, 09 June 2011, 23:35 GMT
Here is the updated codec that works with the new playback engine.


- Remove all metadata handling from the codec.
- Removed unnecesary files from patch
- Fixed some track length issue.

Comment by Mauricio Garrido (gama) - Friday, 10 June 2011, 13:44 GMT
Please update the files apps/codecs/libsc68/config.h and apps/codecs/libsc68/api68.c with these ones:

- Fixed some strncpy bug

Comment by Mauricio Garrido (gama) - Friday, 10 June 2011, 13:46 GMT
the files ;)
   config.h (1.1 KiB)
   api68.c (47.7 KiB)