ported update_bgm to python

This commit is contained in:
argoneus 2020-04-23 21:44:50 +02:00
parent 404de87624
commit cb0a4d8bf6
2 changed files with 53 additions and 15 deletions

View file

@ -74,7 +74,7 @@ class adx_file(object):
self.encrypted = self.get_val(CRYPT_OFF, CRYPT_LEN)
self.d_offset = self.get_val(DATA_OFF_OFF, DATA_OFF_LEN)
if self.d_offset < DATA_OFF_MIN:
return None
return
self.l_exists = 1
# now load things for math
self.sam_rate = self.get_val(SRATE_OFF, SRATE_LEN)
@ -106,13 +106,11 @@ class adx_file(object):
return None
if self.l_start > self.sam_count or self.l_end > self.sam_count:
raise ValueError("Invalid Loop Data")
return None
if self.l_style not in LOOP_TYPE_SUP:
raise NotImplementedError(
"Loop Style {} Not Implemented".format(str(self.l_style))
)
return None
ret = {}
ret = dict()
ret["duration"] = self.sam_count / self.sam_rate
ret["loop_start"] = {}
ret["loop_start"]["seconds"] = self.l_start / self.sam_rate
@ -123,7 +121,5 @@ class adx_file(object):
ret["loop_end"] = {}
ret["loop_end"]["seconds"] = self.l_end / self.sam_rate
ret["loop_end"]["samples_native"] = self.l_end
ret["loop_end"]["samples_48k"] = dumb_round(
self.l_end / self.sam_rate * 48000
)
ret["loop_end"]["samples_48k"] = dumb_round(self.l_end / self.sam_rate * 48000)
return ret