DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Sun Oct 14, 2007 5:41 pm Post subject: [TuT]Adding Muzic To Your Delphi Application |
|
|
| W4R10CK @ Astatalk wrote: |
Ahh... let's get to the point as we all like
Requirments:
* Some Delphi Knowledge
* The tools
* A Fucking Brain !
* And Astatalk Forum as your homepage !
The step we're going to take are acutaly, disassembling .xm files to array of bytes.
since programming languages uses AOB, right ?!
This TuT is dedicated to Encrypto @ FOFF
First of all, all the tools you need are in the following link:
| Code: | | http://rapidshare.com/files/62599516/Delphi.rar |
Thanks to SHKODRAN @ KraX/UAC Team
Lets start noobs !
After extracting all the tools, open "eff.exe" !!
If you allready have an .xm muzic file in advanced, open it with eff !!.
Don't forget to make an output location !
After clicking "GO !!!", you may now open the Unit in delphi.
you will see const xm: array [1..XXXX] of byte = ($XX, etc, etc);
copy that whole code to your own project, and now.
go to your main form -> Object Inspector -> Events (sorry, i was lazy this time for taking pictures, but it should be visible !!)
OnCreate, we will make the sound start as soon the form creates itself (duhh..)
This little block of code should be needed.
| Code: |
{ Start playback. }
if uFMOD_PlaySong(@xm,Length(xm),XM_MEMORY) <> nil then
begin
{ Wait for user input. }
MessageBox(0,'uFMOD ruleZ!','Delphi',0);
{ Stop playback. }
uFMOD_StopSong
end;
{ Exit program. }
ExitProcess(0)
|
Don't forget to add the following procedures:
| Code: |
procedure MessageBox(hWnd:LongInt;lpText,lpCaption:PChar;uType:LongWord); stdcall; external 'user32.dll' name 'MessageBoxA';
procedure ExitProcess(uExitCode:LongWord); stdcall; external 'kernel32.dll';
|
it's pretty visible of what they do, 1st procedure calls MessageBox function from kernel32.dll, but it's pretty lame declaring it since it's allready declared in windows.pas (windows.h) unit file -_-"
2nd one is for exiting the process and all of its thread (pretty useful ending its own threads after)
ok ladies, time to continue on. . .
remember that block of code we've stated in OnCreate ?
there's something we need to modify, MessageBox();, we don't want an annoying message going out instead of our application, right ?
what i found out is we can simple replace it with:
<FormName>.ShowModal; //there might be other usefull ways but wha the heck.
| Code: |
{ Start playback. }
if uFMOD_PlaySong(@xm,Length(xm),XM_MEMORY) <> nil then
begin
{ Wait for user input. }
Form1.ShowModal; //Example !!
{ Stop playback. }
uFMOD_StopSong
end;
{ Exit program. }
ExitProcess(0)
|
Now, while your delphi is open with your project, go to "Project -> Add Project" and add uFMOD.pas
then, copy ufmod.obj to your project folder.
And... that's all..
you'll probably hit more bugs further, but you (Yes, YOU !) must fix them yourself, you're on your own soldier !
Enjoy !!!
P.S - I'm sure there's allways these smartasses who will go like:
| SmartAss wrote: | | Lol !! noob you can do this instead of this !! haha |
Do me a favore, STFU and GTFO you piece of shit, either you accept this or GTFO !
- Peace !,
W4R10CK @ Astatalk !
|
|
|