Author Topic: [C] 64-bit XM player  (Read 7644 times)

0 Members and 1 Guest are viewing this topic.

Offline rol1939

  • ZX 81
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
[C] 64-bit XM player
« on: May 13, 2013 »
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.

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: [C] 64-bit XM player
« Reply #1 on: May 13, 2013 »
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:

Offline rol1939

  • ZX 81
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
Re: [C] 64-bit XM player
« Reply #2 on: May 14, 2013 »
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.
 

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: [C] 64-bit XM player
« Reply #3 on: May 14, 2013 »
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:

Offline rol1939

  • ZX 81
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
It works!
« Reply #4 on: May 14, 2013 »
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!
« Last Edit: May 18, 2013 by rol1939 »

Offline rol1939

  • ZX 81
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
Re: [C] 64-bit XM player
« Reply #5 on: May 18, 2013 »
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.

Offline rol1939

  • ZX 81
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
Re: [C] 64-bit XM player
« Reply #6 on: May 28, 2013 »
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.