Skip to content

Commit

Permalink
Let the user bypass note on filtering when velocity is 0
Browse files Browse the repository at this point in the history
Only for standalone program, dbus is not done yet.
See jackaudio/a2jmidid#14

(cherry picked from commit ee48ecee4d2cf2cd73ca29cbc2bf0b709de150fe)
  • Loading branch information
tartina authored and nedko committed May 4, 2023
1 parent a530eb8 commit ff9f735
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion a2jmidid.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ static bool g_started = false;
struct a2j * g_a2j = NULL;
size_t g_max_jack_port_name_size;
bool g_disable_port_uniqueness = false;
bool g_filter_note_on = true;

bool g_a2j_export_hw_ports = false;
char * g_a2j_jack_server_name = "default";
Expand Down Expand Up @@ -427,7 +428,7 @@ void
a2j_help(
const char * self)
{
a2j_info("Usage: %s [-j jack-server] [-e | --export-hw] [-u]", self);
a2j_info("Usage: %s [-j jack-server] [-e | --export-hw] [-u] [-n]", self);
a2j_info("Defaults:");
a2j_info("-j default");
}
Expand Down Expand Up @@ -485,6 +486,9 @@ main(
case 'u':
g_disable_port_uniqueness = true;
break;
case 'n':
g_filter_note_on = false;
break;
default:
a2j_help(argv[0]);
return 1;
Expand Down
3 changes: 2 additions & 1 deletion jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "port_thread.h"

static bool g_freewheeling = false;
extern bool g_filter_note_on;

/*
* =================== Input/output port handling =========================
Expand Down Expand Up @@ -176,7 +177,7 @@ a2j_input_event(
}

// fixup NoteOn with vel 0
if ((data[0] & 0xF0) == 0x90 && data[2] == 0x00) {
if (g_filter_note_on && (data[0] & 0xF0) == 0x90 && data[2] == 0x00) {
data[0] = 0x80 + (data[0] & 0x0F);
data[2] = 0x40;
}
Expand Down
4 changes: 3 additions & 1 deletion man/a2jmidid.1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.SH NAME
a2jmidid \- JACK MIDI daemon for ALSA MIDI
.SH SYNOPSIS
.B a2jmidid [-j jack-server] [e | --export-hw]
.B a2jmidid [-j jack-server] [e | --export-hw] [-u] [-n]
.SH DESCRIPTION
a2jmidid is a daemon that implements automatic bridging. For every ALSA
sequencer port you get one JACK midi port. If ALSA sequencer port is
Expand All @@ -16,6 +16,8 @@ forces a2jmidid to bridge hardware ports as well as software ports
forces a2jmidid to generate non-unique port names (see NOTES)
.IP -j
specifies which jack-server to use
.IP -n
do not filter note on
.SH NOTES
ALSA does not guarantee client names to by unique. I.e. it is possible
to have two apps that create two clients with same ALSA client name.
Expand Down

0 comments on commit ff9f735

Please sign in to comment.