Commit efd3741
Bri
Add automatic WAV file splitting at 4GB limit
Implements seamless multi-part WAV file splitting to prevent corruption
when recordings exceed the 4GB RIFF format limit.
Features:
- Automatic detection when file approaches 4GB (~3.7GB safety threshold)
- Seamless splitting with zero audio data loss
- Multi-part file naming: file.wav, file_part2.wav, file_part3.wav, etc.
- Each part is a complete, valid WAV file with proper headers
- Files can be concatenated in any audio editor for frame-perfect stitching
Implementation details:
- Added MAX_FILE_SIZE constant (4,000,000,000 bytes)
- Track file part number and total data size across parts
- Parse and store base filename on Open() for multi-part naming
- Check file size before each WriteData() call
- If would exceed limit, call SplitToNextFile() first
- SplitToNextFile() finalizes current file and opens new part
- Reset per-file data size, increment part number
- Transparent to CaptureManager - no changes needed upstream
Technical notes:
- Conservative 3.7GB limit prevents any risk of corruption
- Accounts for WAV header overhead in size calculation
- Each file independently playable with correct duration
- Total recording time unlimited across multiple parts1 parent ae5645e commit efd3741
2 files changed
Lines changed: 68 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| 37 | + | |
34 | 38 | | |
35 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
36 | 42 | | |
37 | 43 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
22 | 36 | | |
23 | 37 | | |
24 | 38 | | |
| |||
47 | 61 | | |
48 | 62 | | |
49 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
50 | 76 | | |
51 | 77 | | |
| 78 | + | |
52 | 79 | | |
53 | 80 | | |
54 | 81 | | |
55 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
56 | 117 | | |
57 | 118 | | |
58 | 119 | | |
| |||
0 commit comments