[freespace2] Patches for music and movies

Taylor Richards mtrs at bellsouth.net
Sun Mar 27 13:20:31 EST 2005


On Sun, 2005-03-27 at 18:13 +0200, Pierre Willenbrock wrote:
> Taylor Richards wrote:
> > The movie
> > audio stuff doesn't help me out much in fs2_open since I'm going right
> > through audiostream there.  Saved me a bit of work though!
> Most code in these patches is 2 years old. I was relatively new to c++ 
> and back then audiostream didn't work, so i built on openAL. I actually 
> implemented audiostreaming after movie audio, so there is some code 
> duplication. I never changed that.

Yeah everything is pretty old.  I've got a good bit of updated code but
haven't been updating like I should since I've been working on fs2_open.
I had audio stream code mostly done but was missing some key parts.  It
was a bit more convoluted that what you did though so simple rules the
day.  I've been passing the new movie code around for almost 2 years but
never put it in CVS even though it had working video and audio.  Audio
could have worked better but what I'm going to do is replace my old
audio code with yours and then commit my stuff.  It's got a lot of code
reorg and bug/memory fixes and the video is about 12 times faster, at
least, with it being even faster than that on older cards.  

> > Bugs found (just FYI, Pierre):
> > - bad memset call in audiostr.cpp
> Do you know pascals fillchar(data,size,value)? I always mess them up 
> after switching programming language...

You got it right all but that once so I figured it was probably just
habit that you were fighting.  Happens to me a lot. ;)

> > - can't use CFILE (like I mentioned already) it's just too slow
> After looking at cfread() i don't see why it is slow. It does no costly 
> data copying or the like. The only problem that i see is it is using 
> fread(), which buffers unnecessaryly.

A little testing was done in fs2_open with this.  Volition did
originally use CFILE there too but then changed it to mmio.  In general
it doesn't make that much difference but in the heat of battle the
overhead of going through CFILE will start to become a problem.

> > - didn't close out the SDL_RWops handles in the acm code (memory leaks)
> I splitted ACM_convert_ADPCM_to_PCM() which doesn't close them either. I 
> should have looked at fs2_open earlier. In my old codebase i had my own 
> adpcm decoder.

ACM_convert_ADPCM_to_PCM() does close them, however not what's in CVS as
I just realized.  I never updated the code.  Ooopps :)

> Anyway, nice to see this getting into cvs. I may have some more (minor) 
> things in my old sources, and a hack for cdrom detection on linux(i even 
> recoded the copy protection. Although i switched it off). But those 
> areas have changed since, so it is a bit harder to get it working.

CD detection!  I've still got my go at this in my older code trees too.
Never got CD ejecting and mounting working right though.  Basic
detection and use wasn't a problem, even for movies, but I couldn't
figure out a (easy) cross-platform way of swapping the discs.  Send what
you've got though since that's something I've been wanting to work for a
while now (not the copy protection though, I hate games that require a
CD in the drive to work).

I'm going to make the few changes I mentioned before to your streaming
code and then get it in CVS.  I was planning to use the new code I did
for fs2_open but it wouldn't be the easiest thing to bring into the
icculus.org version at this point.  One other change I've got to make to
your code and forgot to mention was that it's not 64-bit compatible.
Nothing big but the timer code passes a pointer through a 32-bit
variable at one point and that doesn't work very well on a 64-bit
platform.  I should get it all in CVS by days end though.


Taylor

-- 
Taylor Richards <taylor at icculus.org>




More information about the freespace2 mailing list