Reply To: panel construction problematic

Home Forums General Panels, Components, Macros panel construction problematic Reply To: panel construction problematic

  • Topics: 80
  • Replies: 793
  • Total: 873
  • ★★★

Why is a problem writing a byte to a file? Just work with a memoryBlock and then save it to a file, this is how I do it:

patchData = MemoryBlock() -- create the memory block
patchData :createFromTable({0xF0, 0x00, 0x20, 0x33...}) -- fill it with a init patch
-- write data to the memoryblock
a = panel:getModulatorByIndex(46):getValue() -- get 1 byte of data from a mod
patchData :setByte(14,a) -- write it to the memoryblock

-- save the file
f = utils.saveFileWindow ("Save Patch", File(""), "*.syx", true) - ask for file
f:create() -- create file
if f:existsAsFile() then
f:replaceWithData(patchData) -- put the memoryblock on the file