From 3aa58a268a0f6183fb6bd237c539754eb7ccc497 Mon Sep 17 00:00:00 2001 From: Richard Date: Sat, 10 Jul 2021 18:08:02 +0100 Subject: added readme, updated example --- README.md | 29 +++++++++++++++++++++++++++++ examples/test.csd | 6 +++--- 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 README.md 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 -- cgit v1.2.3