From patchwork Sun Apr 10 19:29:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clemens Ladisch X-Patchwork-Id: 8791801 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 63928C0553 for ; Sun, 10 Apr 2016 19:29:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6BA43201B4 for ; Sun, 10 Apr 2016 19:29:42 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D186920173 for ; Sun, 10 Apr 2016 19:29:40 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 301BF2608B3; Sun, 10 Apr 2016 21:29:38 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7A81A2608B3; Sun, 10 Apr 2016 21:29:36 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E6AE5261469; Sun, 10 Apr 2016 21:29:34 +0200 (CEST) Received: from dehamd003.servertools24.de (dehamd003.servertools24.de [31.47.254.18]) by alsa0.perex.cz (Postfix) with ESMTP id BD09326074D for ; Sun, 10 Apr 2016 21:29:27 +0200 (CEST) Received: from [192.168.42.181] (tmo-115-5.customers.d1-online.com [80.187.115.5]) by dehamd003.servertools24.de (Postfix) with ESMTPSA id BF8F1F5200F7; Sun, 10 Apr 2016 21:29:26 +0200 (CEST) To: Takashi Iwai From: Clemens Ladisch Message-ID: <570AA980.3070802@ladisch.de> Date: Sun, 10 Apr 2016 21:29:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 X-PPP-Message-ID: <20160410192927.26907.58903@dehamd003.servertools24.de> X-PPP-Vhost: ladisch.de Cc: alsa-devel@alsa-project.org, Martin Tarenskeen Subject: [alsa-devel] [PATCH 1/2] amidi: ignore not only Active Sensing but all System Real-Time messages X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP By default, amidi ignores Active Sensing messages because they are sent by many devices in the background and would only interfere with the actual messages that amidi is supposed to capture. However, there are also devices that send Clock messages with the same problem, so it is a better idea to filter out all System Real-Time messages. Reported-by: Martin Tarenskeen Signed-off-by: Clemens Ladisch --- amidi/amidi.1 | 19 +++++++++++++------ amidi/amidi.c | 11 ++++++----- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/amidi/amidi.1 b/amidi/amidi.1 index 1b4cfb1..46e9c50 100644 --- a/amidi/amidi.1 +++ b/amidi/amidi.1 @@ -1,4 +1,4 @@ -.TH AMIDI 1 "26 Jun 2006" +.TH AMIDI 1 "26 Mar 2016" .SH NAME amidi \- read from and write to ALSA RawMIDI ports @@ -80,7 +80,7 @@ to record a Standard MIDI (.mid) file, use .B arecordmidi(1). .B amidi -will filter out any Active Sensing bytes (FEh), unless the +will filter out System Real-Time messages (F8h...FFh), unless the .I \-a option has been given. @@ -91,7 +91,7 @@ Sends the bytes specified as hexadecimal numbers to the MIDI port. .TP .I \-d, \-\-dump Prints data received from the MIDI port as hexadecimal bytes. -Active Sensing bytes (FEh) will not be shown, unless the +System Real-Time messages (F8h...FFh) will not be shown, unless the .I \-a option has been given. @@ -107,9 +107,16 @@ If this option has not been given, you must press Ctrl+C (or kill to stop receiving data. .TP -.I \-a, \-\-active\-sensing -Does not ignore Active Sensing bytes (FEh) when saving or printing -received MIDI commands. +.I \-a, \-\-all\-messages +Includes System Real-Time messages (F8h...FFh) when saving or +printing received MIDI commands. +By default, these messages are ignored. + +(Clock (F8h) or Active Sensing (FEh) messages are sent in the +background by many devices, but typically are not wanted and would +only clutter up +.B amidi\fR's +output.) .SH EXAMPLES diff --git a/amidi/amidi.c b/amidi/amidi.c index cedf18c..4978249 100644 --- a/amidi/amidi.c +++ b/amidi/amidi.c @@ -77,7 +77,7 @@ static void usage(void) "-d, --dump print received data as hexadecimal bytes\n" "-t, --timeout=seconds exits when no data has been received\n" " for the specified duration\n" - "-a, --active-sensing don't ignore active sensing bytes\n"); + "-a, --all-messages include system real-time messages\n"); } static void version(void) @@ -418,11 +418,12 @@ int main(int argc, char *argv[]) {"send-hex", 2, NULL, 'S'}, {"dump", 0, NULL, 'd'}, {"timeout", 1, NULL, 't'}, - {"active-sensing", 0, NULL, 'a'}, + {"all-messages", 0, NULL, 'a'}, + {"active-sensing", 0, NULL, 'a'}, /* for backwards compatibility */ { } }; int c, err, ok = 0; - int ignore_active_sensing = 1; + int ignore_system_realtime = 1; int do_send_hex = 0; while ((c = getopt_long(argc, argv, short_options, @@ -461,7 +462,7 @@ int main(int argc, char *argv[]) timeout = atoi(optarg); break; case 'a': - ignore_active_sensing = 0; + ignore_system_realtime = 0; break; default: error("Try `amidi --help' for more information."); @@ -589,7 +590,7 @@ int main(int argc, char *argv[]) } length = 0; for (i = 0; i < err; ++i) - if (!ignore_active_sensing || buf[i] != 0xfe) + if (!ignore_system_realtime || buf[i] < 0xf8) buf[length++] = buf[i]; if (length == 0) continue;