Skip to content

Commit 4faf408

Browse files
authored
Update GDScriptAudioImport.gd
Add support for wav files with data bytes starting from 100+ bytes
1 parent 96d85a7 commit 4faf408

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

GDScriptAudioImport.gd

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ func loadfile(filepath):
6464
#parrrrseeeeee!!! :D
6565

6666
var bits_per_sample = 0
67-
68-
for i in range(0, 100):
67+
var i = 0
68+
while true:
6969
var those4bytes = str(char(bytes[i])+char(bytes[i+1])+char(bytes[i+2])+char(bytes[i+3]))
7070

7171
if those4bytes == "RIFF":
@@ -136,6 +136,10 @@ func loadfile(filepath):
136136
newstream.data = convert_to_16bit(data, bits_per_sample)
137137
else:
138138
newstream.data = data
139+
140+
break # the data will be at the end, end searching here
141+
142+
i += 1
139143
# end of parsing
140144
#---------------------------
141145

0 commit comments

Comments
 (0)