News:

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

Making a simple WAV player

Started by NoCforMe, January 09, 2012, 12:45:57 AM

Previous topic - Next topic

bomz

Bill Cravener
Quote.386

.model flat, stdcall
option casemap :none

        include \masm32\include\windows.inc
        include \masm32\include\user32.inc
        include \masm32\include\kernel32.inc
        includelib \masm32\lib\user32.lib
        includelib \masm32\lib\kernel32.lib

.data
   FileName   db "Sample.avi",0
   szMCIdll        db "msvfw32.dll", 0
   szMCIWndCreate  db "MCIWndCreate", 0

.code
start:
                invoke LoadLibrary, addr szMCIdll
                push eax
                invoke GetProcAddress, eax, addr szMCIWndCreate
                push offset FileName
                push 0
                push 0
                push 0
                call eax
                call FreeLibrary
      invoke MessageBox,0,0,0,0
      invoke ExitProcess,0
end start


donkey

 :wink clearer in GoAsm

#DEFINE WINVER NTDDI_WINXP // Target system is XP
#DEFINE FILTERAPI // Generate errors for unavailable/deprecated API
#define LINKFILES // Link the DLL libraries
#INCLUDE Windows.h // Core headers

DATA SECTION
FileName   db "Sample.avi",0

CODE SECTION

Start:
invoke MCIWndCreate,0,0,0,offset FileName
invoke MessageBox,0,0,0,0
invoke ExitProcess,0
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

dedndave

yah - we need to create a vfw32.inc and vfw32.lib that get functions from avicap32.dll, avifil32.dll, and msvfw32.dll
not from vfw32.dll, which does not exist
vfw32 is, however, the correct name for the include and import library
at least, that is how MS C handles it
i suppose we could put the functions in 3 seperate INC/LIB pairs

vfw32.inc/lib in masm32 version 10 do not have the MCIWndCreate(A/W) functions
vfw32.inc/lib in masm32 version 11 do have the MCIWndCreate(A/W) functions, but try to import from the nonexistant DLL
i suppose this should be a bug report in the MASM32 project subforum   :P

MichaelW

#18
I'm sure I posted an import library and an incomplete include file (for everything but the procedure prototypes, which are in separate include file that AFAIK is complete) somewhere here, but I can't seem to find it now, so here they are again.
eschew obfuscation

bomz

How make player? I try hook mciSendCommand

dedndave

ok - my next question is...
how do we emulate all these macros ?   :P

http://msdn.microsoft.com/en-us/library/windows/desktop/dd743598%28v=VS.85%29.aspx

i guess someone with a C compiler can do it 

dedndave

maybe this guy has already done so
it looks like many of the macros are covered in ASM source...

http://4coder.org/assembler-source-code/73/

you can download the entire package, or modify the URL as follows for an example...

http://4coder.org/assembler-source-code/73/libmci/MCIWndCanConfig.asm.html

ok - well, it's not perfect
that particular function is supposed to be a macro, not a proc
but, the code is there to figure out how to write the macro

Bill Cravener

When I change my simple multimedia example so that it can list all file types it plays anything I throw at it. The example link below includes the player and a small AVI, WMV, WAV, MP3 and MPG-1 sample media file. At least on my Windows 7 64 bit machine and my old XP Home Edition SP3 machine it plays them all perfectly. Using my example my Win 7 machine will also play MPG-2's but my XP machine will not.

http://www.quickersoft.com/examples/Multimedia.zip
My MASM32 Examples.

"Prejudice does not arise from low intelligence it arises from conservative ideals to which people of low intelligence are drawn." ~ Isaidthat

dedndave

i am running XP MCE2005 SP3
it plays the movie clip fine, Bill   :U
all you need is an MPEG-2 codec

here is one i know works...
http://www.free-codecs.com/download/stinky_mpeg_2_codec.htm

i use the k-lite mega codec package, which has all kinds of stuff   :P

Bill Cravener

Hi Dave, yes I figured that was the case. I need to spend some time on my XP box and get everything up to date. It really gets ignored now that I have this new Win 7 box. :bg
My MASM32 Examples.

"Prejudice does not arise from low intelligence it arises from conservative ideals to which people of low intelligence are drawn." ~ Isaidthat

dedndave

well - MCE won't work without an MPEG-2 codec
oddly enough, MS does not provide one - lol
for that reason, MCE was only available in OEM machines, and had to be bundled with some kind of player that provided one
this Sony machine came with WinDVD, which includes the codec
the MPEG-2 codec is also required to play DVD's

bomz

Bill Cravener
Install K-Lite Codec Pack and you Simple MP3 Player may show all video files

http://www.erightsoft.com/SUPER.html - Starnge When I install this converter all video files may show too, including MKV conteiners

jj2007

Here is one that takes a file from the commandline and plays it immediately.

I had lots of trouble playing avi files (decompressor not available) until I found a site that said "rename them to mpg", and wow, it worked :dazzled:

dedndave

little secret - that also works for VOB files   :P
although - i didn't have any luck with that player - lol

bomz