GLBasic forum

Main forum => GLBasic - en => Topic started by: Darmakwolf on 2013-Apr-15

Title: External library - multiple audio formats?
Post by: Darmakwolf on 2013-Apr-15
In a windows-only game I want to support Commodore .sid audio - has someone already made a wrapper for a library to do so in GLB?  :blink:
Title: Re: External library - multiple audio formats?
Post by: matchy on 2013-Apr-15
I'm not sure but one of these might be able to, at least with an add-on. Do you really, really, really need it to be in .sid format? Also just wondering if it is from an original commercial title?


bass.dll
http://www.glbasic.com/forum/index.php?topic=1708.msg12010

fmod
http://www.glbasic.com/forum/index.php?topic=7564.msg62935
Title: Re: External library - multiple audio formats?
Post by: kanonet on 2013-Apr-15
I wonder the same like matchy, do you really need that format? Wouldnt a converter be the better solution to use that sounds?
Title: Re: External library - multiple audio formats?
Post by: mentalthink on 2013-Apr-15
More easy convert from a tracker to .wav...
Title: Re: External library - multiple audio formats?
Post by: S.O.P.M. on 2013-Apr-15
With Winamp you can easily output that sid as an mp3 or wav file. Just use the Winamp sid plugin and then set the output plugin to Winamp Disk Writer, it writes the file in a desired format. I would do so.
Title: Re: External library - multiple audio formats?
Post by: spicypixel on 2013-Apr-15
I'm guessing that the idea of playing the sid file is to keep the audio small. I had a dll for playing AY/YM in BlitzBasic years ago but nothing from back then on playing SID to even use as a starting point :( As for playing SID in Winamp and converting to WAV, Winamp hasn't got the best replay engine for tracker or old computer formats.
Title: Re: External library - multiple audio formats?
Post by: Darmakwolf on 2013-Apr-15
Well I can now convert sid to mp3 very easily, but the whole idea is filesize. Some songs are 2KB and sound great. Even at the lowest quality MP3 it's >1MB... I'll look into FMOD. And it's not for a commercial title or anything.
Title: Re: External library - multiple audio formats?
Post by: erico on 2013-Apr-15
On the ´converter / player´ part, you can try FOOBAR too, It is what I use as a music player. I think I saw some plugins for SID a while ago.
Title: Re: External library - multiple audio formats?
Post by: Darmakwolf on 2013-Apr-17
Ok so I think I found my solution. I forgot that a while back I messed around with RPG Maker's RGSS (ruby) language and helped get a winamp.dll to play .SPC files. Here's the link:

http://forums.rpgmakerweb.com/index.php?/topic/2235-extended-music-script-35/

I just can't seem to wrap the winamp.dll file properly... I tried to get it to initialize like this:

Code (glbasic) Select
IMPORT "C" long Init_Winamp(char* inDLL, char* outDLL, void* hwnd)

and then called

Code (glbasic) Select
Init_Winamp("in_snes.dll","out_wave.dll",0)

but it spits out

Code (glbasic) Select
...gpc_temp0.o:gpc_temp0.cpp:(.text+0x1a14d): undefined reference to `_Init_Winamp'
*** FATAL ERROR - Please post this output in the forum


If I can get help properly wrapping Winamp.dll, we can play lots and lots of game music formats...
attached is Winamp.dll, the in_snes plugin, the out_wave plugin, and an example .spc file to play. It works in RPG Maker purely by initializing winamp and throwing a song at it... there must be a way to do this.

===========================================================================

EDIT: I realized I needed:

REQUIRE "Winamp.dll" and then it gets past that error, but now I think my problem is defining the proper variable types for Winamp.DLL. It gets some scary looking errors with my current setup...
Title: Re: External library - multiple audio formats?
Post by: Schranz0r on 2013-Apr-17
Hi,

make a new file in your project and past this:
Code (glbasic) Select

INLINE

#define WINAMP "Winamp.dll"


DECLARE_C_ALIAS(_Init_Winamp, WINAMP, "Init_Winamp",(const char*, const char*, void*), long);

ENDINLINE



FUNCTION Init_Winamp:
INLINE

return _Init_Winamp("in_snes.dll","out_wave.dll", GLBASIC_HWND());

ENDINLINE
ENDFUNCTION


it returnes -3 , it's say that the in_dll is wrong...
but trust me, the init isn't work this way!
Title: Re: External library - multiple audio formats?
Post by: Darmakwolf on 2013-Apr-18
Well - there's this.

http://www.glbasic.com/showroom.php?game=fmodPlayer

seems to play .sid without any special plugins. The .exe that comes WITH the project works fine, I can hear the music!!
The source code on the other hand isn't fine. It'll compile... but it returns 0 and no sound is played. Using GLBasic 11.322. Can someone please get this to compile/work? I'd be forever grateful...
Title: Re: External library - multiple audio formats?
Post by: Darmakwolf on 2013-Apr-18
I think it was compiled with GLBasic 3.x ... that's a long time ago. I suspect something changed with the way DLLCALL is handled... but the compiler does not complain... the actual program just does nothing when compiled. Like I said before though, the original .exe that is in the demo works great... I don't get it o_o  :rant:
Title: Re: External library - multiple audio formats?
Post by: Schranz0r on 2013-Apr-18
I give you start to fmodex later. I'm on the road atm.
Title: Re: External library - multiple audio formats?
Post by: Darmakwolf on 2013-Apr-18
Thanks Schranz0r! I did manage to get "sidplayfp" working great because it's a command-line too, all I needed to do was use SHELLCMD to call it with a music playing function. It runs in the background and loads .sid audio instantaneously - should I stick with that or is FMOD dll really a better solution?