Update hardcoded commands invocation in modules to new syntax
This commit is contained in:
@@ -44,7 +44,7 @@ class MidiHelpFunction : Function("midiHelp") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val notes = Value.list(
|
val notes = Value.list(
|
||||||
listOf(Value.string("i:$instrument")) + environment.invokeFunction(
|
listOf(Value.map(mapOf(Value.string("instrument") to Value.int(instrument)))) + environment.invokeFunction(
|
||||||
"range",
|
"range",
|
||||||
listOf(begin, end)
|
listOf(begin, end)
|
||||||
).value as List<Value>
|
).value as List<Value>
|
||||||
@@ -60,7 +60,7 @@ class MidiHelpFunction : Function("midiHelp") {
|
|||||||
println(it)
|
println(it)
|
||||||
Midi
|
Midi
|
||||||
.with(ConfigMap(mapOf(Value.string("bpm") to Value.int(bpm))))
|
.with(ConfigMap(mapOf(Value.string("bpm") to Value.int(bpm))))
|
||||||
.play(mapOf(channel to listOf(listOf("i:$instrument", it))))
|
.play(mapOf(channel to listOf(listOf(mapOf("instrument" to instrument), it))))
|
||||||
Thread.sleep(100)
|
Thread.sleep(100)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,13 @@ function metronome(bpm: int = 120, beats: int = 4, accent: note = @A#2, beat: no
|
|||||||
}
|
}
|
||||||
|
|
||||||
function alert(melody: string = "beep") {
|
function alert(melody: string = "beep") {
|
||||||
|
i = instrument(108)
|
||||||
|
|
||||||
melodies = {
|
melodies = {
|
||||||
beep -> ["i:108", @c5, 4, @c5, 1, 4],
|
beep -> [i, @c5, 4, @c5, 1, 4],
|
||||||
bell -> ["i:108", @c5:8, @db5:8],
|
bell -> [i, @c5:8, @db5:8],
|
||||||
alarm1 -> ["i:108", (range(@g, @g5) as n ^ n.withDuration(32))].flatten(),
|
alarm1 -> [i, (range(@g, @g5) as n ^ n.withDuration(32))].flatten(),
|
||||||
alarm2 -> ["i:108", (range(@g, @g5) as n ^ n.withDuration(32)), -(range(@c, @c5) as n ^ n.withDuration(32))].flatten()
|
alarm2 -> [i, (range(@g, @g5) as n ^ n.withDuration(32)), -(range(@c, @c5) as n ^ n.withDuration(32))].flatten()
|
||||||
};
|
};
|
||||||
|
|
||||||
if(not melodies.containsKey(melody)) {
|
if(not melodies.containsKey(melody)) {
|
||||||
@@ -22,11 +24,13 @@ function alert(melody: string = "beep") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function alert(cycles: int, melody: string = "beep") {
|
function alert(cycles: int, melody: string = "beep") {
|
||||||
|
i = instrument(108)
|
||||||
|
|
||||||
melodies = {
|
melodies = {
|
||||||
beep -> ["i:108", @c5, 4, @c5, 1, 4],
|
beep -> [i, @c5, 4, @c5, 1, 4],
|
||||||
bell -> ["i:108", @c5:8, @db5:8],
|
bell -> [i, @c5:8, @db5:8],
|
||||||
alarm1 -> ["i:108", (range(@g, @g5) as n ^ n.withDuration(32))].flatten(),
|
alarm1 -> [i, (range(@g, @g5) as n ^ n.withDuration(32))].flatten(),
|
||||||
alarm2 -> ["i:108", (range(@g, @g5) as n ^ n.withDuration(32)), -(range(@c, @c5) as n ^ n.withDuration(32))].flatten()
|
alarm2 -> [i, (range(@g, @g5) as n ^ n.withDuration(32)), -(range(@c, @c5) as n ^ n.withDuration(32))].flatten()
|
||||||
};
|
};
|
||||||
|
|
||||||
if(not melodies.containsKey(melody)) {
|
if(not melodies.containsKey(melody)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user