aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--LICENSE24
-rw-r--r--README.md25
-rw-r--r--main.c32
4 files changed, 82 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9d22d8c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..68a49da
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,24 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e073bad
--- /dev/null
+++ b/README.md
@@ -0,0 +1,25 @@
+# Hexiano to ALSA
+
+This very simple C program makes a virtual ALSA midi device from the
+Hexiano android app
+
+## How it works
+
+It listens for Hexiano logs on the android debug bridge, before using
+this program you'll have to set up the android debug bridge, once
+done you should be able to run `adb logcat` and see everything that's
+happening on your mobile device including the Hexiano events, this
+software basically launches the same command to see what's going on,
+if your command to access the logs is something else than
+`adb logcat` on your system please change the source code accordingly
+
+## How to compile
+
+`cc -o hexmidi main.c -lasound`
+
+Replace hexmidi with whatever executable name you'd like
+
+Get Hexiano here
+https://f-droid.org/en/packages/org.gitorious.jamesjrh.isokeys/
+
+(you will require an older android device to run the App)
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..cce28a1
--- /dev/null
+++ b/main.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <alsa/asoundlib.h>
+
+int main() {
+ snd_rawmidi_t* midiout = NULL;
+ snd_rawmidi_open(NULL, &midiout, "virtual", 0);
+
+ char line[100];
+ int nbr = 0;
+ FILE *fp;
+ fp = popen("adb logcat", "r");
+ while (1) {
+ fgets(line, sizeof(line), fp);
+ if (memcmp(line, "D/HexKey::p",11) == 0) {
+ snd_rawmidi_write(midiout, (char[]){0x90, atoi(line+23), 100}, 3);
+ printf("play :");
+ printf(line+23);
+ }
+ if (memcmp(line, "D/HexKey::s",11) == 0) {
+ snd_rawmidi_write(midiout, (char[]){0x90, atoi(line+23), 0}, 3);
+ printf("stop :");
+ printf(line+23);
+ }
+ }
+
+ snd_rawmidi_close(midiout);
+ midiout = NULL;
+ return 0;
+}
+