aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md29
-rw-r--r--examples/test.csd6
2 files changed, 32 insertions, 3 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..894be30
--- /dev/null
+++ b/README.md
@@ -0,0 +1,29 @@
+## Introduction
+csound-jstick was created in response to the builtin joystick opcode being a bit inefficient and not ideal to use. This attempts to make it a bit easier by presenting the output in two arrays (buttons and axes). A maximum of 4 axes and 12 buttons is supported.
+The opcode uses evdev so only works on Linux.
+
+
+## Requirements
+ - Csound development libraries
+ - Cmake 3.8 or later
+
+
+## Building
+Create a build directory at the top of the source tree, execute *cmake ..*, *make* and optionally *make install* as root. If the latter is not used/possible then the resulting module can be used with the *--opcode-lib* flag in Csound. eg:
+
+ cd csound-jstick
+ mkdir build && cd build
+ cmake ..
+ make && sudo make install
+
+
+## Opcode overview
+### jstick
+*kaxes[] kbuttons[] jstick inum
+
+Obtain joystick data at k-rate.
+
+ - kaxes[] : array containing axis data normalised to between 0 and 1, size is 4
+ - kbuttons[] : array containing button data normalised to between 0 and 1, size is 12
+ - inum : the joystick number corresponding to /dev/input
+
diff --git a/examples/test.csd b/examples/test.csd
index a78fb8d..9d15a03 100644
--- a/examples/test.csd
+++ b/examples/test.csd
@@ -13,9 +13,9 @@ nchnls = 2
instr 1
kfreq init 440
- kaxis[], kbuttons[] jstick 0
- printk2 kaxis[2]
- kfreq = kaxis[3]
+ kaxes[], kbuttons[] jstick 0
+ printk2 kaxes[2]
+ kfreq = kaxes[3]
a1 oscil 1, kfreq
outs a1, a1
endin