Renoise api questions

Hi,

I am confused about how I should access the pre- and also post-pannings and -volumes via lua. track:device(1) seems to be not always a “TrackVolPan” device, also the last one (track:device(#track.devices)) neither always is a “SendTrackVolPan” device…

What am I am doing wrong here?

1 Like

ok, found it with track.postfx_panning and track.postfx_volume etc.

Next question:

Is there an easy way to convert the CDATA saved in ParameterChunk into binary data?

… Is it just an base64 encoded string after the “<![CDATA[” ?

Ah yes.

Are there builtin zippy functions?

Nope!

1 Like

I am using this xml library: GitHub - manoelcampos/xml2lua: XML Parser written entirely in Lua that works for Lua 5.1+. Convert XML to and from Lua Tables 🌖💱

Trying to create such a structure:

<Devices>
  <Vst2Plugin />
  <Vst3Plugin />
  <Vst2Plugin />
</Devices>

What would be the table representation for this?
maybe the lib isn’t capable for this?

Try yourself:

local objects = {}
objects[#objects + 1] = {
        Vst2Plugin = {}
}
objects[#objects + 1] = {
        Vst3Plugin = {}
}
objects[#objects + 1] = {
        Vst2Plugin = {}
}
local xml2lua = require("xml2lua")
oprint(xml2lua.toXml({ Devices = objects }))

It gives me:

<Devices>
  <Vst2Plugin />
</Devices>
<Devices>
  <Vst3Plugin />
</Devices>
<Devices>
  <Vst2Plugin />
</Devices>

Not an answer (sorry), but is there a reason you’re not using Renoise’s native Document API?

It has no support for attributes AFAIK.

I am using now an ugly workaround:

xmlString = string.gsub(xmlString, "</Devices>([ \t\r\n]+)<Devices>", "")

I wonder if these mixed types of nodes actually break the XML standard… I tried now the opposite way, the library can back convert it, but then it’s not possible to keep the actual node order. Seems to be a flaw in the current dawproject definition. Do you think such mixed node types are standard in XML?

1 Like

Internal zippy functionality would be indeed very nice… Since Renoise itself certainly uses ZIP for multiple purposes. This would save io.exec calls to system os specific zippy tools…

Is there a way to save an instrument as xrni via api? Can’t find… aaah Application - Renoise Scripting

I don’t think there’s anything wrong with how Renoise uses XML. But the Document functions do appear to have limitations—which is understandable if a bit frustrating, as they’re not intended to be a full XML serializer library.