Skip to content

Commit

Permalink
- added clean Dsp folder dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph-hart committed Jul 23, 2024
1 parent af68f78 commit a8830db
Show file tree
Hide file tree
Showing 8 changed files with 502 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
Content.makeFrontInterface(700, 650);

const var mp = Content.addMultipageDialog("mp", 0, 0);

mp.set("text", "Clean DSP network files");
mp.set("width", 700);
mp.set("height", 650);
mp.set("Font", "Lato");
mp.set("FontSize", 19);

mp.set("DialogWidth", 700);
mp.set("DialogHeight", 650);

const var fp = mp.addPage();

mp.add(fp, mp.types.MarkdownText, { Text: "This tool will cleanup code files from Faust / SNEX or external C++ files. Please select the file types you want to clean:" });

mp.setElementProperty(fp, mp.ids.Style, "gap: 15px; margin: 0px 40px;");


mp.add(fp, mp.types.Button, { ID: "CleanSNEX", Text: "SNEX Files", NoLabel: true});
mp.add(fp, mp.types.Button, { ID: "CleanFaust", Text: "Faust Files", NoLabel: true});
mp.add(fp, mp.types.Button, { ID: "CleanCpp", Text: "C++ Files", NoLabel: true});
mp.add(fp, mp.types.Button, { ID: "CleanNetworks", Text: "Scriptnode networks", NoLabel: true});

mp.add(fp, mp.types.JavascriptFunction, { EventTrigger: "OnSubmit", Code: "state.SkipSNEX = !state.CleanSNEX;"});

mp.add(fp, mp.types.MarkdownText, { Text: "Click next to select the files you want to delete in the next step." });


var listIds = {};

function setItems(id, state)
{
var list = [];

var networkRoot = FileSystem.getFolder(FileSystem.AudioFiles).getParentDirectory().getChildFile("DspNetworks");



var rootDir;
var wildcard = "*";

if(id == "setItemNetworks")
{
rootDir = networkRoot.getChildFile("Networks");
}
if(id == "setItemSNEX")
{
rootDir = networkRoot.getChildFile("CodeLibrary/faust");
}
if(id == "setItemFaust")
{
rootDir = networkRoot.getChildFile("CodeLibrary/faust");
}
if(id == "setItemCpp")
{
rootDir = networkRoot.getChildFile("ThirdParty");
wildcard = "*.h";
}

var fileList = FileSystem.findFiles(rootDir, wildcard, false);

for(f in fileList)
{
list.push(f.toString(3));
}

mp.setElementProperty(listIds[id], "Items", list);

}

function clearFunction(id)
{
var x = mp.getState()[id.replace("clear", "list")];

Console.print("DELETE: " + trace(x));
}

inline function addPage(id)
{
local p = mp.addPage();

mp.add(p, mp.types.MarkdownText, { Text: "**Cleaning " + id + " files**\n---\nPlease select the files you want to delete, then press Next to perform the operation."});

mp.add(p, mp.types.JavascriptFunction, { "ID": "setItem" + id, Code: mp.bindCallback("setItems", setItems, SyncNotification)});

local tl = mp.add(p, mp.types.TagList, { ID: "list" + id, Text: "Files", Items: ""});

mp.add(p, mp.types.Skip, { "ID": "Clean" + id, SkipIfTrue: true });

listIds["setItem" + id] = tl;
listIds["clear" + id] = tl;



mp.add(p, mp.types.MarkdownText, { Text: "\n---\n> This is not undoable so proceed with caution!"});

mp.add(p, mp.types.JavascriptFunction, { ID: "clear" + id, EventTrigger: "OnSubmit", Code: mp.bindCallback("clearFile", clearFunction, AsyncNotification)});

return p;
}


addPage("SNEX");
addPage("Faust");
addPage("Cpp");
addPage("Networks");

const var outro = mp.addPage();




mp.add(outro, mp.types.MarkdownText, { Text: "Press Finish to close the tool" });

mp.show(true);


function onNoteOn()
{
local s = mp.exportAsMonolith("");
Console.print(s);

}
function onNoteOff()
{

}
function onController()
{

}
function onTimer()
{

}
function onControl(number, value)
{

}

39 changes: 39 additions & 0 deletions extras/hise_dialogs/XmlPresetBackups/CleanDspNetworkFiles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>

<Processor Type="SynthChain" ID="CleanDspNetworkFiles" Bypassed="0" Gain="1.0"
Balance="0.0" VoiceLimit="64.0" KillFadeTime="20.0" IconColour="0"
packageName="" BuildVersion="650">
<ChildProcessors>
<Processor Type="MidiProcessorChain" ID="Midi Processor" Bypassed="0">
<ChildProcessors>
<Processor Type="ScriptProcessor" ID="Interface" Bypassed="0">
<ChildProcessors/>
<Content/>
<UIData Source="CleanDspNetworkFilesUIData"/>
</Processor>
</ChildProcessors>
</Processor>
<Processor Type="ModulatorChain" ID="GainModulation" Bypassed="0" Intensity="1.0">
<ChildProcessors/>
</Processor>
<Processor Type="ModulatorChain" ID="PitchModulation" Bypassed="1" Intensity="0.0">
<ChildProcessors/>
</Processor>
<Processor Type="EffectChain" ID="FX" Bypassed="0">
<ChildProcessors/>
</Processor>
</ChildProcessors>
<RoutingMatrix NumSourceChannels="2" Channel0="0" Send0="-1" Channel1="1" Send1="-1"/>
<macro_controls>
<macro name="Macro 1" value="0.0" midi_cc="-1"/>
<macro name="Macro 2" value="0.0" midi_cc="-1"/>
<macro name="Macro 3" value="0.0" midi_cc="-1"/>
<macro name="Macro 4" value="0.0" midi_cc="-1"/>
<macro name="Macro 5" value="0.0" midi_cc="-1"/>
<macro name="Macro 6" value="0.0" midi_cc="-1"/>
<macro name="Macro 7" value="0.0" midi_cc="-1"/>
<macro name="Macro 8" value="0.0" midi_cc="-1"/>
</macro_controls>
<MidiAutomation/>
<MPEData Enabled="0"/>
</Processor>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<ContentProperties DeviceType="Desktop">
<Component type="ScriptMultipageDialog" id="mp" x="0" y="0" width="700"
height="650" DialogWidth="700" DialogHeight="650" text="Clean DSP network files"
Font="Lato" FontSize="19"/>
</ContentProperties>
Loading

0 comments on commit a8830db

Please sign in to comment.