Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#1386 closed defect (fixed)

BS2: music cuts out while scrolling takes place

Reported by: SF/cloney Owned by: eriktorbjorn
Priority: normal Component: Engine: Sword2
Keywords: Cc:
Game: Broken Sword 2

Description

Gentoo Linux (stable)
ScummVM 12/01/2004 CVS
ALSA 0.9.8
Total Revolution version of BS2 (identical to Sold Out,
I think)

When running BS2, the music cuts out while the screen
is scrolling. This is noticable right from the start,
when George backs away from the spider and forces the
screen to scroll.

This has been the case for at least the last few days
worth of builds, but I don't think I remember it being
a problem previously. I tried BS1 for comparison, and
there were no music problems while scrolling.

Cloney

Ticket imported from: #875683. Ticket imported from: bugs/1386.

Change History (10)

comment:1 Changed 15 years ago by eriktorbjorn

BS2 animations run at 12 frames per second, which doesn't
take that much processing power even though the entire
screen is re-rendered for each frame. However, when the
screen is scrolling it starts pumping out frames as fast as
it can to make the camera movement smoother. That's why CPU
usage spikes like it does. (The original code used to draw
these extra frames all the time, regardless of whether or
not the screen was scrolling, so it was using up all the CPU
all the time.)

I've been thinking of adding code to limit the frame rate
during scrolling, but I never got around to it since I never
heard of it causing any trouble. Until now, that is. Strange...

comment:2 Changed 15 years ago by eriktorbjorn

As an experiment, I've added a delay of 0 milliseconds when
it draws interpolation frames. It shouldn't delay anything,
but perhaps it will give the audio thread some breathing
room. Or not. We'll see.

comment:3 Changed 15 years ago by SF/cloney

Just got the latest anon-cvs and tried it - the music still
stops during scrolling, although interestingly it restarts
slightly before the scrolling finishes.

Other people in #scummvm mentioned that scrolling in BS2
used 80-100% of their CPU when scrolling, compared to about
10-20% in BS1.

I'll try BS2 on Windows XP with ScummVM later, to see if
it's something specific to my Linux setup.

Cloney

comment:4 Changed 15 years ago by eriktorbjorn

In sword2/driver/render.cpp there is the following line:

_vm->_system->delay_msecs(0);

That was the line I added as an experiment. What happens if
you change the 0 to, say, 10?

comment:5 Changed 15 years ago by SF/cloney

Setting it to 10 fixed the problem.

Thanks!

Cloney

comment:6 Changed 15 years ago by eriktorbjorn

Ok, I've committed that change to CVS. I'd like to test it
on a slower computer before I close the bug report, so I'll
keep it open for a while longer.

comment:7 Changed 15 years ago by SF/cloney

For the record, I've got a 900Mhz Athlon Thunderbird with
256Mb RAM, and I'm running a 2.4.X kernel.

comment:8 Changed 15 years ago by eriktorbjorn

Owner: set to eriktorbjorn
Resolution: fixed
Status: newclosed

comment:9 Changed 15 years ago by eriktorbjorn

Pffft. That's a *fast* computer. ;-)

Anyway, it still looks smooth on my 450 MHz PIII, so I'll
close this bug then.

comment:10 Changed 15 years ago by SF/khalek

Component: Engine: Sword2
Game: Broken Sword 2
Note: See TracTickets for help on using tickets.