Wrapper needed for SIDplay2

BlitzMax Forums/BlitzMax Beginners Area/Wrapper needed for SIDplay2

Bremer(Posted 2006) [#1]
Would someone please write a wrapper for the libsidplay2.dll included in the package that can be downloaded from the following page:

http://www.gsldata.se/c64/spw/

It would really be nice to be able to use some of the many tunes written for the old SID chip.

I have no idea about how to go about it or I would have tried myself.


wedoe(Posted 2006) [#2]
Wasn't it Tracer who made a SIDplayer for B3D but
never released the source due to some minor bugs ?
Maybe it's time for another go ?

I'd love to see this one too, gotta love old SID's ! :o)


Matthew Smith(Posted 2006) [#3]
Zawran,

I asked a while ago but no one was really interested in helping (and my c/c++ are not the best).

Personally I would be willing to pay (or offer other incentives) for some kind person to take a look!!


Grisu(Posted 2006) [#4]
Yeah, Tracer started on that a long time ago.

We need SID support!


FlameDuck(Posted 2006) [#5]
Personally I would be willing to pay (or offer other incentives) for some kind person to take a look!!
Other incentives eh? Sounds rather dodgey to me.

Without having given either a particularly close look, I would imagine the biggest challenge being getting Sidplay to play well (no pun intended) with freeaudio.


TartanTangerine (was Indiepath)(Posted 2006) [#6]
$$ How much?


Matthew Smith(Posted 2006) [#7]
Other incentives eh? Sounds rather dodgey to me.

I'd be willing to offer a free copy of my IDE once it's finished

or

$$ How much?

up to about 20$US


If anyone wishes to start - here is the source and homepage:

http://www.projectstudioide.com/files/sidplay-libs-2.1.1.zip

http://sourceforge.net/project/showfiles.php?group_id=9266


Bremer(Posted 2006) [#8]
I wouldn't mind paying US$20 as well. I only need it for commercial use only small free projects which is written for the fun of it. But I really like the sound of the SID tunes, so I am willing to pay up :)


Matthew Smith(Posted 2006) [#9]
No one game to take a crack???


gman(Posted 2006) [#10]
ive taken a look into this. i think the big problem with people attempting this is just getting libsidplay compiled to work with gcc. i was able to finally get a lib and DLL compiled via Dev-CPP by getting the current CVS snapshot and then tweaking a few files. the way the source is setup though, im having a problem creating an instance of the sidplay2 class. ill take a few more shots and call it quits.


Matthew Smith(Posted 2006) [#11]
gman - out of everyone here, you were probably the one I was really hoping!!! thanks for taking a look!


gman(Posted 2006) [#12]
thx for the kind words :) dont get your hopes up but im making some progress... i now have an instance of the player. working on getting an instance of SidTune. if i cant work it all out i think i can just write a C interface and wrap it similar to how i did Irrlicht.


gman(Posted 2006) [#13]
quick update: i have instances of both sidplay2 and SidTune. i also have most of the important methods wrapped for each. i can successfully load a SID and set the different songs in it, but i cant get it to play yet. i think i need to do some things with something called the ReSIDBuilder. still not sure i can get this running. stopping for the night and will look again tomorrow evening.


Matthew Smith(Posted 2006) [#14]
excellent stuff gman!

The forums here: http://sourceforge.net/forum/?group_id=9266 may help you work it out.

I would imagine the hardest part would be hooking it into the blitz sound system - perhaps a seperate hook into DirectX might be required.


Edit: Check your email gman.


Bremer(Posted 2006) [#15]
Thank you for looking into this gman, I really appreciate it. If you have a paypal account I will donate some money to it, if you get it to work.


Grisu(Posted 2006) [#16]
GMan, your're great!


gman(Posted 2006) [#17]
thought id give a little update. i have most of the pieces working. unfortunately i need one more class to make it all work called ReSIDBuilder. unfortunately i have not been able to compile it after several attempts. im pretty confident that if i could just get that compiled i could get it in another night. bah! grrrrr :/


Bremer(Posted 2006) [#18]
Thank you a lot for trying, I really appreciate it greatly.


gman(Posted 2006) [#19]
i have posted my compile problem to the libsidplay forum. if i dont get a response in a few days i will try to contact the author directly. i was looking at the code for the module i cant compile and noticed that there were several recent changes (ie end of june). this is good meaning it is still in active development, but i think that not all files have been submitted. this explains the missing class templates that is currently preventing me from compiling. the author seems very helpful in other posts so im pretty confident he will be able/willing to assist. i will keep you updated.


gman(Posted 2006) [#20]
ok kids... i can tell you that i have successfully played back a SID file in BlitzMax. i need some time to take what i have and mold it into a real mod, but it looks like at least in windows, this mod is going to get done. not sure about Mac/Linux yet.


wedoe(Posted 2006) [#21]
Yeeeppeeeeeeeee !
Love SID, and love gman too right now :oD

:)
:)
:)


Bremer(Posted 2006) [#22]
Sounds great, thanks for your work on this. I am looking forward to trying it out. You work is appreciated.


Matthew Smith(Posted 2006) [#23]
gman - well done! you rock fella!


gman(Posted 2006) [#24]
here we go:

http://www.gprogs.com/viewforum.php?id=15

there is no source yet. im trying to figure out how i need to do that. one very, very, very important thing to note is that this mod is forced to be GPL since libsidplay2 is GPL. this means that any project including it has to be GPL also and thus opensource.

there is an install.txt file with the distro. probably not as detailed as it needs to be. will work on that later. there will also soon be a section on my forum for this as well.

download a SID and have fun!

EDIT: i have updated with a new version that uses BlitzMax streams for file loading. this allows loading a SID from anywhere BlitzMax can open a stream including incbin and URLs.


Matthew Smith(Posted 2006) [#25]
gman,

Awesome stuff - it works great!!!

One question - can we incbin the sids?


gman(Posted 2006) [#26]
thx matt :) its not in this version but i do have loading from an incbin working now.


Alienforce(Posted 2006) [#27]
Wow! Gman, You are the man!


Bremer(Posted 2006) [#28]
wow, I am really looking forward to get home and try this out. Thanks once again for your work. Do you have a paypal account where I could make a donation for the work done?


gman(Posted 2006) [#29]
thx for the kinds words all :) hopefully it works out for everyone. im still trying to figure out how i need to package the source since this is my first GPL mod... not sure right now if i need to include all the source for the libs too (since i had to make a couple of minor changes) or what. anyways, it doesnt affect the ability to use it so its not a terribly high priority.

an FYI... i uploaded a new version this morning. this version uses BlitzMax for SID file loading so the mod now has the benefit of the very flexible BlitzMax stream system.

http://www.gprogs.com/forum/viewforum.php?id=15

as for donations, i really dont advertise it but due to high demand i did finally add a donate link to the menu on my forums.


Bremer(Posted 2006) [#30]
Yeah it works :)

One question so far, how come the libsidplay.dll that is in the package is 1.2mb, then the libsidplay2.dll is only 136kb ? I have no knowledge about dll files, but was there a reason why libsidplay2.dll couldn't be used instead of libsidplay.dll?


gman(Posted 2006) [#31]
glad to hear :)

as for the size, i would assume its due to how Dev-CPP is compiling the DLL. it may be linking in some uneeded libraries so i will see if i can check the project and trim anything. libsidplay2.dll definately will not work as the current codebase from CVS which the new Dev-CPP DLL is built from is different that the of the current VC build of the DLL. i may see if i can compile the DLL under VC and get the proper exports needed. one last thing that will probably work is a simple EXE packer on the DLL. that would probably chop it down to roughly the same size if it doesnt break it.


wedoe(Posted 2006) [#32]
Woah ! It works yes :o)

Now we need a way to autodetect the lenght of the tune
and some way to do a fast forward...

Is it in any way possible to do loops the same way
sid's are played originally ?

Your work so far is highly apreciated :D


gman(Posted 2006) [#33]
@wedoe - currently there is no way for libsidplay to detect the length of a song inside the SID. there is a utility addon that creates a sort of SID database with lengths, but you still have to create the database by typing in the tune and its length. there is an interface there for song length, so hopefully the author will at some point put that in. as for looping, i assume you just mean looping the sample endlessly? LoadSIDSample returns a standard BlitzMax TAudioSample. you pass that into LoadSound which has a looping parameter. pass true to that and it will loop endlessly. dont have the sample i put into the doc with me, but i believe it has the looping parameter passed in. same goes for pause and fastforward. if the BMAX audio features contain those, you should be able to use them on the sound returned by loadsound or the channel returned by playsound.

@zawran - donation was much appreciated :) i tried compressing the DLL and it kills it unfortunately. im working on putting something into the VC build of the DLL that will give the proper exports for MingW. im hopefull that i will have a much smaller library for you soon.

@everyone - in addition to smaller DLL size, im also working a bit on streaming the song instead of loading the sample first and then playing it. this should heavily decrease load times if i can get it to work.


smilertoo(Posted 2006) [#34]
HVSC comes with a database of SID lengths.

Ah, i was going to ask what was with the long pause at the start, so it has to create a load of samples in memory at the start?


gman(Posted 2006) [#35]
@smilertoo - yes the sidplayer has to process the SID information before BMAX can use it. as it processes, it writes the bytes to a BMAX audio sample. i did not see a way i could get streaming to work until i saw a possibility right before i went to bed last night. if i can get the streaming to work, as bytes are requested from the stream the sidplayer will process on the fly and send back the bytes.

didnt know about HVSC:

http://www.hvsc.c64.org


wedoe(Posted 2006) [#36]
Thanks for explaining answer :o)

I was just thinking of making my own SID-player with
my favourite tunes. Then it would be possible to add a
lot of cool stuff if I could play it the same way that
the C64 did in it's time (one loop pr/60th of a second)

It would require the chip itself emulated, not the sounds.

I have no idea how the original Sidplayer does emulate
the SID-sound so I might be gullible about the possibilities
here.... ;)


gman(Posted 2006) [#37]
i give on the reduced DLL size. UPX didnt work for compression and when using the exports from the VC-built DLL i can call the C functions, but i get weird crashes and return values.

i also give on the streaming. i was misreading and the stock BMAX audio does not stream. from what ive read the FMOD module does. for now though, im calling this mod good. im going to clean up the release and put all the source out.

enjoy :)


REDi(Posted 2006) [#38]
You could do the streaming with maxmod :)

As custom streams aren't documented yet heres a lil example of how to do it... (done in linux, so excuse the tabbing)


(BTW, if you want access to the source code, it can be arranged ;) )


gman(Posted 2006) [#39]
greetings REDi :) i have downloaded the MaxMod um mod, and will take a look tonight. if i cant get it working based on your sample code i will hit you up for more info.

on a side note, code for the SIDPlay mod should be released sometime tonight. will probably be pretty late.


wedoe(Posted 2006) [#40]
Anything new gman ?


gman(Posted 2006) [#41]
i havent been able to get MaxMod to work for me at all unfortunately. i cant get sound from the sample the distribution comes with. i have yet to contact REDi about what might be wrong.

EDIT: i found the fix on his forums. i removed the OpenAL DLL distributed with the demo and downloaded/installed an OpenAL distribution from REDi's website. i can now try to get SID going.


gman(Posted 2006) [#42]
huh. that was quick :) i now have a streaming SID through MaxMod! nice interface REDi :) ill see if i can get around to packaging this up.


REDi(Posted 2006) [#43]
Excellent work gman, cant wait to listen to some sids :)

I'll remove the dll from the download next update.

would you be interested in adding it to maxmod as a player module? fully credited of course :)


smilertoo(Posted 2006) [#44]
I'm guessing the streaming version will also use a lot less ram?


gman(Posted 2006) [#45]
ok. the full download is now at:

http://www.gprogs.com/forum/viewforum.php?id=15

there are a few noted differences:

first, i liked the design of the maxmod distro so i redisgned the layout of the SID mods. there are now 3 mods all under the parent SID mod. i broke out the FreeAudio sample loader, the MaxMod stream loader, and the libsidplay2 wrapper into their own mods.

NOTE: please remove the gg.mod/sidplay.mod folder!

second, the streaming version has a few features the sample version doesnt. the streaming version can switch the track its playing. you can get a total track count and see what track is currently being played. check the docs for more info.

enjoy folks :) this has been a lot of fun. boy do i love playing the ultima 3 SID :)

@REDi - first, thx for MaxMod! very cool. second, i thought of that distro method (i even had an email in progress to you about it), but then i would be splitting where the SID mods come from. at this point, id like to keep it all together.

@smilertoo - in theory yes. i havent tested it. if you use the stream it doesnt require processing the full track into memory first. this should save a lot of memory and also it allows you to start playing a track almost immediately... low load times since only the SID file itself has be be loaded into memory.


REDi(Posted 2006) [#46]
Sounds great gman, plays thing_on_a_spring.sid perfect!

*EDIT*
To make things a bit simpler, you could move the *.a files from the LIBS folder and put them in sidplay.mod, and change the import to...
Import "libsidplay.a"
Import "libresid_builder.a"

I dont really like putting things in BlitzMax/lib folder.

I've tried about 6 sids so far and all have played very well!


Matthew Smith(Posted 2006) [#47]
Everything compiles fine here - but no sound for the streaming version. Tested on two PCs


gman(Posted 2006) [#48]
@Matt - did you use the OpenAL DLL from the original maxmod download or did you use the installer?

http://redi.me.uk/downloads/openalweax.rar

the DLL that comes with MaxMod has issues. remove it, and install the above. hopefully that will resolve your issue (it did me).


Matthew Smith(Posted 2006) [#49]
gman,

Thanks - that did the trick! You've done a great job!


smilertoo(Posted 2006) [#50]
Works great.


gman(Posted 2006) [#51]
glad its working out for everyone :) thx to all for the support to make it happen!

EDIT: i now have a forum for the SID mods with the downloads available:

http://www.gprogs.com/forum/viewforum.php?id=15


wedoe(Posted 2006) [#52]
Big smile :D


gman(Posted 2006) [#53]
FYI, i learned a new trick with DevCPP today that allowed me to half the DLL size so i repackaged the distro with a new DLL:

http://www.gprogs.com/forum/viewforum.php?id=15

enjoy :)

NOTE: i am getting into RSS feeds to keep people updated. you will need to have an RSS reader in order to get the updates. Opera has one built-in. FireFox has an extension available. there is a link in the SID forum description you can use to subscribe. once subscribed, you will receive notifications via the RSS reader when i update stuff. this means you dont have to keep checking the website :)


Matthew Smith(Posted 2006) [#54]
Thanks GMan!


DannyD(Posted 2006) [#55]
This is Windows only right ?


smilertoo(Posted 2006) [#56]
meep


gman(Posted 2006) [#57]
@DannyD - correct. windows only right now. at some point in the future i may give the other OS a whirl.


xlsior(Posted 2006) [#58]
FYI, i learned a new trick with DevCPP today that allowed me to half the DLL size so i repackaged the distro with a new DLL:


Another trick: Since a DLL really isn't much more than a fancy .EXE, you can reduce their size even further by using UPX to compress them as well.

For example:

libsidplay.dll: 523,776 -> 165,376 (31.57% of original size)
resid_builder.dll: 605,988 -> 173,348 (28.61% of original size)
libsidplay.dll (2nd version in your package) 1,209,550 -> 568,526 (47% of original size)

As you can see, a significant difference.


gman(Posted 2006) [#59]
@xlsior - i tried UPX but could not get it to compress without the DLL crashing with a c0000005 at runtime. what options are you using on UPX?

EDIT: i just tried it again on the latest release with the same result. this is the june 6th UPX release. tried with and without --compress-exports=0.


Matthew Smith(Posted 2006) [#60]
Everyone,

gman has updated the sidplay mod for REDi's 1.12 version of MaxMod for streaming - get it at his site. The benefit of this version is you don't need the openal installer anymore.

http://www.gprogs.com/forum/index.php

Thanks gman!


deps(Posted 2006) [#61]
Works great!


Xerra(Posted 2006) [#62]
This is a fantastic mod. I've been after something like this for years as I love the old C64 music and I've wanted to write my own sid player interface that does what I want for ages but I'm not at the level to do stuff like this as yet.

Thanks, gman


jp22(Posted 2007) [#63]
Hi everyone
This is SID related, but on a slight tangent..

Just wondering - Is the libresid_builder.a the file i'd need to "play" the emulator myself? So, instead of calling SidPlay to play/stop, I could call resid, to set waveforms/channel volumes?

I'm interested in putting a better front end on GoatTracker (SID music writing package), with Blitz, but just want to know what i'd be letting myself in for!

Thanks!


Matthew Smith(Posted 2007) [#64]
Everyone,

Redi has released a new MaxMod module (1.16) for Mark's new audio stuff. He also kindly updated the sidstream module for us as I was a little unsure how. To simplify it's use, I have created a wrapper to make it easier to use.

Go here for further info:
http://www.blitzbasic.com/Community/posts.php?topic=67464


Grisu(Posted 2007) [#65]
Ahm Gman, could u start a new topic and post the newest version in the first post. It's difficult to keep track here.