XSND - MajickTek/XFF-SPEC GitHub Wiki

Now we're on to sounds. The eXtensible Sound Format is much more complicated than the XIMG format.

We have one new structure, SOUND, which requires if-else logic to be functional.

Let's have a look:

SOUND
{
  ID STRING
  dataFormat U8
  dataLength U32
  
  // 8-bit samples
  if(dataFormat == 0x00)
  {
    data U8[dataLength]
  }
  
  // 16-bit samples
  if(dataFormat == 0x01
  {
    data U16[dataLength]
  }
  
  // 32-bit samples
  if(dataFormat = 0x02)
  {
    data U32[dataLength]
  }
}

That is the long sound format. The if statements tell the format what to do for different sound encodings.

But we're not done yet. We have to add to the FILE structure:

FILE
{
  header HEADER
  imageCount U16
  imageList IMAGE[imageCount]
  soundCount U16
  soundList SOUND[soundCount]
}

You may wonder why all the seemingly separate formats tie together. This is because they are separate formats extending off of one format, and together they will become XFF 2.0. More on this in another article.