summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-10-07 14:28:47 -0400
committerpommicket <pommicket@gmail.com>2022-10-07 14:28:47 -0400
commitfe6fff77636b354b21ab9e26fe4f62bb030b3a17 (patch)
tree04c2746b5309055bd9146f3f2dad1b5d27cbecc0 /examples
parent99fefad88661c1b11c55ac3bb3e009baf4eb9893 (diff)
pm_start, this
Diffstat (limited to 'examples')
-rw-r--r--examples/fun.rhai16
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/fun.rhai b/examples/fun.rhai
new file mode 100644
index 0000000..05b915c
--- /dev/null
+++ b/examples/fun.rhai
@@ -0,0 +1,16 @@
+// plays ode to joy, no matter which keys you press
+
+const data = [64, 64, 65, 67, 67, 65, 64, 62, 60, 60, 62, 64, 64, 62, 62,
+ 64, 64, 65, 67, 67, 65, 64, 62, 60, 60, 62, 64, 62, 60, 60];
+
+fn pm_note_played(channel, note, vel) {
+ pm_play_note(0, data[this.i], vel);
+ this.i += 1;
+ this.i %= data.len;
+}
+
+fn pm_start() {
+ this.i = 0;
+ pm_load_soundfont("soundfont.sf3");
+ pm_load_preset(-1, "grand piano");
+}