Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: pat@dumaisnet.ca
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: rawmidi
Date: Fri, 08 Oct 2004 17:55:27 +0200	[thread overview]
Message-ID: <s5hk6u15hn4.wl@alsa2.suse.de> (raw)
In-Reply-To: <Pine.LNX.4.58.0410081115480.13304@pat.dumaisnet.ca>

[-- Attachment #1: Type: text/plain, Size: 1445 bytes --]

At Fri, 8 Oct 2004 11:26:39 -0400 (EDT),
Patrick Dumais wrote:
> 
> I noticed that some drivers tend to send "batch" note-on commands. I mean:
> instead of sending 90h,01h,7Fh everytime, it sends a first 90,01,7f then
> just 02,7f etc... It sends the noteon command only once and assumes that
> your application will set itself in a "noteon receive" mode. This is very
> annoying because my application expects to receive a command byte each
> time. the emu10k1 driver doesn't do that, but snd-virmidi does.

Yes, virmidi reduces the command byte when the identical
running-status is kept.

Note that this is the correct MIDI implementation.  Many devices
output in this way (although many don't).


> I'm using virmidi because I want 2 apps to read my sbLive midi port. I
> aconnect this port to 2 virmidi ports then my apps read from those ports.
> 
> Is there any way that I can configure virmidi so that it sends commands
> the conventional way, or any other way that I could have 2 applications
> reading on the same midi port? (using the alsa sequencer interface is not
> an alternative method that I want to consider for the scope of my
> applications)

The attached (untested) patch will add no_status option to snd-virmidi
module.  When this is set to 1, the running-status is always output as
you like.

But, again, reducing the identical running-status is the feature of
MIDI byte stream.  Your app should really handle it.


Takashi

[-- Attachment #2: Type: text/plain, Size: 2488 bytes --]

Index: alsa-kernel/core/seq/seq_virmidi.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/core/seq/seq_virmidi.c,v
retrieving revision 1.12
diff -u -r1.12 seq_virmidi.c
--- alsa-kernel/core/seq/seq_virmidi.c	29 Jun 2004 16:01:14 -0000	1.12
+++ alsa-kernel/core/seq/seq_virmidi.c	8 Oct 2004 15:48:46 -0000
@@ -212,6 +212,8 @@
 		kfree(vmidi);
 		return -ENOMEM;
 	}
+	if (rdev->flags & SNDRV_VIRMIDI_NO_STATUS)
+		snd_midi_event_no_status(vmidi->parser, 1);
 	vmidi->seq_mode = rdev->seq_mode;
 	vmidi->client = rdev->client;
 	vmidi->port = rdev->port;	
Index: alsa-kernel/drivers/virmidi.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/drivers/virmidi.c,v
retrieving revision 1.12
diff -u -r1.12 virmidi.c
--- alsa-kernel/drivers/virmidi.c	30 Jun 2004 14:20:20 -0000	1.12
+++ alsa-kernel/drivers/virmidi.c	8 Oct 2004 15:47:03 -0000
@@ -65,6 +65,7 @@
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0};
 static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4};
+static int no_status[SNDRV_CARDS];
 static int boot_devs;
 
 module_param_array(index, int, boot_devs, 0444);
@@ -75,6 +76,8 @@
 MODULE_PARM_DESC(enable, "Enable this soundcard.");
 module_param_array(midi_devs, int, boot_devs, 0444);
 MODULE_PARM_DESC(midi_devs, "MIDI devices # (1-8)");
+module_param_array(no_status, int, boot_devs, 0444);
+MODULE_PARM_DESC(no_status, "Add running-status always.");
 
 typedef struct snd_card_virmidi {
 	snd_card_t *card;
@@ -109,6 +112,8 @@
 		if ((err = snd_virmidi_new(card, idx, &rmidi)) < 0)
 			goto __nodev;
 		rdev = rmidi->private_data;
+		if (no_status[dev])
+			rdev->flags |= SNDRV_VIRMIDI_NO_STATUS;
 		vmidi->midi[idx] = rmidi;
 		strcpy(rmidi->name, "Virtual Raw MIDI");
 		rdev->seq_mode = SNDRV_VIRMIDI_SEQ_DISPATCH;
Index: alsa-kernel/include/seq_virmidi.h
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/include/seq_virmidi.h,v
retrieving revision 1.3
diff -u -r1.3 seq_virmidi.h
--- alsa-kernel/include/seq_virmidi.h	4 Jul 2002 09:41:50 -0000	1.3
+++ alsa-kernel/include/seq_virmidi.h	8 Oct 2004 15:46:42 -0000
@@ -47,6 +47,7 @@
 
 #define SNDRV_VIRMIDI_SUBSCRIBE		(1<<0)
 #define SNDRV_VIRMIDI_USE		(1<<1)
+#define SNDRV_VIRMIDI_NO_STATUS		(1<<2)
 
 /*
  * device record:

  reply	other threads:[~2004-10-08 15:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-08 15:26 rawmidi Patrick Dumais
2004-10-08 15:55 ` Takashi Iwai [this message]
2004-10-08 16:18 ` rawmidi Clemens Ladisch
2004-10-08 19:13 ` rawmidi Lee Revell
  -- strict thread matches above, loose matches on Subject: below --
2004-10-08 16:12 rawmidi Steve DeRosier
2004-10-08 16:20 ` rawmidi Patrick Dumais
2004-10-08 17:08 rawmidi Steve DeRosier
2004-10-09  9:41 ` rawmidi Clemens Ladisch
2015-12-27  6:29 Rawmidi Daniel Viksporre
2015-12-27  7:57 ` Rawmidi Takashi Sakamoto
2015-12-27  8:18 ` Rawmidi Clemens Ladisch
2015-12-27 15:22   ` Rawmidi Daniel Viksporre
2015-12-27 15:49     ` Rawmidi Takashi Sakamoto
2015-12-28 14:42       ` Rawmidi Rob van der Putten
2015-12-29 11:16         ` Rawmidi Rob van der Putten

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hk6u15hn4.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=pat@dumaisnet.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox