Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Audio Library PatchConnections conflict?

  1. #1

    Audio Library PatchConnections conflict?

    Hey everyone,

    i didnt come up with a better title, so pleaso excuse me if the topic, maybe, is not directly related to the title name!!

    So i´m working on my "TeensyTouchDAW" which consists of an 8 Track sequencer with various built in "Audio-Plugins".
    Beside the sequencer functions, it is meant that users can easily add their own plugins to the environment.
    Everything is working so far and i´m at a stage to minimize the work needed to add plugins.

    As i already have various "plugins" implemented, the Audio Design-Tool GUI is getting quite big (226nodes and 282patchcords) and i would like to somehow seperate each "plugin" in the Audio Design-Tool GUI.
    Like for every "plugin" i open an empty Audio Design-Tool page, but then the Patchcords would be in conflict as each Plugin would start over with AudioConnection patchCord1().

    So is there a way to avoid this conflict??
    (Optional question, is it possible to assign (new) patchcords within the code?)
    TIA Stefan
    The most recent infos can be found on Discord:
    https://discord.gg/N78atDz9bC

    Most recent project files can be found on Github:
    https://github.com/steven-law/Teensy-DAW

    Most recent videos can be found here:
    https://www.youtube.com/@stefandegu5150

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,497
    Short answer: If you can draw it you can program it
    If you use the GUI to connect parts of your system, you can simply rename modules and connections.
    The GUI is only for facilitating the module class name search, but the back-end is agnostic to the GUI output.

  3. #3
    Thank you for your answer
    I once tried to program a patchchord within code while running but it didnt work.

    To my collision issue. since hopefully many poeple will contribute their own plugins, the contributer had to look what patchchords are free and rename his chords.
    That is something i wanted to avoid. In fact i would liked have it done automatically, to a certain degree.
    Maybe someone has done somthing similar

  4. #4
    Senior Member manicksan's Avatar
    Join Date
    Jun 2020
    Location
    Sweden
    Posts
    613
    you can "wrap" each exported "design code" into different namespaces

    Code:
    namespace Plugin1
    {
      // Audio Processing Nodes
      AudioSynthWaveform              waveform; //xy=131,175
      AudioSynthWaveformDc            dc; //xy=136,233
      AudioSynthWaveformPWM           pwm; //xy=154,292
      AudioSynthToneSweep             tonesweep; //xy=173,351
      AudioMixer4                     mixer4; //xy=438,206
    
      // Audio Connections (all connections (aka wires or links))
      AudioConnection        patchCord1(waveform, 0, mixer4, 0);
      AudioConnection        patchCord2(dc, 0, mixer4, 1);
      AudioConnection        patchCord3(pwm, 0, mixer4, 2);
      AudioConnection        patchCord4(tonesweep, 0, mixer4, 3);
    }
    
    namespace Plugin2
    {
      // Audio Processing Nodes
      AudioSynthWaveform              waveform; //xy=165,150
      AudioSynthWaveformDc            dc; //xy=170,208
      AudioSynthSimpleDrum            drum; //xy=180,257
      AudioSynthKarplusStrong         string; //xy=198,311
      AudioMixer4                     mixer4; //xy=472,181
    
      // Audio Connections (all connections (aka wires or links))
      AudioConnection        patchCord1(waveform, 0, mixer4, 0);
      AudioConnection        patchCord2(dc, 0, mixer4, 1);
      AudioConnection        patchCord3(drum, 0, mixer4, 2);
      AudioConnection        patchCord4(string, 0, mixer4, 3);
    }
    
    // "Main design code" here
    AudioMixer4               mixer4;
    AudioOutputI2S          i2s
    AudioConnection        patchCord1(Plugin1::mixer4, 0, mixer4, 0);
    AudioConnection        patchCord2(Plugin2::mixer4, 0, mixer4, 1);
    AudioConnection        patchCord3(mixer4, 0, i2s, 0);
    AudioConnection        patchCord4(mixer4, 0, i2s, 1);
    accessing functions like this:
    Code:
    setup()
    {
      Plugin1::waveform.begin(WAVEFORM_SINE);
      Plugin2::waveform.begin(WAVEFORM_SINE);
    }
    you could also put the different "plugins" into different .h files
    then the "main design code" would look like this:
    Code:
    #include "Plugin1.h"
    #include "Plugin2.h"
    
    AudioMixer4               mixer4;
    AudioOutputI2S          i2s
    AudioConnection        patchCord1(Plugin1::mixer4, 0, mixer4, 0);
    AudioConnection        patchCord2(Plugin2::mixer4, 0, mixer4, 1);
    AudioConnection        patchCord3(mixer4, 0, i2s, 0);
    AudioConnection        patchCord4(mixer4, 0, i2s, 1);
    in either case make sure that the "plugin design code" are before the "main design code"


    otherwise I could recommend my version of the design tool
    where dealing with huge designs is not a PITA
    https://manicken.github.io
    info:
    https://forum.pjrc.com/threads/65740...gn-Tool-update

  5. #5
    Wow thank you for your answer
    i will def try the namespaces

    To your plugin. I´m not using the Audio design tool from pjrc, but the one from "Newdigate"
    https://newdigate.github.io/teensy-eurorack-audio-gui/
    as this one has the variable playback function, i need to chromatically play raw files from sd card (and maybe the compressors in the future).
    Is it somehow possible to merge newdigates "nodes" to your GUI.

    BTW your GUI looks massive, i need to dig into

    Thanks for your reply

  6. #6
    Senior Member manicksan's Avatar
    Join Date
    Jun 2020
    Location
    Sweden
    Posts
    613
    Quote Originally Posted by degu234 View Post
    Is it somehow possible to merge newdigates "nodes" to your GUI.
    Yes:

    1. I can add them permanent (in the tool++ I sort all "node types" in named "categories", where I can tag the creator)

    it looks something like this:
    Code:
    {
        "label": "Newdigate",
        "description": "Newdigate Library",
        "url": "https://raw.githubusercontent.com/newdigate/teensy-eurorack-audio-gui/main/index.html",
        "credits": "Nic Newdigate",
        "homepage": "https://github.com/newdigate",
        "types": {
           "AudioPlaySdResmp":{<def_fields>},
           "AudioEffectDynamics":{<def_fields>}
           ... and so on
        }
    }
    2. import the newdigate index.html into the Tool++
    by the following url:

    https://raw.githubusercontent.com/ne...ain/index.html

    and using the Tool++ def mgr

    to avoid repeating myself user guide is here:
    https://forum.pjrc.com/threads/65740...l=1#post277457

    scroll down to
    How to use import from URL dialog (and how it works)
    if you don't want to read the "advanced" stuff

  7. #7
    Digging into all this new info´s, i need some time to get that in my head
    I already think i know the answer, but i´m asking anyway (sorry Tristan if you read this ;P)
    Would it be possible to point somehow to the different namespaces?

    "tristan" would do adding new plugins within classes, tho i´m not confident with them i also look for "other methods" (that may get easier into my head )

  8. #8
    @manicksan
    maybe you can help me, i would like to export this project into seperate classes (or whatever)
    when i press export it shows me the plugins but not the big mixer and fx matrix.
    what did i do wrong?
    https://drive.google.com/open?id=191...m&usp=drive_fs
    TIA

  9. #9
    Senior Member manicksan's Avatar
    Join Date
    Jun 2020
    Location
    Sweden
    Posts
    613
    1. checking "C++ Main File" currently only allow code to be exported and not any AudioObjects that have IO
    this is for good reasons to keep the exported code well structured
    and also keeping the "main" separated from the Design code

    1b. if you don't want the background info you can skip to 3.

    2. because I have the following code that checks which tabs to be exported or not
    Code:
    for loop {
      if (!ws.export) continue; // this skip export of tab
      if (RED.nodes.getNodeInstancesOfType(ws.label).length == 0 && ws.isMain == false && ws.isAudioMain == false) continue; // don't export classes/tabs not in use
      ....
    }
    note. the isMain have other checks that filters out AudioObjects and other nodetypes not "supported"/wanted in the "main c++ file"

    the check:
    "RED.nodes.getNodeInstancesOfType(ws.label).le ngth == 0"
    will only export instantiated classes/tabs

    the workaround would be to only check the "Audio Main" @ your Main-tab
    this will force export the tab
    but....

    3. I have now updated the tool to always export all activated/enabled tabs

    + added a setting @ Teensy/C++ - Export - Export Instanced Tabs Only
    that can be enabled if anyone still want that functionality

    + changed the popup note for the Audio Main checkbox
    to include the force export note

    4. there is not any use for the TAB-inputs in your "Main"
    unless you are planning to have a additional tab acting as the "super main"

    5. how are you exporting your code?
    if not by zip and only class export then Main should be at the end


    sidenote. it is possible to code directly in the tool to take care of plugin specific things


    I did notice a bug while trying to export my own example project
    this will not affect your current design, but can be worth to note.
    it will be fixed ASAP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •