Tuesday, February 21, 2012

How to play *.XM / *.MOD files in VB.NET (Using reflection)

Note: This article was originally posted by me at http://www.gamehacking.com 2 years ago,and you can see the original post here for the details.

If you are not  already aware that i am too a proud member of  gamehacking.com (a mod. actually) and lots of guys asking there this same question that "How to play *.XM / *.MOD files in VB.NET " .

You might ask what's the problem just use any free audio library to do this,you are correct.But the actual problem was that guys want everything inside a single executable file without using a packer even the *.DLL files itself and to do this we have to use a feature called reflection.

So when i found a solution i code a module so anybody can use *xm/*mod easily without need to understand whole reflection thing.

So here's my module..........

(*.vb module with a demo *.exe)
http://praveenverma.co.nr/support/sound_module.rar

or
(*.vb module only)
http://www.mediafire.com/?m7mak54ai144b48

features:-
-the dll and music will be in resource so you don't need pack it again.
-size is less (atleast compare to a wav file)
-And it's in the module so you don't need to understand the code but that would be recommended.

how to use:-

1. Add my module to your project(right click on solution explorer and click add existing item).
2. Add 3 files bass.dll , bass.net.dll , and the music you wanna play,in the project resource.

download bass.dll
Download bass24.zip

download Bass.Net.dll
http://www.un4seen.c.../Bass24.Net.zip

3. GO and register for free to bass.net.dll otherwise it will show a trial version message.

register here    BASS.NET : Registration


functions:-

you need to call this function before any other functions of my module.

note:- if you not registered then put anything in both string place,it will run with a trial version message.

dim status = music(my.resource.filename_of_xm_mod,"registered email-id","registration_code")

now there are 4 functions call any where you need

musicplay()
musicstop()
musicpause()
musicresume()

private sub button1_click()

    if status=0 then
        exit sub
    end if
    musicplay()
End sub


2 comments:

  1. Hi
    my project is fine and i did what ever you did say but when i start and press the button nothing is happening and i hear nothing so what should i do

    ReplyDelete
  2. plz visit gamehacking.com to find a sample code with executable file.

    ReplyDelete

Like this post? let me know just leave a comment..