Advertisement
AnonBaiter

Gladius (2003) - sound system study

May 5th, 2020
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. Gladius (2003, LucasArts) sound system
  2. ---
  3. (further information here is based on the Xbox version of the game)
  4. the sound system leverages at least three files:
  5. 1. "internal" file("XBB" extension)
  6. 2. "external" file("XSB" extension)
  7. 3. "flow" file("FLO" extension)
  8.  
  9. "internal" file goes like this:
  10. 0x00(32-bit) - whole size of "internal" file minus 4
  11. 0x04(32-bit) - number of sound entries (explained later)
  12.  
  13. so, what is "number of sound entries" doing here?
  14.  
  15. first of all, "internal" file is home to "smaller" sounds that the game needs to use. that is to say, if at least one sound entry has a smaller file size (2MB for example) then that file is guaranteed to stay into that "internal" file. otherwise it belongs in the "external" file which is where some of the "larger" sound entries (11MB for example) reside.
  16.  
  17. one thing both files ("internal" and "external") all have in common however is that these sound files need a header to prepare them for in-game decoding. the Xbox version of the game uses RIFF as the basis for such a header.
  18.  
  19. for "smaller sounds" that are stored in this "internal" file they are stored into fully-formed RIFF files.
  20.  
  21. for "larger sounds" that are stored in this "external" file, said "larger" sound is stored there without a RIFF header (as in, raw sound data). instead, the "internal" file carries up the RIFF header for that "larger" sound and the only thing that comes out after that point is two more infos for that particular sound.
  22.  
  23. anyway, here's the rundown of how RIFF header looks like:
  24. 0x00(32-bit) - "RIFF" chunk
  25. 0x04(32-bit) - "RIFF" size, actual meaning depends on:
  26. 1. for "smaller sounds", whole size that comes after said chunk
  27. 2. for "larger sounds", 0x30
  28. 0x08(32-bit) - "WAVE" chunk
  29. 0x0c(32-bit) - "fmt " chunk
  30. 0x10(32-bit) - "fmt " size
  31. 0x14(16-bit) - codec number, always 0x69
  32. 0x16(16-bit) - channels
  33. 0x18(32-bit) - sample rate frequency
  34. 0x1c(32-bit) - average bytes per second
  35. 0x20(16-bit) - block size (includes all channels)
  36. 0x22(16-bit) - bit depth, always 4
  37. 0x24(16-bit) - always 2
  38. 0x26(16-bit) - always 0x40
  39. 0x28(32-bit) - "data" chunk
  40. 0x2c(32-bit) - "data" size actual meaning depends on:
  41. 1. for "smaller sounds", whole size that comes after said chunk
  42. 2. for "larger sounds", 0xfffffff8
  43. for "larger sounds", RIFF header has extra data after this:
  44. 0x30(32-bit) - sound offset
  45. 0x34(32-bit) - sound size
  46. for "smaller sounds" after RIFF header comes actual sound data.
  47.  
  48. with all this in mind, the "internal" file includes not only includes "smaller" sound entries but also "larger" ones, and thus have entirely different ways of dealing with them.
  49.  
  50. hence why "number of sound entries" is there to begin with.
  51.  
  52. all sound entries use a proprietary ADPCM codec embedded as a decoder chip into the designed platform. in Gladius' case, the game was released into PlayStation 2, GameCube, and Xbox. from there on, the game will have all its sound files use that particular codec coming from these platforms. the Xbox version of the game uses the aforementioned RIFF header for most of its handiwork pertaining to all those sound entries that are going to be played in-game.
  53.  
  54. as for the "flow" file, it acts as a "script" file for the sound system to process in-game sounds. for brevity sake, how the "flow" file works will not be explored here. at least not for now.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement