Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Midi support #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Midi support #25

wants to merge 3 commits into from

Conversation

hvolkmer
Copy link

@hvolkmer hvolkmer commented Apr 9, 2018

This adds support for midi controllers. Tested using a Behringer CMD LC-1 controller.

Midi events can be mapped (input device support) using lmc_set_midi_handler and notes can be sent to the controller (to e.g. set LEDs) via lmc_send_midi_note.

I will add more error handling (verifying device types, checking if devices are still there) but wanted to create this request to get some feedback.

I usually don't write Pascal code, so let me know if any coding or naming conventions are off. I tried to stick to the style that was already in the code. Let me know if should change anything.

This addresses #2

hvolkmer added 3 commits April 8, 2018 17:04
These changes have been applied and reverted a few times already. This code at least makes the compile work (and also seems to run fine).
This introduces a new Lua function "lmc_set_midi_handler" which can be used to map midi input devices. The devices are managed by a midideviceservice, similar to keyboards and game controllers.

The handler function in Lua will receive the midi input data (which is status, data1 and data2).

Currently no support for SysEx.
This adds a new lua command that allows the user to send midi notes to a controller. This can be used to e.g. turn on LEDs etc. on the controller (depends on the hardware).
@me2d13
Copy link
Owner

me2d13 commented Apr 16, 2018

Thanks for pull request. Why were you changing uKbdDeviceService? I suppose you have difficulties to compile it but si I have with your changes. Seeing the explicit uRawInput. reference you have added you had multiple decalrations e.g. of PRAWINPUT?
One of the compilation errors I have now is call of GetRawInputDeviceList where you added @ (as address) to 2nd parameter. But the declaration of GetRawInputDeviceList I have in uRawInput unit has this parameter as var so the reference is passed by compiler, you dont need (and can't use) pointer - that's my compile error.
What's the FPC/Lazarus version you have used?

@hvolkmer
Copy link
Author

I used Lazarus 1.8.2 FPC 3.0.4 (the current available latest download from the website).

I basically just looked at the history and saw that this code was changed back and forth a at least once and basically reversed the last change. That made it compile and it also seems to work.

This change is obviously totally unrelated to my addition and I'd rather not have it in here at all, but it was necessary to compile. I am not sure what to do here. I'd be happy to remove/change it in any way as long as everything still works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants