Hey guys, I've been trying to build a program which plays mp3s, I've managed to get the information from the headers, however none of the structs or constants that the structs and API calls use are anywhere to be found. I was wondering if anyone had some includes that could come in handy.
Cheers
NoFriLLz
Hi NoFriLLz,
Welcome on board, I moved your post to the Workshop so you would get more answers.
I have the following lying around in..
It was converted from the definition of the structure in a C++ header file. Most likely, you will be able to search for the structures you need on msdn.microsft.com/library (http://msdn.microsft.com/library) and then will have to translate them into masm syntax.
ACMDRIVERDETAILS_SHORTNAME_CHARS equ 32
ACMDRIVERDETAILS_LONGNAME_CHARS equ 128
ACMDRIVERDETAILS_COPYRIGHT_CHARS equ 80
ACMDRIVERDETAILS_LICENSING_CHARS equ 128
ACMDRIVERDETAILS_FEATURES_CHARS equ 512
ACMDRIVERDETAILS struct
cbStruct DWORD ?
fccType FOURCC ?
fccComp FOURCC ?
wMid WORD ?
wPid WORD ?
vdwACM DWORD ?
vdwDriver DWORD ?
fdwSupport DWORD ?
cFormatTags DWORD ?
cFilterTags DWORD ?
hicon HICON ?
szShortName CHAR ACMDRIVERDETAILS_SHORTNAME_CHARS dup (?)
szLongName CHAR ACMDRIVERDETAILS_LONGNAME_CHARS dup (?)
szCopyright CHAR ACMDRIVERDETAILS_COPYRIGHT_CHARS dup (?)
szLicensing CHAR ACMDRIVERDETAILS_LICENSING_CHARS dup (?)
szFeatures CHAR ACMDRIVERDETAILS_FEATURES_CHARS dup (?)
ACMDRIVERDETAILS ends
Cheers, i got that struct already, no hassle if there arent any incs just yet, ill post mine when i finish my project.
nofrillz:
You read it byte per byte? :dazzled:
Here's my proc to decode mp3s of any bitrate, CBR or VBR, using ACM. You have to make a bit of cleanup, since I use my own macrobase+libs to boot ^^'
To save memory/hdd space when opening mono songs, you have to manually find the header and its mono/stereo flag.
Farabi: btw, mp3 files are read... bit by bit :)
WOW after posting the previous reply, I got curious how to decompress .ogg files, too. Found that the format_type is 674Fh ("Og"). Before starting to make an implementation of an ogg decoder (via ACM), I decided to toy with a wave editor I use - GoldWave4.11 (very old version, made in 1998). Drag-dropped .wma over it - it was decoded (though a bit crappy). Ok. Wanted to have some fun - dragged-dropped .mod - and this time it was my jaw that dropped - there was the mod, fully-rendered! Same with .xm and .it! Also .avi and .ogg ... I'm almost sure this is done via DirectShow. But hey - it's awesome! So, my question is - could you give me a few links to srccode on directshow decompressing to PCM into file/memory ?
I confirmed that DirectShow is used. The IBuildGraph automatically creates a filter for the specified file, with IMediaControl you playback that file easily (DX9's DirectShow\Players\BGplayer). To directly recompress the input to a PCM raw file, you use IFileSinkFilter... On CodeProject there's an example of recompression, but the code is mostly unreadable, crashes often and misbehaves ::) . So, a good tutorial or some simple code in any language is welcome (and wanted ^^)
Now my timeslice for x86asm is over, have to code for ARM :/
Blah, DirectShow loading of anything but wav, mp3, ogg and wma is too faulty to use. Sure, we can use SEH, but I wouldn't rely on something that loads 50+ dlls/ax (all codecs), and starts asking each of them to decompress the specified file. Compressed wavs and mp3s are pretty much enough :)
William F. Cravener posted a program in 2003 that played an mp3 file, yamahog.mp3 to be specific but it will play any mp3 file. It does not use any unusual include files beyond using the mci libraries.
EDIT: Thomas Anthony has a Player on his site that plays MP3 files and a whole lot more. He is using msvfw32.inc.inc and msvfw32.inc.lib
hth,
Paul
I know this is a bit late but I thought it would be good to finish it off, I got the mp3 player to work, only needed 4 structs, the hardest part was synching the acm to reduce the strain on the cpu. The binary/source is at http://nofrillz.netcore2k.net/playmp3.zip
Thanks to all who helped
NoFriLLz