Commit Graph

132 Commits

Author SHA1 Message Date
Torbjörn Andersson
cd9496ab3a Added FIXME comment about DipMusic().
svn-id: r10010
2003-09-05 16:07:03 +00:00
Torbjörn Andersson
7400995094 Cleanup.
svn-id: r10009
2003-09-05 15:56:43 +00:00
Torbjörn Andersson
94ec5238c9 This fixes another music-related crash for me. I guess it's our
implementation of music fade-out that makes it a bad thing to close the
music cluster file prematurely.

svn-id: r10007
2003-09-05 15:37:51 +00:00
Torbjörn Andersson
bee5a3820a Removed unused function, StartMusicFadeDown().
svn-id: r10004
2003-09-05 12:19:40 +00:00
Torbjörn Andersson
2ecbd4ae88 Cleaned up UpdateCompSampleStreaming() and re-enabled music fading. We
currently don't fade music that ends because we reached the end of the
musical cue, though. Only music that ends because it's being replaced by
another cue.

svn-id: r10003
2003-09-05 11:12:40 +00:00
Jonathan Gray
bb9a4bbfcc comment unused label
svn-id: r9995
2003-09-05 03:46:30 +00:00
Torbjörn Andersson
9729256b2b Added locking to the music code. I'm not really the right person to do this
but at least it doesn't seem to do any harm.

Disabled the sound FX "garbage collection" in FxServer(). I'm not really
convinced it's necessary at all, and even if it is, doing it from a
separate thread it just begging for trouble. I've modified OpenFx()
slightly to deal with this, but I may still have introduced regressions.

Temporarily disabled the "goto label1" hack, since it seems to be the main
reason for ScummVM crashing if I allow a piece of music to finish on its
own (i.e. when not terminating it prematurely by triggering another piece
of music).

svn-id: r9990
2003-09-04 10:58:55 +00:00
Torbjörn Andersson
a1e336c1cb Added FIXME comment about how we probably need locking for FxServer() and
the functions which access data manipulated by FxServer().

For instance, FxServer() may free bufferFx[i], which sounds potentially
unhealthy to me.

svn-id: r9989
2003-09-03 18:59:02 +00:00
Torbjörn Andersson
ee68d3d198 Removed fxLooped[], fxCached[] and musCounter[]. They were written to, but
never read.

svn-id: r9984
2003-09-03 06:27:25 +00:00
Paweł Kołodziejski
3fba3b3d4c fixed music fading out. it's "goto" hack.
originaly dsound has 3 seconds buffer fillled with data enought for fading
this hack continue play music for time while fading is going

svn-id: r9983
2003-09-03 06:03:29 +00:00
Paweł Kołodziejski
1fc3c0be23 more cleanup
svn-id: r9982
2003-09-03 05:04:55 +00:00
Paweł Kołodziejski
b62c527fa0 some cleanup code
svn-id: r9981
2003-09-03 04:45:57 +00:00
Paweł Kołodziejski
455d3faf2f fixed interval of fxServer func (why i saw before 1000 miliseconds?), moved init sound data to class sound
svn-id: r9980
2003-09-03 03:57:23 +00:00
Torbjörn Andersson
124a84033f Unless I'm gravely mistaken, StreamCompMusic() should always create a new
stream, in which case the warning about the sound handle being 0 is bogus.

svn-id: r9973
2003-09-02 16:20:10 +00:00
Torbjörn Andersson
145f17c4a9 Moved the sound initialisation to the Sword2Sound constructor to avoid
warning messages about uninitialised sound handles.

svn-id: r9972
2003-09-02 15:55:55 +00:00
Torbjörn Andersson
907485c1a2 Another untested endian fix.
svn-id: r9971
2003-09-02 15:11:19 +00:00
Torbjörn Andersson
730e6b8c38 Use the new per-channel pausing. This allows us to play the music for the
in-game dialogs.

svn-id: r9969
2003-09-02 13:50:45 +00:00
Torbjörn Andersson
8c61a29c29 Since soundHandleMusic[] is now an array of sound handles instead of
channel indexes, we should use stopHandle() instead of stop() to kill the
music channel.

Am I the only one who finds the distinction between channel indexes and
sound handles confusing at times? :-)

svn-id: r9967
2003-09-02 12:55:20 +00:00
Torbjörn Andersson
5270fa2d5a Re-formatted the code to be a bit more in line with the rest of ScummVM,
and made a few (untested) endian-fixes.

svn-id: r9965
2003-09-02 09:55:11 +00:00
Torbjörn Andersson
66cdc7900e Re-formatted the code to be a bit more in line with the rest of ScummVM.
svn-id: r9964
2003-09-02 09:54:42 +00:00
Paweł Kołodziejski
743a3fbdaf added sound handle stuff to mixer streams
svn-id: r9956
2003-09-01 13:43:22 +00:00
Torbjörn Andersson
178b0d82df Another attempt at fixing the music1.clu / music2.clu thing.
svn-id: r9952
2003-09-01 06:40:07 +00:00
Paweł Kołodziejski
56ca9f03df possibly fixes for not exist id stream channel
svn-id: r9951
2003-09-01 06:23:04 +00:00
Paweł Kołodziejski
beb138d4d8 added warkaround for not exist music stream id at appendStream call
svn-id: r9950
2003-09-01 06:13:47 +00:00
Paweł Kołodziejski
2533b23a60 added mixer features: volume and pan control per channel
svn-id: r9944
2003-08-31 20:26:21 +00:00
Torbjörn Andersson
54f5caedc5 Untested (because I don't have any savegames on this computer) support for
using music1.clu and music2.clu instead of music.clu

svn-id: r9943
2003-08-31 18:09:21 +00:00
Torbjörn Andersson
e60ee06e2d When a fading music channel is freed to make room for new music, or when a
music channel has faded out, destroy the channel immediately. Don't wait
for the mixer to finish it off.

This seems to fix a problem where the mixer would eventually run out of
slots if you left the Quit dialog showing for too long.

Unfortunately I don't know if it fixes the "out of slots" errors I
encountered once during normal play. Oh well, time will tell...

svn-id: r9942
2003-08-31 17:28:36 +00:00
Torbjörn Andersson
3b62d9b4da No longer assume that all sound effects are 22 kHz. Some are 11 kHz.
svn-id: r9939
2003-08-31 10:45:14 +00:00
Torbjörn Andersson
155f4591c9 Cleaned up StreamCompMusic(), including some untested endian-fixes.
This should also fix the bug where music sometimes didn't start playing.

svn-id: r9938
2003-08-31 10:38:32 +00:00
Jonathan Gray
25a7c5de67 support having speech clusters named speech1.clu and speech2.clu cd.bin is needed if you want to use this scheme
svn-id: r9937
2003-08-31 03:19:43 +00:00
Jonathan Gray
4ea7eeb563 fix compilation
svn-id: r9934
2003-08-31 00:00:09 +00:00
Torbjörn Andersson
c54baa429b BS2 crashed because it passed a buffer of uneven length to the mixer. This
is the only place I can think of where this could have happened, so I've
added a paranoid check to ensure the buffer length is even.

Let's see how that works out...

svn-id: r9933
2003-08-30 22:17:59 +00:00
Torbjörn Andersson
f00b48b4cf Set a default music volume so that we can actually hear it. :-)
svn-id: r9932
2003-08-30 21:58:10 +00:00
Paweł Kołodziejski
7b3aae7c03 fixed not cleared sound handle for music
svn-id: r9931
2003-08-30 21:09:13 +00:00
Paweł Kołodziejski
b321a7a468 ah
svn-id: r9928
2003-08-30 20:27:48 +00:00
Paweł Kołodziejski
c684a076ee revert id handle stuff
svn-id: r9927
2003-08-30 20:25:07 +00:00
Paweł Kołodziejski
a2dad74da1 added sfx support, increased speech support, and music code(streaming works fine but you don't hear anything) newStream, and appendStream doesn't work but playRaw works for music
svn-id: r9923
2003-08-30 18:06:08 +00:00
Jonathan Gray
5825a28330 properly close down when playing demo
svn-id: r9921
2003-08-30 15:21:51 +00:00
Torbjörn Andersson
23ba54ec92 Fixed sprite clipping issues, I hope.
svn-id: r9920
2003-08-30 10:23:40 +00:00
Torbjörn Andersson
fb060c6cbd Disabled debug output. (I really need to get the debug message level to
work for BS2! :-)

svn-id: r9906
2003-08-29 06:46:52 +00:00
Torbjörn Andersson
ed698cb635 Added some code to stop producing interpolation frames if the scene has
already reached its scroll target. This keeps BS2 from using all available
CPU time all of the time.

It may still be that we need a mechanism for throttling the frame rate when
the scene is moving towards a scroll target, but my computer isn't really
fast enough to test that.

Two other bugs fixed in the process:

* I think the last frame of the render cycle was rendered, but not
  displayed. If so, that should be fixed now.

* I discovered that there are cases where we do need to clear the screen
  (e.g. at the "Meanwhile..." message when George has found out about the
  Glease Gallery), so I've re-enabled the function and disabled it in the
  render cycle.

svn-id: r9904
2003-08-29 06:42:34 +00:00
Torbjörn Andersson
d900ea66bd Cleanup.
svn-id: r9903
2003-08-29 06:19:34 +00:00
Torbjörn Andersson
259fb42459 I forgot to commit this file earlier. (It's only a FIXME comment anyway.)
svn-id: r9892
2003-08-28 12:26:28 +00:00
Torbjörn Andersson
f7ce39763e Removed the Surface class in favor of small struct specially made for the
block surfaces. (A block surface is a 64x64 tile of a parallax layer.)

I've also done a few things to try and optimize the drawing:

* The back buffer is no longer cleared between frames. This may cause
  regressions, but I do believe that the entire picture area is always
  completely re-rendered for each frame.

  As a result of this, the menu code is now responsible for clearing the
  icon areas itself.

* A few unnecessary copy_rect() calls were commented out in favor of one
  big copy_rect() in ServiceWindows().

* Completely opaque block surfaces are copied with memcpy(), one line at a
  time.

Unless we manage to add intelligent screen redrawing, I don't think it will
get that much faster than this, though there is some unnecessary data
copying in DrawSprite() that could be removed.

And the game is still a terrible CPU hog. I believe the animation runs at
approximately 12 fps. If there's still time left, it will pump out further
frames to get smooth scrolling. We ought to put a cap on that, and if it
has already reached the scroll target it should sleep for the rest of the
render cycle.

svn-id: r9886
2003-08-28 06:36:15 +00:00
Torbjörn Andersson
76df5a2733 Cleanup
svn-id: r9885
2003-08-28 06:14:46 +00:00
Torbjörn Andersson
aab8d69078 Fixed format string error.
svn-id: r9884
2003-08-28 06:13:59 +00:00
Torbjörn Andersson
9154abefa9 Add code to check for game-specific scaler and fullscreen settings, like we
do for the other game engines.

svn-id: r9880
2003-08-27 13:31:47 +00:00
Torbjörn Andersson
0119d6d642 Added code for smoothing upscaled sprites (for the highest detail setting).
I don't know if I got it right - the result doesn't look that great to me -
but at least the infrastructure is there.

This, I think, marks the point where BS2 graphics is pretty much done. Some
functions haven't been unstubbed yet, but I believe they're used for
debugging and/or profiling. I'm not sure they're worth the trouble.

Of course, there is still testing and clean-ups to make. For instance, I'd
like DrawSprite() to use malloc() a bit less.

svn-id: r9879
2003-08-27 07:17:12 +00:00
Torbjörn Andersson
1ebb3cb742 Unstubbed DimPalette() (used when pausing the game) and re-indented the
code to be more in line with the ScummVM coding style.

svn-id: r9878
2003-08-27 07:01:05 +00:00
Jonathan Gray
8b91af78db use file class for speech so people with clusters in different directories get to hear sound as well
svn-id: r9875
2003-08-27 06:32:42 +00:00