Skip to content

Commit

Permalink
Merge branch 'vgmstream:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Greedysky authored Nov 23, 2023
2 parents 6b23c29 + fc2b5b3 commit 2a80427
Show file tree
Hide file tree
Showing 56 changed files with 1,818 additions and 591 deletions.
4 changes: 3 additions & 1 deletion .github/formats-info.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def update_doc(self):
with open(file, 'r', encoding='utf-8') as f:
is_updating = False
for line in f:
line = line.strip()
line = line.strip('\n')

# find list section, add all current lines and ignore old ones until next section
if line.startswith('### List'):
Expand All @@ -334,6 +334,8 @@ def update_doc(self):
if not is_updating:
doc_lines.append(line)

doc_lines.append('')

with open(file, 'w', encoding='utf-8', newline='\n') as f:
f.write('\n'.join(doc_lines))

Expand Down
7 changes: 5 additions & 2 deletions cli/tools/txtp_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,11 @@ def _get_string(self, str, full=False):
def _get_text(self, str):
text = self._get_string(str, full=True)
# stream names in CLI is printed as UTF-8 using '\xNN', so detect and transform
if text and '\\' in text:
return text.encode('ascii').decode('unicode-escape').encode('iso-8859-1').decode('utf-8')
try:
if text and '\\' in text:
return text.encode('ascii').decode('unicode-escape').encode('iso-8859-1').decode('utf-8')
except:
return text #odd/buggy names
return text

def _get_value(self, str):
Expand Down
1 change: 1 addition & 0 deletions cli/tools/txtp_segmenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def main():
name = get_txtp_name(args, file)
if not name in txtps:
txtps[name] = []
file = file.replace('\\', '/')
txtps[name].append(file)


Expand Down
4 changes: 2 additions & 2 deletions doc/BUILD-LIB.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ Untested/outdated.
### libopus
This is used below by FFmpeg (but can be disabled), as a static lib (`.a`/`.lib`) rather than DLL.

If you wonder why use it through FFmpeg instead of directly, all work was already done for FFmpeg's opus so it was faster easier this way.
If you wonder why use it through FFmpeg instead of directly, all work was already done for FFmpeg's opus so it was faster and easier this way.

#### Source
```bat
Expand Down Expand Up @@ -475,7 +475,7 @@ MSBuild.exe opus.sln /p:Platform=x64 /p:Configuration=Release /p:WindowsTargetPl
### FFmpeg
vgmstream's FFmpeg builds for **Windows** and static builds for **Linux** remove many unnecessary parts of FFmpeg to trim down its gigantic size, and, on Windows, are also built with the "-vgmstream" suffix to prevent clashing with other plugins. Current options can be seen in `ffmpeg_options.txt`. Shared **Linux** builds usually link to system FFmpeg without issues, while standard FFmpeg DLLs may work (renamed to -vgmstream).

FFmpeg can be compiled with *libopus* (external lib) rather than internal *opus*. This is used because FFmpeg decodes incorrectly Opus files used some in games (mostly low bitrate). In older versions this was audibly wrong, but currently the difference shouldn't be that much, but still not that accurate compared with *libopus* (PCM sample diffs of +5000), so *vgmstream* enables it. Getting *libopus* recognized can be unwieldly, so internal *opus* is a decent enough substitute (remove `--enable-libopus` and change `libopus` to `opus` in `--enable-decoder`).
FFmpeg can be compiled with *libopus* (external lib) rather than internal *opus*. This is used because FFmpeg decodes incorrectly Opus files used some in games (mostly low bitrate). In older versions this was audibly wrong, but currently the difference shouldn't be that much, but still not that accurate compared with *libopus* (PCM sample diffs of +5000), so *vgmstream* enables it. Getting *libopus* recognized can be unwieldly, so internal *opus* is a decent enough substitute (remove `--enable-libopus` and change `libopus` to `opus` in `--enable-decoder` from options, and remove `--enable-custom-modes` from *configure*).

GCC and MSVC need `yasm.exe` somewhere in `PATH` to properly compile/optimize: https://yasm.tortall.net (add `--disable-yasm` to *configure* options to disable, may decrease performance).

Expand Down
188 changes: 97 additions & 91 deletions doc/FORMATS.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ different internally (encrypted, different versions, etc) and not always can be
- Ogg Vorbis header (KOVS) [*OGG_KOVS*]
- *ogg_vorbis*
- Subfiles: *ogg_vorbis*
- *ogg_vorbis_config*: `.ogg .logg .adx .rof .acm .sod .msa .bin .lbin .kvs .kovs .rpgmvo .ogg_ .bgm .gwm .mus .isd .sngw .lse .eno .um3 .u0 + .(external)`
- *ogg_vorbis_config*: `.ogg .logg .adx .rof .acm .sod .msa .bin .lbin .kvs .kovs .rpgmvo .ogg_ .bgm .gwm .mus .fish .isd .sngw .lse .eno .um3 .u0 + .(external)`
- Subfiles: *ogg_vorbis_config ogg_vorbis_cfg_ovmi ogg_vorbis_tests ogg_vorbis_common ogg_vorbis_tink ogg_vorbis*
- Codecs: OGG OGG_VORBIS
- **sfl.c**
Expand Down Expand Up @@ -271,7 +271,7 @@ different internally (encrypted, different versions, etc) and not always can be
- RIFF WAVE header (ctrl looping) [*RIFF_WAVE_MWV*]
- RIFX WAVE header [*RIFX_WAVE*]
- RIFX WAVE header (smpl looping) [*RIFX_WAVE_smpl*]
- *riff*: `.wav .lwav .xwav .mwv .da .dax .cd .med .snd .adx .adp .xss .xsew .adpcm .adw .wd .(extensionless) .sbv .wvx .str .at3 .rws .aud .at9 .ckd .saf .ima .nsa .pcm .xvag .ogg .logg .p1d .xms .mus .dat .ldat`
- *riff*: `.wav .lwav .xwav .mwv .da .dax .cd .med .snd .adx .adp .xss .xsew .adpcm .adw .wd .(extensionless) .sbv .wvx .str .at3 .rws .aud .at9 .ckd .saf .ima .nsa .pcm .xvag .ogg .logg .p1d .xms .mus .dat .ldat .wma .lwma`
- *rifx*: `.wav .lwav`
- Codecs: AICA_int PCM32LE PCM24LE PCM16BE PCM16LE PCM8_U MSADPCM IMA PCMFLOAT MS_IMA AICA MPEG_custom XBOX_IMA MS_IMA_3BIT DVI_IMA L5_555 OGG_VORBIS ATRAC9 ATRAC3 MPEG MSADPCM_int
- **nwa.c**
Expand Down Expand Up @@ -425,6 +425,12 @@ different internally (encrypted, different versions, etc) and not always can be
- *wvs_xbox*: `.wvs`
- *wvs_ngc*: `.wvs`
- Codecs: XBOX_IMA NGC_DSP
- **str_sega.c**
- Sega Stream Asset Builder header [*STR_SEGA*]
- Sega Stream Asset Builder header (custom) [*STR_SEGA_custom*]
- *str_sega*: `.str`
- *str_sega_custom*: `.str`
- Codecs: AICA_int PCM8_U PCM16LE
- **dec.c**
- Falcom .DEC RIFF header [*DEC*]
- *dec*: `.dec .de2 + .(external)`
Expand All @@ -433,12 +439,6 @@ different internally (encrypted, different versions, etc) and not always can be
- Melbourne House .VS header [*VS*]
- *vs*: `.vs`
- Codecs: PSX
- **dc_str.c**
- Sega Stream Asset Builder header [*DC_STR*]
- variant of Sega Stream Asset Builder header [*DC_STR_V2*]
- *dc_str*: `.str`
- *dc_str_v2*: `.str`
- Codecs: AICA_int PCM16LE
- **xmu.c**
- Outrage XMU header [*XMU*]
- *xmu*: `.xmu`
Expand Down Expand Up @@ -1120,10 +1120,6 @@ different internally (encrypted, different versions, etc) and not always can be
- *opus_sqex*: `.wav .lwav`
- *opus_rsnd*: `.rsnd`
- Codecs: Opus
- **nxa.c**
- Entergram NXA header [*NXA*]
- *opus_nxa*: `.nxa`
- Codecs: Opus
- **pc_ast.c**
- Capcom AST (PC) header [*PC_AST*]
- *pc_ast*: `.ast`
Expand Down Expand Up @@ -1370,6 +1366,10 @@ different internally (encrypted, different versions, etc) and not always can be
- Maxis UTK header [*UTK*]
- *utk*: `.utk`
- Codecs: EA_MT
- **nxa1.c**
- Entergram NXA1 header [*NXA1*]
- *nxa1*: `.nxa`
- Codecs: Opus
- **adpcm_capcom.c**
- Capcom .ADPCM header [*ADPCM_CAPCOM*]
- *adpcm_capcom*: `.adpcm .mca`
Expand Down Expand Up @@ -1587,7 +1587,7 @@ different internally (encrypted, different versions, etc) and not always can be
- **bkhd.c**
- Audiokinetic Wwise FX header [*WWISE_FX*]
- *bkhd*: `.bnk`
- Subfiles: *wwise_bnk bkhd_fx*
- Subfiles: *wwise_bnk adm3 bkhd_fx*
- *bkhd_fx*: `.wem .bnk`
- Codecs: PCMFLOAT
- **diva.c**
Expand All @@ -1601,6 +1601,8 @@ different internally (encrypted, different versions, etc) and not always can be
- **ktsr.c**
- Koei Tecmo KTSR header [*KTSR*]
- *ktsr*: `.ktsl2asbin .asbin`
- *asrs*: `.srsa`
- *ktsr_internal*
- Subfiles: *riff ogg_vorbis ktss*
- Codecs: MSADPCM_int NGC_DSP ATRAC9
- **mups.c**
Expand Down Expand Up @@ -1739,8 +1741,8 @@ different internally (encrypted, different versions, etc) and not always can be
- **adm.c**
- Crankcase ADMx header [*ADM*]
- *adm2*: `.wem`
- *adm3*: `.wem`
- Codecs: APPLE_IMA4
- *adm3*: `.wem .bnk`
- Codecs: CRANKCASE_IMA APPLE_IMA4
- **tt_ad.c**
- Traveller's Tales AUDIO_DATA header [*TT_AD*]
- *tt_ad*: `.audio_data`
Expand Down Expand Up @@ -1791,6 +1793,10 @@ different internally (encrypted, different versions, etc) and not always can be
- **snds.c**
- Sony SNDS header [*SNDS*]
- Codecs: ATRAC9
- **nxof.c**
- Nihon Falcom FDK Opus Header [*NXOF*]
- *nxof*: `.nxopus`
- Codecs: Opus
- **scd_pcm.c**
- Lunar: Eternal Blue .PCM header [*SCD_PCM*]
- *scd_pcm*: `.pcm`
Expand Down Expand Up @@ -1844,7 +1850,7 @@ different internally (encrypted, different versions, etc) and not always can be
- *mpeg*: `.mp3 .mp2 .lmp3 .lmp2 .mus .imf .aix .(extensionless)`
- Codecs: MPEG
- **btsnd.c**
- Nintendo Wii U Menu Boot Sound [*WIIU_BTSND*]
- Nintendo Wii U Menu Boot Sound header [*BTSND*]
- *btsnd*: `.btsnd`
- Codecs: PCM16BE
- **fsb_encrypted.c**
Expand Down Expand Up @@ -1934,85 +1940,85 @@ Quick list of most codecs vgmstream supports, including many obscure ones that
are used in few games.

- PCM
- PCM 16-bit (little endian, big endian)
- PCM 8-bit (signed, unsigned, sign bit)
- PCM 4-bit (signed, unsigned)
- PCM 24-bit (little endian, big endian)
- PCM 32-bit float
- u-Law/a-LAW
- PCM 16-bit (little endian, big endian)
- PCM 8-bit (signed, unsigned, sign bit)
- PCM 4-bit (signed, unsigned)
- PCM 24-bit (little endian, big endian)
- PCM 32-bit float
- u-Law/a-LAW
- ADPCM (BRR/XA-style)
- CD-ROM XA ADPCM
- Sony PSX ADPCM a.k.a VAG (standard, badflags, configurable, extended)
- CRI ADX (standard, fixed, exponential, encrypted)
- Silicon Graphics VADPCM
- Nintendo DSP ADPCM a.k.a GC ADPCM
- Nintendo DTK ADPCM
- Nintendo AFC ADPCM
- Microsoft MSADPCM (standard, mono, Cricket Audio)
- Electronic Arts EA-XA (stereo, mono, Maxis)
- Electronic Arts EA-XAS (v0, v1)
- Konami MTAF ADPCM
- Konami MTA2 ADPCM
- FMOD FADPCM ADPCM
- Procyon Studio ADPCM
- Level-5 0x555 ADPCM
- Konami XMD ADPCM
- Argonaut ASF ADPCM
- Tantalus ADPCM
- CD-ROM XA ADPCM
- Sony PSX ADPCM a.k.a VAG (standard, badflags, configurable, extended)
- CRI ADX (standard, fixed, exponential, encrypted)
- Silicon Graphics VADPCM
- Nintendo DSP ADPCM a.k.a GC ADPCM
- Nintendo DTK ADPCM
- Nintendo AFC ADPCM
- Microsoft MSADPCM (standard, mono, Cricket Audio)
- Electronic Arts EA-XA (stereo, mono, Maxis)
- Electronic Arts EA-XAS (v0, v1)
- Konami MTAF ADPCM
- Konami MTA2 ADPCM
- FMOD FADPCM ADPCM
- Procyon Studio ADPCM
- Level-5 0x555 ADPCM
- Konami XMD ADPCM
- Argonaut ASF ADPCM
- Tantalus ADPCM
- ADPCM (IMA-style)
- DVI/IMA ADPCM (stereo/mono + high/low nibble, 3DS, Quantic Dream, SNDS, etc)
- Microsoft MS-IMA ADPCM (standard, Xbox, NDS, Radical, Wwise, FSB, WV6, etc)
- Yamaha ADPCM (AICA, Aska)
- Westwood VBR ADPCM
- OKI ADPCM (16-bit output, 4-shift, PC-FX)
- LucasArts iMUSE VBR ADPCM
- Tiger Game.com ADPCM
- DVI/IMA ADPCM (stereo/mono + high/low nibble, 3DS, Quantic Dream, SNDS, etc)
- Microsoft MS-IMA ADPCM (standard, Xbox, NDS, Radical, Wwise, FSB, WV6, etc)
- Yamaha ADPCM (AICA, Aska)
- Westwood VBR ADPCM
- OKI ADPCM (16-bit output, 4-shift, PC-FX)
- LucasArts iMUSE VBR ADPCM
- Tiger Game.com ADPCM
- ADPCM (others)
- Sony HEVAG
- Ubisoft 4/6-bit ADPCM
- Platinum ADPCM
- Paradigm MC3 ADPCM
- Ocean DSA ADPCM
- lsf ADPCM
- ITU-T G.721
- CompressWave (CWav) Huffman ADPCM
- Sony HEVAG
- Ubisoft 4/6-bit ADPCM
- Platinum ADPCM
- Paradigm MC3 ADPCM
- Ocean DSA ADPCM
- lsf ADPCM
- ITU-T G.721
- CompressWave (CWav) Huffman ADPCM
- Perceptual/transform-based
- MPEG MP1/2/3 (standard, AHX, XVAG, FSB, AWC, P3D, EA, etc)
- Xiph Vorbis (Ogg, FSB, Wwise, OGL, Silicon Knights)
- CRI HCA
- ITU-T G.722.1 annex C a.k.a. Polycom Siren 14 (Namco)
- ITU-T G.719 annex B a.k.a. Polycom Siren 22
- Xiph Opus (Ogg, Switch, EA, UE4, Exient, FSB)
- Xiph CELT (FSB)
- Microsoft XMA1/2
- Microsoft WMA v1, WMA v2, WMAPro
- AAC
- Sony ATRAC3
- Sony ATRAC3plus
- Sony ATRAC9
- Relic Codec
- tri-Ace PS2 Codec
- Bink
- AC3/SPDIF
- Musepack
- Electronic Arts EASpeex
- Electronic Arts EALayer3
- Electronic Arts EA-XMA
- Electronic Arts MicroTalk a.k.a. UTK or UMT
- Inti Creates DCT codec
- Circus XPCM VQ
- MPEG MP1/2/3 (standard, AHX, XVAG, FSB, AWC, P3D, EA, etc)
- Xiph Vorbis (Ogg, FSB, Wwise, OGL, Silicon Knights)
- CRI HCA
- ITU-T G.722.1 annex C a.k.a. Polycom Siren 14 (Namco)
- ITU-T G.719 annex B a.k.a. Polycom Siren 22
- Xiph Opus (Ogg, Switch, EA, UE4, Exient, FSB)
- Xiph CELT (FSB)
- Microsoft XMA1/2
- Microsoft WMA v1, WMA v2, WMAPro
- AAC
- Sony ATRAC3
- Sony ATRAC3plus
- Sony ATRAC9
- Relic Codec
- tri-Ace PS2 Codec
- Bink
- AC3/SPDIF
- Musepack
- Electronic Arts EASpeex
- Electronic Arts EALayer3
- Electronic Arts EA-XMA
- Electronic Arts MicroTalk a.k.a. UTK or UMT
- Inti Creates DCT codec
- Circus XPCM VQ
- Misc
- SDX2 2:1 Squareroot-Delta-Exact compression DPCM
- CBD2 2:1 Cuberoot-Delta-Exact compression DPCM
- Activision EXAKT SASSC DPCM
- Xilam DERF DPCM
- Circus XPCM DPCM
- VisualArt's NWA PCM/DPCM
- Marble WADY PCM/DPCM
- InterPlay ACM
- Inti Creates Range codec
- FLAC
- Others
- SDX2 2:1 Squareroot-Delta-Exact compression DPCM
- CBD2 2:1 Cuberoot-Delta-Exact compression DPCM
- Activision EXAKT SASSC DPCM
- Xilam DERF DPCM
- Circus XPCM DPCM
- VisualArt's NWA PCM/DPCM
- Marble WADY PCM/DPCM
- InterPlay ACM
- Inti Creates Range codec
- FLAC
- Others

Sometimes standard codecs come in non-standard layouts that aren't normally
supported by other players (like multiple `.ogg` or `.mp3` files chunked and
Expand All @@ -2024,4 +2030,4 @@ proper support of encoder delay, accurate sample counts and seeking that other
plugins may lack.

Note that vgmstream doesn't (can't) reproduce in-game music 1:1, as internal
resampling, filters, volume, etc, are not replicated.
resampling, filters, volume, etc, are not replicated.
6 changes: 5 additions & 1 deletion doc/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,10 @@ willow.mpf: willow.mus,willow_o.mus
bgm_2_streamfiles.awb: bgm_2.acb
```
```
# hashes of SE1_Common_BGM + ext [Hyrule Warriors: Age of Calamity (Switch)]
0x3a160928.srsa: 0x272c6efb.srsa
```
```
# Snack World (Switch) names for .awb (single .acb for all .awb, order matters)
bgm.awb: bgm.acb
bgm_DLC1.awb: bgm.acb
Expand Down Expand Up @@ -639,7 +643,7 @@ called to play one or multiple audio "waves"/"materials" in another section.
Rather than handling cues, vgmstream shows and plays waves, then assigns cue names
that point to the wave if possible, since vgmstream mainly deals with streamed/wave
audio and simulating cues is out of scope. Figuring out a whole cue format can be a
*huge* time investment, so handling waves only is often enough.
*huge* time investment, so handling waves only is good enough.

Cues can be *very* complex, like N cues pointing to 1 wave with varying pitch, or
1 cue playing one random wave out of 3. Sometimes not all waves are referenced by
Expand Down
11 changes: 10 additions & 1 deletion src/base/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ int decode_get_samples_per_frame(VGMSTREAM* vgmstream) {
case coding_XBOX_IMA_int:
case coding_FSB_IMA:
case coding_WWISE_IMA:
case coding_CD_IMA:
case coding_CD_IMA: /* (0x24 - 0x04) * 2 */
case coding_CRANKCASE_IMA: /* (0x23 - 0x3) * 2 */
return 64;
case coding_APPLE_IMA4:
return 64;
Expand Down Expand Up @@ -654,6 +655,8 @@ int decode_get_frame_size(VGMSTREAM* vgmstream) {
case coding_WWISE_IMA:
case coding_CD_IMA:
return 0x24;
case coding_CRANKCASE_IMA:
return 0x23;
case coding_XBOX_IMA_mch:
case coding_FSB_IMA:
return 0x24 * vgmstream->channels;
Expand Down Expand Up @@ -1264,6 +1267,12 @@ void decode_vgmstream(VGMSTREAM* vgmstream, int samples_written, int samples_to_
vgmstream->channels, vgmstream->samples_into_block, samples_to_do);
}
break;
case coding_CRANKCASE_IMA:
for (ch = 0; ch < vgmstream->channels; ch++) {
decode_crankcase_ima(&vgmstream->ch[ch], buffer+ch,
vgmstream->channels, vgmstream->samples_into_block, samples_to_do);
}
break;

case coding_WS:
for (ch = 0; ch < vgmstream->channels; ch++) {
Expand Down
Loading

0 comments on commit 2a80427

Please sign in to comment.