Skip to content

Commit 00ae60f

Browse files
authored
Merge pull request #134 from RagnarokResearchLab/adpcm-stream-length
Clarify the ADP stream length with an example
2 parents 808836b + a4cf5bd commit 00ae60f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

docs/arcturus/ADP.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,17 @@ How many channels can be found in the ADPCM-encoded audio stream. Always `2` (fo
4141
4242
#### AudioStreamSizeInBytes
4343
44-
How many bytes can be extracted from the ADPCM-encoded audio stream. Represents the distance until `EOF`.
44+
How many samples can be extracted from the ADPCM-encoded audio stream per channel. Here's an example:
45+
46+
- File: `002.adp`
47+
- `NumInterleavedAudioChannels`: 2
48+
- `AudioStreamSizeInBytes`: `5,232,022` bytes (hexadecimal: `96 D5 4F 00`)
49+
- Total file size: `2,616,027` bytes
50+
- ADPCM stream length: `2,616,027 - 16 = 2,616,011` (subtract `StartingOffset`)
51+
- Distance to end of file: `AudioStreamSizeInBytes / NumInterleavedAudioChannels = 5,232,022 / 2 = 2,616,011`
52+
- Space needed to store the result: `AudioStreamSizeInBytes` per channel (`sizeof(int16_t) = 2` bytes per sample)
53+
54+
The entire stream will have been consumed once you extract `2,616,011` bytes. There should be no leftover bytes.
4555
4656
#### Compressed Audio Stream
4757

0 commit comments

Comments
 (0)