Created
February 8, 2022 22:13
-
-
Save mwicat/4037e364d622c9ce396a4cd9948917aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gzip | |
import os | |
import re | |
import xml.etree.cElementTree as etree | |
from ctypes import * | |
VstInt32 = c_int32.__ctype_be__ | |
VstFloat = c_float.__ctype_be__ | |
class fxProgram_content_data(Structure): | |
_fields_ = [ | |
("size", VstInt32), | |
] | |
class fxProgram_content(Union): | |
_fields_ = [ | |
("data", fxProgram_content_data), | |
] | |
class fxProgram(Structure): | |
_fields_ = [ | |
("chunkMagic", VstInt32), | |
("byteSize", VstInt32), | |
("fxMagic", VstInt32), | |
("version", VstInt32), | |
("fxID", VstInt32), | |
("fxVersion", VstInt32), | |
("numParams", VstInt32), | |
("prgName", c_char*28), | |
("content", fxProgram_content), | |
] | |
class fxBank_content_data(Structure): | |
_fields_ = [ | |
("size", VstInt32), | |
] | |
class fxBank_content(Union): | |
_fields_ = [ | |
("programs", fxProgram), | |
("data", fxBank_content_data), | |
] | |
class fxBank(Structure): | |
_fields_ = [ | |
("chunkMagic", VstInt32), | |
("byteSize", VstInt32), | |
("fxMagic", VstInt32), | |
("version", VstInt32), | |
("fxID", VstInt32), | |
("fxVersion", VstInt32), | |
("numPrograms", VstInt32), | |
("currentProgram", VstInt32), | |
("future", c_char*124), | |
("content", fxBank_content), | |
] | |
fname = os.path.expanduser('~/tmp/blackhole_marek.fxp') | |
f = open(fname, 'rb') | |
buf = bytearray(f.read()) | |
prog = fxProgram.from_buffer(buf) | |
chunk = (c_char * prog.content.data.size).from_buffer(buf, sizeof(prog)) | |
print(chunk.value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment