Commit 8574937b authored by W. Trevor King's avatar W. Trevor King
Browse files

Store wave, bin_info, and wave_info separately in WaveRecord.

This makes more sense than storing them as a tuple.

Also, use wave_record.wave_info['bname'] as the name for storing the
wave in the filesystem view returned by packed.load.
parent 6c2c99bb
......@@ -117,13 +117,17 @@ def load(filename, strict=True, ignore_unknown=True):
elif isinstance(record, (_VariablesRecord, _WaveRecord)):
if isinstance(record, _VariablesRecord):
filename = ':variables' # start with an invalid character
else: # to avoid collisions with folder
filename = ':waves' # names
# start with an invalid character to avoid collisions
# with folder names
filename = ':variables'
filename = ''.join(c for c in record.wave_info['bname']
).split('\x00', 1)[0]
if filename in cwd:
raise ValueError('collision on name {} in {}'.format(
filename, ':'.join(d for d,cwd in dir_stack)))
cwd[filename] = [record]
cwd[filename] = record
return (records, filesystem)
......@@ -9,7 +9,8 @@ from . import Record
class WaveRecord (Record):
def __init__(self, *args, **kwargs):
super(WaveRecord, self).__init__(*args, **kwargs)
self.wave = _loadibw(_BytesIO(bytes(, strict=False)
self.wave,self.bin_info,self.wave_info = _loadibw(
_BytesIO(bytes(, strict=False)
def __str__(self):
return str(self.wave)
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment