• Welcome to Dark Bit Factory & Gravity.
 

[C] 64-bit XM player

Started by rol1939, May 13, 2013

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

rol1939

Just for fun, I created a sinescroller using nVidia CUDA. It all works fine.
But now, I want to add my favorite XM module as a music, but  I'm using Win 7, 64 bits. Unfortunately, there seems to be no XM player compatible with 64-bits.
Ufmod, mini-fmod all contain assembler, which does not link with 64-bits.

Does anyone of you know a XM player which can be linked with 64-bits C code?
The XMPLib does not compile with Visual Studio, so that is not working for me.

Greets, Rene Olsthoorn.

Raizor

A lot of the XM libraries I've come across contain inline x86 ASM, which does make it a problem for 64bit use.

chibi itplay would probably work, but it looks like you'll need to wire it up to DirectSound yourself. this forum post seems to have some relevant info. Sounds like there's nothing 'perfect' out of the box, but you should be able to get something up and running for x64 without too much hassle.
raizor

Challenge Trophies Won:

rol1939

Thanks for the hint, Raizor.
This morning I discovered that XMPLib contains a win32 directory, so I gave it a try with MINGW on my Windows 7 64 bit.
The DLL is compiled correctly after the "confgure, make" dance. However, the DLL was still 32-bit!  :vangry: After checking the MINGW website, I discovered that MINGW is only 32-bit at this time.
There is another project called MinGW-w64 that claims to be able to compile x64. Perhaps I try to install that.
When that fails, I will try to look at chibi-itplay.

hellfire

Hi Rene,
why do you want to create a 64bit binary?
If you're working with Cuda anyway, you won't benefit much from 64bit code generation.
You probably won't need more than 2gb of memory, either.
And a 64bit binary rules out everyone who's still running a 32bit os...
Challenge Trophies Won:

rol1939

#4
There is music, maestro!  :||
BASS ships 64-bit DLL's and LIB's compatible with VS2010.  Download at: www.un4seen.com/stuff/bass24-x64.zip

To start the music simply do:

HMUSIC TheMod;
BASS_Init(-1,44100,0,0,NULL);
char xmfile[] = "CRACKINT.MOD";
TheMod = BASS_MusicLoad(FALSE,xmfile,0,0,BASS_MUSIC_RAMPS,1);
BASS_ChannelPlay(TheMod,FALSE);

and at exit:
BASS_MusicFree(TheMod);
BASS_Free();

Include the bass.h in your C code and link the bass.lib.

To Hellfire: I do my demo in 64-bit because my host operating system is 64-bit. I really do not want to reinstall Visual Studio, Cuda toolkit, etc... You are right that I don't need more than 2 Gb for my little demo!

rol1939

Looking at the BASS library, I discovered that the position of the MOD can be retrieved. No other module information.
So, I will be making a XM module loader to map the BASS position to the XM structures. That way, I can determine which instrument is played in realtime.
I saw some information about XM in the MikMod sources, so I guess it can be done.

Greets, Rene.

rol1939

So, here is the sourcecode of the XM information displayer.
It is a console application that plays a XM module with BASS and retrieves the current position from BASS. With that position the current notes are displayed.

First, the module is loaded in memory, and that's the part that I arranged. (thanks to libXMP, mikmod).

Enjoy, Rene.

P.S. the Bass lib is 64-bit. In case you get compilation errors.