The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: BBalazs on June 24, 2008, 09:20:23 PM

Title: MP3 playing is working on w98, but not on XP
Post by: BBalazs on June 24, 2008, 09:20:23 PM
Hi,
I have a huge problem that slowly makes me mad:

I wrote a code that was used in my car's computer for listening mp3 music on w98 for years. It is based on MCI callings.
Now, I turned to XP, and the program gives random errors (exception information) and sudden quits.
I located the site of error, and it is in the MCIWNDCREATE process, always on the !SECOND! pass.
I can start the mp3, it plays to the end normally (I can pause, resume, skip fw/bkwd as many times as I want), but when the program (or me) skips music to the next, error happens.
I think the problem can be around the close of the music, because if I do not close the previous, but overstart another music, it plays both. But the error appears on the mciwndcreate function...
The closing process returns with a 0 in EAX. Of course, the handler is valid.

It is NOT restricted to my program, all the mp3 examples written in assembly and using MCI routines do the same. (eg.: mp3playa)
My computer is on the top of refreshing of the XP. The inc and lib files are the newest. No viruses were found...
The effect is the same on my laptop (without SP2).

The same program is RUNNING well on the computer in my office....

What the difference can be ??? Please, help!

Title: Re: MP3 playing is working on w98, but not on XP
Post by: BBalazs on June 25, 2008, 11:33:09 AM
I kindly ask you to run the compiled code of mp3player example.

http://members.a1.net/ranmasaotome/projects.html

First music is OK, but the second one quits the program or gives an exception information on playing.

Is it the same thing on your computer?


Title: Re: MP3 playing is working on w98, but not on XP
Post by: jj2007 on June 25, 2008, 08:12:47 PM
I assume you mean mp3playa.exe - a direct link would have been useful.

When I open a file, it plays but mp3playa throws an exception. This is Win XP SP1.
Title: Re: MP3 playing is working on w98, but not on XP
Post by: BBalazs on July 02, 2008, 03:53:19 PM
Thank you very much. So, I think it can be a general problem, that occurs on certain configs (My motherboard is a TH7-II, there were no XP drivers at all, just Me or W2000, because the age).
Do you know any other (safe) method (or API call) that could replace this - obviously errorous - function?

Title: Re: MP3 playing is working on w98, but not on XP
Post by: PBrennick on July 03, 2008, 04:12:23 AM
Try the following executable. Tell me if it does the same thing. This version uses MCIWNDCREATE and I have another version that does it another way.
i am curious if this version will work for you, though.

-- Paul


[attachment deleted by admin]
Title: Re: MP3 playing is working on w98, but not on XP
Post by: japheth on July 03, 2008, 04:48:53 PM

I don't know why your program is crashing on XP, but I see something in your source which might be improved:


        m2m pFName, offset MusicFile
        invoke MCIWndCreate, hWnd, hInstance, WS_CHILD or MCIWNDF_NOOPEN, pFName
        mov mcihWnd,eax
        pop eax     ;For some reason 4 things are pushed onto stack unnecessarily
        pop eax     ;so they have to be popped off the stack to prevent crashing
        pop eax     ;Thanks to Ron Thomas for spotting that one!
        pop eax


the reason why the pops are necessary is because some MCI functions - including MCIWndCreate - are defined with specifier VFWAPIV, which is defined in th PSDK as

#define VFWAPIV WINAPIV
#define WINAPIV __cdecl

so you should adjust the proto definitions in your mci.inc file accordingly.


Title: Re: MP3 playing is working on w98, but not on XP
Post by: BBalazs on July 05, 2008, 10:13:22 AM
Thank you for your responses!

PBrennick: it works without any problem. Would you please provide the source code?

Japeth: it is NOT my code, I just found a project that uses the same method and fails on the same way on my computer.
by the way, the mci is the newest one...


Title: Re: MP3 playing is working on w98, but not on XP
Post by: PBrennick on July 05, 2008, 04:04:36 PM
BBalazs,

Here are my sources which, of course, are free for all to use. About your problem, I am using msvfw32.lib instead of vfw32.lib. This 'may' be the reason for my success. Using the vfw32.lib library was a genuine pain in the arse. If the code assembled at all, it never worked as expected. You will note that this library does NOT require the four pops like the other library does (or did - another problem).

Feel free to ask any questions. I would prefer them to be done through my email - pbrennick@juno.com (pbrennick@juno.com).

-- Paul

[attachment deleted by admin]
Title: Re: MP3 playing is working on w98, but not on XP
Post by: BBalazs on July 05, 2008, 10:48:17 PM
Thank you very much! It is working now!

What is the method to gain the information about the total lenght of music and the actual position? I'd like to jump within the music and detecting if the music is at the end - to start a new one. I think you tried to do something similar...

Pardon me, I have asking here, because my mailbox is in my office.
Title: Re: MP3 playing is working on w98, but not on XP
Post by: BBalazs on July 06, 2008, 07:57:01 AM
Alll my problems are solved, I simply used the old MCIWNDM_GETPOSITIONA and  MCIWNDM_PLAYFROM messages. GETEND also works.

Thank you all (especially PBrennick) for your precious help!

Title: Re: MP3 playing is working on w98, but not on XP
Post by: PBrennick on July 06, 2008, 11:32:55 AM
 :U

There is no serious problems with posting here. I just think that in-depth conversations may be better elsewhere. I love it here, don't get the worong idea, my friend.

-- Paul