osune / MidiJoystick

MidiJoystick is a MIDI client for the Jack Audio Connection Kit on Linux, which lets you use your joystick to emit MIDI commands
MIT License
23 stars 5 forks source link

Can not compile (Gambit 4.2.x) #6

Closed pwqw closed 7 years ago

pwqw commented 7 years ago
$ make all
gsc-script -debug -warnings -verbose -cc-options "-std=c11 -Wall -g -O0"  -ld-options -ljack  -exe -o midijoystick midijack.c joystick.c midijoystick.scm
*** WARNING -- Unknown or improperly placed option: "debug"
*** WARNING -- Unknown or improperly placed option: "warnings"
*** WARNING -- Unknown or improperly placed option: "verbose"
*** WARNING -- Unknown or improperly placed option: "cc-options"
*** WARNING -- Unknown or improperly placed option: "std=c11 -Wall -g -O0"
*** WARNING -- Unknown or improperly placed option: "ld-options"
*** WARNING -- Unknown or improperly placed option: "ljack"
*** WARNING -- Unknown or improperly placed option: "exe"
*** WARNING -- Unknown or improperly placed option: "o"
*** ERROR IN "midijoystick.scm"@1.1 -- Interpreter does not support ##c-declare

Ubuntu 16.04 Gambit v4.2.8

Suggestions?

osune commented 7 years ago

Yes :)

This is a known problem with the Version of Gambit you are using. Unfortunately the guy having the same problem never reported back. So I don't know if this really fix things up.

The link gives you a dissection of the problem but I try to give a TL;DR version here:

First you have to link the midijoystick.scm file $ gsc -link midijoystick

Then you need to compile and link it together with the remaining c-files $ gcc -std=c11 -Wall -g -O0 -lgambc -lm -ldl -lutil $(pkg-config --cflags --libs jack) -o midijoystick joystick.c midijack.c midijoystick.c midijoystick_.c

Please note i still don't have access to a Debian Machine with Jack installed, so this is me flying blind.

pwqw commented 7 years ago

Thanks for answering :+1:

When..

$ gsc -link midijoystick
*** ERROR IN "/tmp/MidiJoystick/midijoystick.scm"@128.44 -- Undefined C type identifier

In the file, at line 128:44, I find the size_t element:

;;; Functions to interact with JackAudioServer
(define setup-jack (c-lambda () int "_setup_jack"))
(define send-midi (c-lambda (scheme-object size_t) int "int res = SEND_MIDI(___arg1, ___arg2);  ___return(res);"))

JACK verrsion 0.4.2 is correctly running

osune commented 7 years ago

No problem!

So as far i can see it seems size_t was not available in gambit 4.2.8. (unfortunately the documentation seems not be only any more)

But send-midi and its c implementation is my own code so I think it is save to use int instead of size_t here (midi messages are quite short). I created a experimental branch containing the changes: gambit_4.2.8_experimental

Please have a look and excuse my situation of not being able to test it myself. :(

pwqw commented 7 years ago

Calm friend, I'm helping and I don't charge you.. 😆 Literally, I think that others people found others solutions in pure C 😅 like me.. But I like test it.

Ok: gsc -link midijoystick works, but..

$ gcc -std=c11 -Wall -g -O0 -lgambc -lm -ldl -lutil $(pkg-config --cflags --libs jack) -o midijoystick joystick.c midijack.c midijoystick.c midijoystick_.c

see the output here

osune commented 7 years ago

Tell what solutions did you found ? I tried scheme / gambit to get a powerfull configuration syntax so i've wondered how a pure C project will solve this.

I've made another commit 73fdd1bfb654cf56f3ccce955ec22e7824a5fcd9. Just deleting the inclusion of 'gambit.h' in the glue.c file and hoping for the best.

Gambit 4.2.8 is now 9/10 years old so .... if that's not working for you i fear you might have more success by compiling gambit 4.8.4 yourself. At least that is the version i programmed against.

I've seen falkTx nooise repository. It has UDEV support but i don't know about the working state. But i'm thinking to base of this lib a SBCL Common Lisp implementation for Midijoystick (see enhancement issues here).

pwqw commented 7 years ago

Yes, Gambit 4.8.4 is the real solution.. but I could not compile it either 🤒 First I need to change this linux distro.

Well.. the new gcc command output is here Update README: "Never try with Gambit 4.2.x" haha

On the other hands, I tested:

  1. falkTX nooice: seems complete but doesn't work.
  2. gretchycat js2midi: the axes doesn't work and only takes some buttons.
  3. kevinmcglashan aseqjoy: the axes are working and the buttons change the midi channel.

then I found solutions in java/windows, python and nodejs too

osune commented 7 years ago

Uff that's a bummer, that you weren't able to compile Gambit 4.8.4 =(

Oh well this output is somehow expected. I fear I've to give up and stop wasting your time. I'll update it :D

I love falkTX for his work for the Linux Audio community. aseqjoy unfortunatly uses ALSA. But it seems the most working.

Apart from just the fun of it I personally don't think a gamepad/joystick is a good MIDI input device. Maybe a nice thing for live gigs and glitchy music. But with libevdev support one could connect any peripheral and send MIDI (e.g. Trackball as an x/y fader etc...). Only disadvantage is the huge pile of obscure MIDI Commands and I wouldn't like to recompile just to change the Input Configuration. That's why I tried it in Gambit , the Lisp Lists are quite a powerful configuration syntax. I hope some day I will realize this Program in Common Lisp but it's not the most enduser friendliest Programming Language when distributing.

Anyways thanks for your interest in this Program :)

pwqw commented 7 years ago

hhahaa no.. really isn't a good MIDI input device. But in some Latinoamerican places is most easy get a joytick to control the sounds programs than a real MIDI controller. So is a good application for newest.

Lisp is heard good. Be careful of choosing a version default in the ubuntu, raspbian and debian repositories for an easy implementation xD A "command line graphical user interface" could be funny useful solution..

Thanks to you a lot!