Forum

MP3 or Ogg Support

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Postby revelator » Wed Nov 18, 2009 11:15 am

ah i see :) another todo on my long list of things :?

btw i couldnt get your normalmapping code working on alias models
(due to the way there calculated i think) so im looking into nagging of the code from quake2xp for alias model normalmaps.

also i noticed some strange code you had in gl_rmain.c for calculating the leafs with the entity mins/maxs but the code doesnt seem to link to anything cause the mins/maxs are calculated after the call to the function that finds the correct modelleaf ?

so i did it like this

Code: Select all
      // get entity origin
      VectorAdd (ent->origin, ent->model->mins, ent->mins);
      VectorAdd (ent->origin, ent->model->maxs, ent->maxs);

      // approximate the correct leaf for the entity in order to properly set fog and caustics.
      // this isn't 100% accurate (no method ever could be unless we use water surfs as clipping
      // planes) but it suffices pretty good for id1
      ent->modelleaf = R_LeafForEntity (ent->mins, ent->maxs);


before it was

// approximate the correct leaf for the entity in order to properly set fog and caustics.
// this isn't 100% accurate (no method ever could be unless we use water surfs as clipping
// planes) but it suffices pretty good for id1
ent->modelleaf = R_LeafForEntity (ent->mins, ent->maxs);

// get entity origin
VectorAdd (ent->origin, ent->model->mins, ent->mins);
VectorAdd (ent->origin, ent->model->maxs, ent->maxs);
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby mh » Wed Nov 18, 2009 1:04 pm

Jesus I don't know! :lol:

That's about 4 or 5 year old code isn't it? I think it's relating to setting a correct fog colour on underwater entities when you have both underwater fog and translucent water enabled, but even that much I'm guessing.
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
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby revelator » Wed Nov 18, 2009 2:55 pm

correct :wink: you do remember quite good :P

my question was merely to find out if my way is correct cause ent->mins/maxs arent initialized anywhere so the data must come from the modelorigin (atleast thats what the same code does on brushmodels) and in that order :wink:
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby mh » Wed Nov 18, 2009 5:27 pm

I'd have to look over the implementation of R_LeafForEntity to be certain what the intent was, but I have a hunch that you're correct and that I had missed that part. :D
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
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby revelator » Wed Nov 18, 2009 8:51 pm

oki ill leave it like it is for the moment ;)

no adverse effects noticed alltho before there where none either :)

btw i implemented your alpha transparency sorting and moved it clientside works quite good it seems :D

i somehow broke culling though :lol: need to look over the code some more ive split a lot of the stuff in it into seperate functions (it was starting to be a bit messy in there) :P
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby Baker » Tue Jun 01, 2010 3:09 am

mh wrote:bgmvolume is there isn't it? It never worked on the CD cos a lot of CDs were just 0 or 1 for volume.

My current code for volume goes something like this:
Code: Select all
   void AdjustVolume (void)
   {
      // ensure that we can change volume
      if (!this->ds_Audio) return;

      long db;

      // whoever in ms designed this must have really prided themselves on being so technically correct.  bastards.
      // decibels are great if you're an audio engineer, but if you're just writing a simple sliding volume control...
      if (bgmvolume.value <= 0)
         db = -10000;
      else if (bgmvolume.value >= 1)
         db = 0;
      else
         db = log10 (bgmvolume.value) * 2000;

      // set the volume
      this->ds_Audio->put_Volume (db);
   }


The version used in the Realm codebase was a much cruder earlier take on it that precalculated the log10 in discrete steps.

A version of the above should work just fine; you just need to check for a change in the value of bgmvolume and change the this->ds_Audio pointer to pAudio.


I have volume changing working fine now. Ironically, the question I asked here I shouldn't have needed to ask had I looked through the code properly.

Anyway, thanks again MH and Reckless.
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 ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

i got fmod to play mp3s

Postby hondobondo » Tue Jun 15, 2010 6:17 pm

in bengts nehquake. but it violated copyrights according to leilei so i took it down. couldn't get it to load automatically like a cd player (i.e., darkplaces) i have the source around here somewhere...
hondobondo
 
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am

Postby mh » Tue Jun 15, 2010 9:19 pm

Nothing illegal about linking to fmod aside from what GPL weenies would like to have you believe. It's a proprietary library for sure, but so is user32 (which all Windows programs link to), so is kernel32 (which all Windows programs link to) and so even is opengl32.

If linking to fmod is illegal then linking to opengl32 is also illegal.

There was a scare about this back in the QuakeSrc.org days for sure, and it was based on info quite possibly originally provided and spread by FSF FUD-mongers who believe in the racial blood purity of Free ("thou shalt not use any definition of the word 'free' other than the one I choose") software.

But think about it logically. The GPL permits linking a GPL program to external libraries. Nothing wrong with using fmod.
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
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby Spike » Tue Jun 15, 2010 9:55 pm

The GPL doesn't stop you linking to anything.
It stops you from distributing such derivative works.

opengl32, user32, kernel32 are all system componants of windows/linux/macosx/etc, and are allowed under the GPL:
However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable

They're import libraries are part of the compiler.
X11 is generally considered a major component of linux systems, and is compatible anyway.

You may not distribute binaries that are statically linked to fmod. It is a violation of the GPL.

You *might* be able to get away with dynamic linking, but any headers that you import, any static libraries, must have a GPL compatible license. It must be a generic plugin API in its aproach.


If you really want to load mp3s in a quake engine without violating the GPL, load them via pipes through a separate program. There are no legal qualms here, other than actual distribution of the two programs. Then you can play oggs just as easily as you can mp3s. :P
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby mh » Tue Jun 15, 2010 10:33 pm

I would have thought this section of the GPL means statically linkiing to fmod is OK:
If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works.


Even if it doesn't (and I'm dubious about the "distribute them as separate works" part) the GPL FAQ entries here and here specifically cover linking non-free non-system libraries with GPL programs and explicitly state that it's OK to do so (so long as you add a special exception that covers it - sample text given).
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
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby Spike » Tue Jun 15, 2010 10:56 pm

Your quote does not consider the sentance that follows it, which directly refers to the exception of your quoted sentance.

Also, you can't add an exception unless you are the sole copyright owner of the GPL parts, id software would not agree with this.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Baker » Tue Jun 15, 2010 11:00 pm

mh wrote:I would have thought this section of the GPL means statically linkiing to fmod is OK


No that absolutely isn't allowed.
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 ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby frag.machine » Tue Jun 15, 2010 11:02 pm

mh wrote:I would have thought this section of the GPL means statically linkiing to fmod is OK:
If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works.


I'd say that "identifiable sections of work that are not derived from the Program" is a gray area in GPL and subject to a lot of valid questioning. Better to use a linked library under a GPL-compatible license.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby mh » Wed Jun 16, 2010 12:17 am

As an acceptable solution somebody could create a GPL static lib that links to fmod and then include the exception in that. They would own the copyright for the GPL lib and other GPL programs would be able to link to it without any issues.

This isn't about arguing just for the sake of it, it's about trying to find a solution that would enable people to do stuff. :wink:
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
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby Spike » Wed Jun 16, 2010 12:59 am

mh, your gpl static lib would require an exception as it is would not otherwise be able to comply with the gpl (mp3 decoders see section 8, have fun in the US), and would thus not be compatible with quake's exception-less gpl.
You can't just add exceptions to someone else's copyright.

You want a solution? Follow Carmack's (security) suggestion.
Create a child process, pipe the source file to it, read the pcm data back. That complies (ogg123 or mp3123 or whatever it is, both are commandline-based decoders). You can plug whatever decoder you want in there, and its not the engine imposing the decoder. The catch is that the user needs to download it themselves.

This is complicated by the fact that a Quake engine which depends upon non-gpled work is somewhat dubious, but considered okay, as you can always replace that with, eg, nexuiz.... well, bad example, but you get the idea.
Also, DirectX SDKs are not gplable. DirectX may be a system componant, but the sdk is not. And compilers generally do not have the most recent SDK, and thus the recent versions are not compatible with the gpl, until a newer compiler version is out...
Its all rather messy tbh.

Thankfully, I am not a lawyer! And because I said that, you're not allowed to sue me, mmkay?
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

PreviousNext

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest