News:

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

Audio compression manager

Started by nofrillz, September 21, 2005, 07:41:07 AM

Previous topic - Next topic

nofrillz

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

hutch--

Hi NoFriLLz,

Welcome on board, I moved your post to the Workshop so you would get more answers.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Tedd

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

nofrillz

Cheers, i got that struct already, no hassle if there arent any incs just yet, ill post mine when i finish my project.

Farabi

nofrillz:
You read it byte per byte?  :dazzled:
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

u

#5
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 :)
Please use a smaller graphic in your signature.

u

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 ?
Please use a smaller graphic in your signature.

u

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 :/
Please use a smaller graphic in your signature.

u

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 :)
Please use a smaller graphic in your signature.

PBrennick

#9
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
The GeneSys Project is available from:
The Repository or My crappy website

nofrillz

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