News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Midis, mp3 and wav

Started by RedXVII, November 02, 2005, 12:58:37 AM

Previous topic - Next topic

RedXVII

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

gavin

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

Tedd

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
No snowflake in an avalanche feels responsible.

RedXVII

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

Tedd

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]
No snowflake in an avalanche feels responsible.

mnemonic

RedXVII,

have a look in here.
There is no need to reinvent the wheel  :wink

Regards
Be kind. Everyone you meet is fighting a hard battle.--Plato
-------
How To Ask Questions The Smart Way

SamiP

RedXVII, you could also use BASS library from http://www.un4seen.com/

RedXVII

are there no functions in windows xp somewhere?

Tedd

Quote from: RedXVII on November 04, 2005, 05:10:49 PM
are there no functions in windows xp somewhere?

..refer to my previous post ::)
No snowflake in an avalanche feels responsible.

RedXVII

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

Retsim_X

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