From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: rawmidi Date: Fri, 08 Oct 2004 17:55:27 +0200 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: multipart/mixed; boundary="Multipart_Fri_Oct__8_17:55:27_2004-1" Return-path: In-Reply-To: Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: pat@dumaisnet.ca Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org --Multipart_Fri_Oct__8_17:55:27_2004-1 Content-Type: text/plain; charset=US-ASCII 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 --Multipart_Fri_Oct__8_17:55:27_2004-1 Content-Type: text/plain; charset=US-ASCII 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: --Multipart_Fri_Oct__8_17:55:27_2004-1-- ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl