Useful (?) change to Design Tool import / export format

h4yn0nnym0u5e

Well-known member
Hi folks

I've made a comparatively minor change to the Design Tool, which is to export the AudioConnection initialisers in the braced form, rather than bracketed, i.e.:

C++:
    AudioConnection          patchCord1(wav, env);
// is now exported as:
    AudioConnection          patchCord1{wav, env};
This looks fairly trivial, but means that the exported definitions can be directly wrapped into a class, for example:
C++:
class Voice
{
  public:

    // Copied straight from the Design Tool export,
    // with just one line commented out:

    // GUItool: begin automatically generated code
    AudioSynthWaveform       wav;      //xy=303,404
    //AudioInputI2S i2s1;   //xy=353,290 not needed, except to allow export from Design Tool
    AudioEffectEnvelope      env;      //xy=449,401

    AudioConnection          patchCord1{wav, env};
    // GUItool: end automatically generated code
};
The bracketed form to initialise patchCord1 gives an error at compile time... You'll note that the Design Tool insists on having an input or output object in order to allow the export, which in this case I've commented out after importing to the Arduino IDE; if you un-comment that line and re-import the automatically generated code, you can edit the design, re-export it into the class declaration, re-comment the line, and your new topology is now available in the Voice class.

The above is obviously a trivial example, but makes it much easier to maintain a complex polyphonic synth, because you don't have to edit dozens of objects and connections if you want to make a change. "One-off" objects like global LFOs, output mixers, effects and hardware input / output (e.g. I²S or TDM) would of course be dealt with separately.

You can find the updated code at https://github.com/h4yn0nnym0u5e/Audio/tree/feature/braced-patchcords, which also includes a new example PlaySynthMusic-class, which replicates the functionality of PlaySynthMusic but using the above approach. The updated Design Tool is in Audio/gui/index.html, you will of course have to use this rather than the on-line one to get the updated export format.

Please report back on this thread if you try this and like it, or have questions or issues. If reports are favourable I'll make a PR for it.
 
Back
Top