af10ac01d21c5ca0ee6ba165be99f6b907bd5775
commit af10ac01d21c5ca0ee6ba165be99f6b907bd5775
Author: spesk <spesk@pm.me>
Date: Mon Mar 21 15:43:38 2022 -0400

Organized and fixed a few bugs

diff --git a/kick_drum.modmark b/kick_drum.modmark
deleted file mode 100644
index 10b9eb8..0000000
--- a/kick_drum.modmark
+++ /dev/null
@@ -1,32 +0,0 @@
-#lang reader modmark_br.rkt
-# Patch Spec
-# Representing an approximation of
-# a 909 kick. Module specs are imported
-# but don't yet exist
-
-Title: Kick Drum
-
-# By default "./modules" is included in the module path
-ModuleDir "/home/swatson/Repos/modmark/"
-
-import Module::BlueLantern::AsteroidOperatorVCF as VCF
-import Module::MakeNoise::Maths
-import Module::ALM::TangleQuartet as VCA
-import Module::Generic::Output
-
-set VCF.Pluck = on
-set VCF.Freq.position = 7
-
-set Maths.Cycle[1] = on
-set Maths.Rise[1].position = 7
-set Maths.Fall[1].position = 1
-set Maths.LogExp.position = 5
-
-set VCA.Input1.position = 5
-
-# Output of Maths env into VCF freq modulation
-connect Maths.1f VCF.PluckMod
-# Output of VCF into VCA
-connect VCF.Output.Overdrive VCA.Input1
-# VCA into soundcard/output
-connect VCA.Input1 Output.1
diff --git a/module_lib/asteroid_op.module b/module_lib/asteroid_op.module
new file mode 100644
index 0000000..04808c2
--- /dev/null
+++ b/module_lib/asteroid_op.module
@@ -0,0 +1,57 @@
+# Blue Lanturn Asteroid Operator VCF
+
+Manufacturer: BlueLanturn
+Module: AsteroidOperatorVCF
+Revision: 1
+- Input: PCV
+- Input: Audio
+- Input: VCA
+- Input: SqIn
+- Input: Polar
+- Input: FM
+- Input: VCR
+- Input: FMod
+- Input: FPCV
+- Button: Lim1
+-- Position: [0,1]
+- Button: PluckSwitch
+-- Position: [0,1]
+- Button: Flipflop
+-- Position: [0,1]
+- Button: Limit2
+-- Position: [0,1]
+- Output: Out
+- Output: BP
+- Output: BPVoco
+- Output: LPOD
+- Output: LPFloss
+- Output: LPStatic
+- Output: BPFloss
+- Output: BPVari
+- Output: HPStatic
+- Knob: Audio
+-- Position: [1-12]
+- Knob: Sub1
+-- Position: [1-12]
+- Knob: Sub2
+-- Position: [1-12]
+- Knob: Vari
+-- Position: [1-12]
+- Knob: VoiceOfQ
+-- Position: [1-12]
+- Knob: FM
+-- Position: [1-12]
+- Knob: Polar
+-- Position: [1-12]
+- Knob: VCA
+-- Position: [1-12]
+- Knob: VCR
+-- Position: [1-12]
+- Knob: QDrive
+-- Position: [1-12]
+- Knob: LPOD
+-- Position: [1-12]
+- Knob: Mod
+-- Position: [1-12]
+- Knob: Filter
+-- Position: [1-12]
\ No newline at end of file
diff --git a/foo.module b/module_lib/foo.module
similarity index 100%
rename from foo.module
rename to module_lib/foo.module
diff --git a/maths.module b/module_lib/maths.module
similarity index 88%
rename from maths.module
rename to module_lib/maths.module
index 0aa0cac..66ac059 100644
--- a/maths.module
+++ b/module_lib/maths.module
@@ -29,8 +29,10 @@ Revision: null
- Input: Cycle2
- Knob: LogExp
-- Position: [1-12]
-- Button: Cycle1
-- Button: Cycle2
+- Button: Cycle1Button
+-- Position: [0,1]
+- Button: Cycle2Button
+-- Position: [0,1]
- Output: 1f
- Output: 1
- Output: 2
diff --git a/module_lib/tangle_quartet.module b/module_lib/tangle_quartet.module
new file mode 100644
index 0000000..0735eeb
--- /dev/null
+++ b/module_lib/tangle_quartet.module
@@ -0,0 +1,20 @@
+Manufacturer: ALM
+Module: TangleQuartet
+Revision: 1
+- Input: VCA1
+- Input: VCA2
+- Input: VCA3
+- Input: VCA4
+- Input: Level1
+-- Position: [1-12]
+- Input: Level2
+-- Position: [1-12]
+- Input: Level3
+-- Position: [1-12]
+- Input: Level4
+-- Position: [1-12]
+- Output: Output1
+- Output: Output2
+- Output: Output3
+- Output: Output4
+- Output: Mix
\ No newline at end of file
diff --git a/example.modmark b/patches/example.modmark
similarity index 90%
rename from example.modmark
rename to patches/example.modmark
index 7bc15a8..ec4a5db 100644
--- a/example.modmark
+++ b/patches/example.modmark
@@ -6,7 +6,7 @@ ModuleDir "/home/swatson/Repos/modmark/"
import Module::Foobar::FooMod
import Module::MakeNoise::Maths

-set Maths.Cycle1 = on
+set Maths.Cycle1Button = 1
set Maths.Rise1.position = 7
set Maths.Fall1.position = 1
set Maths.LogExp.position = 5
diff --git a/patches/kick_drum.modmark b/patches/kick_drum.modmark
new file mode 100644
index 0000000..99c595c
--- /dev/null
+++ b/patches/kick_drum.modmark
@@ -0,0 +1,28 @@
+#lang reader modmark_br.rkt
+# Patch Spec
+# Representing an approximation of
+# a 909 kick. Module specs are imported
+# but don't yet exist
+
+Title: Kick Drum
+
+# By default "./modules" is included in the module path
+ModuleDir "/home/swatson/Repos/modmark/"
+
+import Module::BlueLantern::AsteroidOperatorVCF
+import Module::MakeNoise::Maths
+import Module::ALM::TangleQuartet
+
+set AsteroidOperatorVCF.PluckSwitch = on
+set AsteroidOperatorVCF.Filter.position = 7
+
+set Maths.Cycle1Button = on
+set Maths.Rise1.position = 7
+set Maths.Fall1.position = 1
+set Maths.LogExp.position = 5
+
+set TangleQuartet.Level1.position = 5
+
+connect Maths.1f AsteroidOperatorVCF.FMod
+connect Maths.1f TangleQuartet.Level1
+connect AsteroidOperatorVCF.LPOD TangleQuartet.VCA1
diff --git a/pl_proto.pl b/pl_proto.pl
index df13256..b571f58 100755
--- a/pl_proto.pl
+++ b/pl_proto.pl
@@ -94,6 +94,16 @@ sub parse_module_file {
$last_proc_type = "output";
$module{'Outputs'}->{$output} = \%output_chars;
}
+
+ if ( $line =~ m/^-\ Button:(.*)/ ) {
+ my $button = $1;
+ $button = trim($button);
+ my %button_chars;
+ $last_input = $button;
+ $last_proc_type = "input";
+ $module{'Inputs'}->{$button} = \%button_chars;
+ }
+
}

if ( $line =~ m/^--\ / ) {
@@ -238,11 +248,11 @@ my %PARSE_RULES = (
$AST{'Sets'}->{$mod_to_set}->{$attr_to_set} = \%set_params;
};

- if ( $set_line =~ m/(^[A-Z]{1}[a-z]{1,})\.{1}([A-Za-z0-9]{1,})\ \=\ (.*)$/ ) {
+ if ( $set_line =~ m/(^[A-Z]{1}[A-Za-z]{1,})\.{1}([A-Za-z0-9]{1,})\ \=\ (.*)$/ ) {
$mod_to_set = $1;
$attr_to_set = $2;
$value = $3;
- } elsif ( $set_line =~ m/(^[A-Z]{1}[a-z]{1,})\.{1}([A-Za-z0-9]{1,})\.([A-Za-z0-9]{1,})\ \=\ (.*)$/ ) {
+ } elsif ( $set_line =~ m/(^[A-Z]{1}[A-Za-z]{1,})\.{1}([A-Za-z0-9]{1,})\.([A-Za-z0-9]{1,})\ \=\ (.*)$/ ) {
$mod_to_set = $1;
$attr_to_set = $2;
$attr_param = $3;
@@ -302,7 +312,7 @@ my %PARSE_RULES = (
return 0;
} else {
my $c = 0;
- foreach my $conn_id ( @{$AST{'Connections'}} ) {
+ foreach my $conn_id ( keys %{$AST{'Connections'}} ) {
$c++;
}
return $c;
@@ -379,11 +389,19 @@ sub module_node_constructor($$) {
graph => {label => "$$mod_ref{'Module'}"},
node => {color => 'black', shape => 'circle'},
);
- foreach my $node_name ( keys %{$mod_ref} ) {
- if ( $node_name =~ m/Module|Manufacturer|Rev/ ) {
- $graph->add_node(name => "$node_name : $$mod_ref{$node_name}", shape => 'oval');
- }
- }
+
+ # $graph->push_subgraph(
+ # name => "cluster_mod_info",
+ # graph => {label => "mod_info"},
+ # node => {color => 'grey', shape => 'square'},
+ # );
+ # foreach my $node_name ( keys %{$mod_ref} ) {
+ # if ( $node_name =~ m/Module|Manufacturer|Rev/ ) {
+ # $graph->add_node(name => "$node_name\n: $$mod_ref{$node_name}", shape => 'square');
+ # }
+ # }
+
+ # $graph->pop_subgraph;

if ( defined $AST{'Sets'}->{$$mod_ref{'Module'}} ) {
my $sets_ref = $AST{'Sets'}->{$$mod_ref{'Module'}};
@@ -393,7 +411,7 @@ sub module_node_constructor($$) {
$graph->push_subgraph(
name => $name,
graph => {label => $label},
- node => {color => "red", shape => 'square'},
+ node => {color => "green", shape => 'square'},
);
$graph->add_node(name => "$set : $$sets_ref{$set}->{'Param'} : $$sets_ref{$set}->{'Value'}");
$graph->pop_subgraph;
@@ -432,18 +450,16 @@ sub module_node_constructor($$) {
$graph->pop_subgraph;
}

-sub connection_node_constructor($) {
- my $graph = shift;
-}
-
+# Draw modules
foreach my $mod_ref ( @{$AST{'Modules'}} ) {
module_node_constructor($graph,$mod_ref);
}
+
# Draw connections
foreach my $conn_ref ( keys %{$AST{'Connections'}} ) {
my $from = $AST{'Connections'}->{$conn_ref}->{'Output_Port'};
my $to = $AST{'Connections'}->{$conn_ref}->{'Input_Mod_Dst'};
- $graph->add_edge(from => $from, to => $to);
+ $graph->add_edge(color => 'red', from => $from, to => $to);
}

my $format = 'svg';