#------------------------------------------------------------------------------
-# $File: audio,v 1.107 2019/02/23 01:16:30 christos Exp $
+# $File: audio,v 1.108 2019/02/23 01:16:31 christos Exp $
# audio: file(1) magic for sound formats (see also "iff")
#
# Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
# NOTE: Assuming HEAD starts at 0x40.
# FIXME: Replace 0x48 with HEAD offset plus 8.
0 name nintendo-wii-brstm-fields
->(0x10.L) belong 0x48454144 \b:
+>(0x10.L) string HEAD \b:
>>(0x10.L+0x0C) belong x
>>>(&-4.L+0x48) belong x
>>>>&-4 byte 0 PCM, signed 8-bit,
# Wii is big-endian, so default to BE.
>4 beshort 0xFEFF
>>0 use nintendo-wii-brstm-fields
->4 beshort 0xFFFE
->>0 use ^nintendo-wii-brstm-fields
+>4 leshort 0xFEFF
+>>0 use \^nintendo-wii-brstm-fields
# Nintendo 3DS BCSTM audio format (fields)
0 name nintendo-3ds-bcstm-fields
->(0x18.l) lelong 0x4F464E49 \b:
+>(0x18.l) string INFO \b:
# INFO block: Stream information starts at 0x20 (minus 4 for the 'INFO' magic)
>>&0x1C byte 0 PCM, signed 8-bit,
>>&0x1C byte 1 PCM, signed 16-bit,
>>&0x1E byte 3 3 channels
>>&0x1E byte 4 quad
>>&0x1E byte >4 %u channels
->>&0x20 leshort !0 %u Hz
+>>&0x20 lelong !0 %u Hz
# Nintendo 3DS BCSTM audio format
# https://www.3dbrew.org/wiki/BCSTM
# 3DS is little-endian, so default to LE.
>4 leshort 0xFEFF
>>0 use nintendo-3ds-bcstm-fields
->4 leshort 0xFFFE
->>0 use ^nintendo-3ds-bcstm-fields
+>4 beshort 0xFEFF
+>>0 use \^nintendo-3ds-bcstm-fields
+
+# Nintendo Wii U BFSTM audio format
+# http://mk8.tockdom.com/wiki/BFSTM_(File_Format)
+# NOTE: This format is very similar to BCSTM.
+# Added by David Korth <gerbilsoft@gerbilsoft.com>
+0 string FSTM Nintendo Wii U BFSTM audio file
+!:mime audio/x-bfstm
+!:ext bfstm
+# BFSTM is used on both Wii U (BE) and Switch (LE),
+# so default to LE.
+>4 leshort 0xFEFF
+>>0 use nintendo-3ds-bcstm-fields
+>4 beshort 0xFEFF
+>>0 use \^nintendo-3ds-bcstm-fields