Alsa midi input support

Moderators: MattKingUSA, khz, muldjord, deva

corrados
Established Member
Posts: 39
Joined: Sat Jan 02, 2021 4:01 pm

Re: Alsa midi input support

Post by corrados »

Unfortunately, the ALSA raw midi interface seems to access the MIDI hardware directly (as far as I understood the documentation). So, I cannot use the aconnect command anymore which I need for my project. Therefore, I changed my code to re-create the raw MIDI message based on the event sequence information of the ALSA MIDI event, where I now also added the CC events. I know that this is not a nice code but it seems to work correctly. I am running out of ideas how to solve this nicely...
User avatar
deva
Established Member
Posts: 285
Joined: Sun Oct 23, 2016 10:15 am
Has thanked: 3 times
Been thanked: 31 times
Contact:

Re: Alsa midi input support

Post by deva »

I'm all-in for pragmatic solutions, so if it works I think we should go with that.
I also agree that "locking" the hardware by using direct access to it is something that should be prevented if at all possible.

Since the ev->type is an snd_seq_event_type enum it would probably be cleaner to use switch/case to handle it.
I initially thought that we should then add all the rest of the enum values to cover all possible types, but it seems that the enum list covers a lot more than just the regular midi types, so now I'm not so sure...
corrados
Established Member
Posts: 39
Joined: Sat Jan 02, 2021 4:01 pm

Re: Alsa midi input support

Post by corrados »

Yes, it makes sense to use a switch/case. I just updated my branch with the change.
corrados
Established Member
Posts: 39
Joined: Sat Jan 02, 2021 4:01 pm

Re: Alsa midi input support

Post by corrados »

I consider my ALSA midi implementation as done now. If you like, you could merge my branch corrados_alsamidi it to your alsamidi branch.
User avatar
deva
Established Member
Posts: 285
Joined: Sun Oct 23, 2016 10:15 am
Has thanked: 3 times
Been thanked: 31 times
Contact:

Re: Alsa midi input support

Post by deva »

It has been merged to develop now. Great job :-)
corrados
Established Member
Posts: 39
Joined: Sat Jan 02, 2021 4:01 pm

Re: Alsa midi input support

Post by corrados »

Thanks. I don't know why (maybe a merge issue) but if I look at the following commit: http://git.drumgizmo.org/drumgizmo.git/ ... 8198525eb6, the include is doubled which is incorrect:

+#ifdef HAVE_INPUT_ALSAMIDI
+#include "input/alsamidi.h"
+#endif

Can you please remove one of them or should I do that?
User avatar
deva
Established Member
Posts: 285
Joined: Sun Oct 23, 2016 10:15 am
Has thanked: 3 times
Been thanked: 31 times
Contact:

Re: Alsa midi input support

Post by deva »

I'm thinking we can remove it if/when other changes are being made to that same file?
Post Reply