As a kindof mini learn win32 assembly i want to be able to know how to play midis, and less importantly mp3s and wav.
Anyone know how to do it?
Thanks :U
Hello RedXVii
For the wav file you can use this code.
.data
sound db "benny.wav",0 ;the filename has to be in same dir or else put full path to it
.code
START:
Invoke PlaySound, ADDR sound, NULL, SND_FILENAME or SND_ASYNC
invoke ExitProcess, eax
end START
I'm not sure about the others but i read about mci strings on msdn.
Good luck
Or, if you want to do it the long way and decode the midi file yourself.. well, let's just say it's not pretty and really not a 'mini' project :bdg
Mp3 isn't too pretty either, but as long as you have a decoder library function then it's not so bad.
And wav is fairly simple :toothy
Thanks fellas,
Even if i figured out how to deocde the midi file (which i think i can do) i have no idea how to make it play the noise i want :(
isnt there a function to play midis?
Thanks :U
If you just want be able to play stuff, you can do it through the mci (which is what windows media player uses) - so you'll be able to play wav, midi, mp3, and many others without even needing to worry.
This should get you started..
invoke MCIWndCreate, hWnd,hInstance,WS_CHILD or MCIWNDF_NOTIFYMODE or MCIWNDF_NOMENU or MCIWNDF_NOPLAYBAR,pFName
mov hWndMCI,eax
invoke SendMessage, hWndMCI,MCI_PLAY,0,0
(rtfm for more info, explanations..)
Oh, you'll need to include msvfw32 inc and lib :toothy
[attachment deleted by admin]
RedXVII,
have a look in here (http://www.fmod.org/).
There is no need to reinvent the wheel :wink
Regards
RedXVII, you could also use BASS library from http://www.un4seen.com/
are there no functions in windows xp somewhere?
Quote from: RedXVII on November 04, 2005, 05:10:49 PM
are there no functions in windows xp somewhere?
..refer to my previous post ::)
Woops, i seem to have missed youre post forsome reason...
Ah ha! just what i wanted! I presume this function is a part of windows somewhere?
Thanks alot Tedd, and everyone else who contributed! :U
hi
if i recall corectly i beleive there is an example of mp3 playing and even coverting though its in a dll (no code)
in the ide NAGOA i first worked with this but it is BAD
if you dont use qedit
USE RadASM it works verywell and use masm hehe
yours retsim x