MP3 Support

Post tutorials on how to do certain tasks within game or engine code here.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

JasonX wrote:I'm using DirectX 9 SDK, June 2010.
Where in the instructions does it say this works with DirectX 9 SDK?

If you don't have Direct 8.1 SDK, you may be doing something else but what you are NOT doing is following the instructions.

[I'm just saying that instructions for anything coding related must be followed with precision for them to work and at the end of the day, following the instructions as they are written is paramount.]
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
szo
Posts: 132
Joined: Mon Dec 06, 2010 4:42 pm

Post by szo »

JasonX wrote:1>cd_win_mp3.obj : error LNK2019: unresolved external symbol _StopMP3DShow referenced in function _CDAudio_Stop
1>cd_win_mp3.obj : error LNK2019: unresolved external symbol _PawsMP3DShow referenced in function _CDAudio_Pause
1>cd_win_mp3.obj : error LNK2019: unresolved external symbol _KillMP3DShow referenced in function _CDAudio_Shutdown
1>cd_win_mp3.obj : error LNK2019: unresolved external symbol _PlayMP3DShow referenced in function _CDAudio_Play
1>cd_win_mp3.obj : error LNK2019: unresolved external symbol _VolmMP3DShow referenced in function _CDAudioSetVolume
1>cd_win_mp3.obj : error LNK2019: unresolved external symbol _MesgMP3DShow referenced in function _CDAudio_MessageHandler
1>cd_win_mp3.obj : error LNK2019: unresolved external symbol _UserMP3DShow referenced in function _CD_f
1>cd_win_mp3.obj : error LNK2019: unresolved external symbol _InitMP3DShow referenced in function _CDAudio_Init
This code here is lazy, inherently unportable, etc among other things (sorry, couldn't resist), but it is supposed to be fairly foolproof. However the errors you are seeing might be due to cplusplus symbol mangling. Therefore, if you are compiling that cd_win_mp3.c thing as a cplusplus source, then you must enclose the prototypes of those functions at top of the file within extern "C" {}, I guess.. (And for the better, you should compile it as C...) My 2 cents.....
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Post by mh »

Well of course it's lazy and - in particular - unportable. That's the whole point of it; quick and dirty MP3 support with minimum effort.

And given that it was originally written for DirectQ one of the design goals was the user does NOT need any additional libraries on their machine.

That last point is important and all too frequently overlooked. Quake already has enough barriers to new players so let's not put more up, please. Let's not have yet more crap where you need to download and install lib-this, lib-that or lib-t'other (and heaven help you if you don't have the right versions, or it conflicts with libraries for something else!) in order to just run the damn game. Let's instead create something that Just Works without the user needing to do any special scary stuff. Too many developers couldn't be arsed to do this and end up shifting the burden on to the user instead. One of the reasons why DirectQ is successful (and believe me, it's pretty damn successful outside of the main Quake communities) is that it doesn't create this burden for the user.

That's something you gain by sacrificing portability; it's all a part of the tradeoff, and it can be a very powerful thing.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
szo
Posts: 132
Joined: Mon Dec 06, 2010 4:42 pm

Post by szo »

mh wrote:...user does NOT need any additional libraries on their machine.
[...]
Let's not have yet more crap where you need to download and install lib-this, lib-that or lib-t'other
These are not any problems at all if you package the necessary libraries along with your binary or if you link statically, so those arguments are no excuses, not according to me anyway.
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Post by revelator »

heh well the problem with including directx libraries is more that its not inherently clear if its legal (some would say no way) since its ms property. though id themself have included them (old version though).

ill see if i can update the code for dx9 mh allready done some work in that regard if i remember correctly.

the problem with dx8 is that dx9 is not completely backwards compatible
with it.
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Post by mh »

The DirectShow interfaces should be fully backwards compatible, and are actually part of the Windows SDK now (rather than the DirectX SDK); this happened sometime around maybe 2001/2002/2003. Any problems are more likely on account of headers and libs not being configured correctly for either the project or the IDE.

Regarding end-use of them on a PC (which is the important thing - screw convenience for the developer, it's convenience for the end-user that's important) - if you've got Windows Media Player installed then you've got DirectShow. End of story. No need for any packaging, no need for any distributing, no need for any static linking, no need for instructions, no need for a readme that people won't read anyway, no need for any of that stuff; it's all there.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

DirectShow comes by default on Windows 98 iirc so no excuses.
i should not be here
szo
Posts: 132
Joined: Mon Dec 06, 2010 4:42 pm

Post by szo »

mh wrote:The DirectShow interfaces should be fully backwards compatible, and are actually part of the Windows SDK now (rather than the DirectX SDK); this happened sometime around maybe 2001/2002/2003. Any problems are more likely on account of headers and libs not being configured correctly for either the project or the IDE.

Regarding end-use of them on a PC (which is the important thing - screw convenience for the developer, it's convenience for the end-user that's important) - if you've got Windows Media Player installed then you've got DirectShow. End of story. No need for any packaging, no need for any distributing, no need for any static linking, no need for instructions, no need for a readme that people won't read anyway, no need for any of that stuff; it's all there.
Regarding it's convenience for the end-user, if a library-dependent binary is packaged properly, then the dependency is transparent to the user (and it won't need any readme, either), therefore you are effectively speaking about convenience to the developer here, which, apparently, we have differing opinions.
leileilol wrote:DirectShow comes by default on Windows 98 iirc so no excuses.
Care to explain what you are talking about? (what excuse???)
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Post by revelator »

tbh i dont think your opinions differ as much as you might think.

from what i can understand from mh's comments hees refering to the dll's allready present on most windows systems.

from a portability point i can see some confusion as directx on say linux
as far as i know only works from within a wine environment (so its actually a windows executable) or in cedega for that matter.

im not sure how you would suggest packaging the source so its transparent to the end user what libraries/headers are needed unless
we include the sdk with the source and setup the nessesary flags, but
from a learning point of view that might not be the best approach.

instead of arguing around different views id much prefer to hear how it could be improved :)
szo
Posts: 132
Joined: Mon Dec 06, 2010 4:42 pm

Post by szo »

OK, time to clarify the confusions ;)

I prefer that, instead of coding a lazy or quick'n'dirty, as well as as a limited version of a music playback functionality which importably depends on an OS-specific library such as dshow, one can code using cross platform libraries that are widely available to the developer, such as libmad, libogg, libvorbis, etc.; mh prefers otherwise. As for packaging the libraries: no one suggested that someone should package dshow (or dx), however, if one is to develop using the open source and portable (and GPL-compatible) libraries, then the developer can package the precompiled libraries (ie. dlls of them) along with the binary, like quakespasm or uhexen2 does, so that the end-user will have no problems looking for them; static linkage is the alternative. This is not as easier for the developer, but is most portable and modular; of course that's my opinion. I _believe_ that _this_ was the discussion and the conflicting ideas between me and mh.
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Post by mh »

Just like to clarify as well that there are no bad feelings or anything here, and we're not gonna start a tiresome flame war over this; we've just got conflicting perspectives on stuff. Each person's approach works for them at least within the remit of what they're trying to achieve (otherwise they wouldn't be using it) so an argument can be made that each is a valid approach and it comes down to personal preferences/target audience rather than anything else.

Think that's all, beer anyone?
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
szo
Posts: 132
Joined: Mon Dec 06, 2010 4:42 pm

Post by szo »

[quote="mh"]Just like to clarify as well that there are no bad feelings or anything here, and we're not gonna start a tiresome flame war over this; we've just got conflicting perspectives on stuff. Each person's approach works for them at least within the remit of what they're trying to achieve (otherwise they wouldn't be using it) so an argument can be made that each is a valid approach and it comes down to personal preferences/target audience rather than anything else.

Think that's all, beer anyone?[/quote]

Agreed wholeheartedly. Send the beer this way, btw :)
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

I finally took some time to look over the Quakespasm 0.85.4 modification to support ogg, mp3, etc.

That must have been a massive amount of work because I can see the revision required some rather hefty modifications (snd_mix.c, common.c, etc.)

Congrats! That could not have been easy.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
szo
Posts: 132
Joined: Mon Dec 06, 2010 4:42 pm

Post by szo »

Baker wrote:I finally took some time to look over the Quakespasm 0.85.4 modification to support ogg, mp3, etc.

That must have been a massive amount of work because I can see the revision required some rather hefty modifications (snd_mix.c, common.c, etc.)

Congrats! That could not have been easy.
Thanks. And yes, it wasn't that easy from time to time, but was fun.

The changes can be followed best by reviewing one svn commit at a time. The relevant music stuff seems to have started around revisions 353, 355 and 368:
http://quakespasm.svn.sourceforge.net/v ... vision=353
Just use the web interface there to follow the past work.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

Does this support music being played within pak files? The comments ...
common.c, common.h: Added new structure fshandle_t. Added new procedures
FS_fread, FS_fseek, FS_ftell, FS_rewind, FS_feof, FS_ferror and FS_fclose.
The new FS_*() stdio replacements are necessary if one is to perform non-
sequential reads on files reopened on pak files because bookkeeping about
file start/end positions is needed. Allocating and filling in the fshandle_t
structure is the users' responsibility when the file is initially opened.
... seems to imply it does, considering all the changes to the filesystem I saw.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Post Reply