XSD Issue - Cannot link Automation Device Index to Track Device

Bit of background, I’m currently writing a converter from Renoise to our PC 64k Synth called Wavesabre. Made really good progress so far converting pattern data to midi events and so on. I’m using RenoiseSong63.xsd which I put through xsd.exe to produce a C# class file so I can quickly and easilty deserialize the song file into objects. However there is a bit of a blocking issue. It seems using this method, automations cannot be linked to the correct device on the track.

So, starting at the actual automation data in the XML, you can see this related to DeviceIndex 1 / ParamIndex 1.

<Envelope>
  <DeviceIndex>1</DeviceIndex>
  <ParameterIndex>1</ParameterIndex>
  <Envelope>
	<PlayMode>Linear</PlayMode>
	<Length>16384</Length>
	<ValueQuantum>0.0</ValueQuantum>
	<Polarity>Unipolar</Polarity>
	<Points>
	  <Point>0,0.545454562</Point>
	  <Point>2048,0.545454562</Point>
	  <Point>2304,0.159090906</Point>
	  <Point>7936,0.170454547</Point>
	  <Point>8192,0.715909064</Point>
	  <Point>16383,0.0</Point>
	</Points>
  </Envelope>

On the track, the devices are listed in order…

<Devices>
  <TrackMixerDevice type="TrackMixerDevice">
  <AudioPluginDevice type="AudioPluginDevice">
  <InstrumentAutomationDevice type="InstrumentAutomationDevice">
</Devices>

So we know that the above automation goes to param 1 on the AudioPluginDevice. However this index is only ever inferred in the XML, when it gets deserialized, the index is lost. Instead you end with devices grouped by type.

7363 deva.png

Is this the fault of the XSD or the class file that has been generated for it? and does anyone know how I can change it so that I can get devices indexed.

This also appears to be an issue with some other object collections, like the tracks for example.

Any help would be greatly appreciated.

Any help would be greatly appreciated.

Not sure how much I can be of help here - I don’t have any experience with the xsd.exe that you mention.

And obviously, Renoise relies on that the devices are parsed/processed in a specific order - different than xsd.

But one idea came to mind: since you already have access to the schema and song.xml, perhaps you could manipulate the properties in a way that would “satisfy” xsd?

Thanks for the reply pal. I managed to crack it in the end. I added wrapped each of the sections I needed indexed in xs:choice in the XSD and that changes them to a list of items in the correctly indexed order. They end up being a list of generic object types but can easily be cast back into the type they need to be.

#winning :slight_smile: