Fixed crash when getting the length of an ogg file, fixed mispositioning of message in Hall of Fame, fixedMusic Vlume option not applying to newly played BGM,

This commit is contained in:
Maruno17
2021-05-01 17:13:27 +01:00
parent 748ea472ba
commit f29da5fc8f
5 changed files with 7 additions and 9 deletions

View File

@@ -25,9 +25,9 @@ def getOggPage(file)
return nil if dw != 0x5367674F
header = file.read(22)
bodysize = 0
hdrbodysize = (file.read(1)[0] rescue 0)
hdrbodysize = (file.read(1)[0].ord rescue 0)
hdrbodysize.times do
bodysize += (file.read(1)[0] rescue 0)
bodysize += (file.read(1)[0].ord rescue 0)
end
ret = [header, file.pos, bodysize, file.pos + bodysize]
return ret
@@ -69,7 +69,7 @@ def oggfiletime(file)
if serial != curserial
curserial = serial
file.pos = page[1]
packtype = (file.read(1)[0] rescue 0)
packtype = (file.read(1)[0].ord rescue 0)
string = file.read(6)
return -1 if string != "vorbis"
return -1 if packtype != 1
@@ -82,9 +82,9 @@ def oggfiletime(file)
end
ret = 0.0
for i in 0...pcmlengths.length
ret += pcmlengths[i].to_f / rates[i]
ret += pcmlengths[i].to_f / rates[i].to_f
end
return ret
return ret * 256.0
end
# Gets the length of an audio file in seconds. Supports WAV, MP3, and OGG files.