All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haakon Riiser <haakon.riiser@fys.uio.no>
To: alsa-devel@lists.sourceforge.net
Subject: Re: SysEx overflow when using the MIDI sequencer event interface
Date: Sun, 20 Aug 2006 13:19:38 +0200	[thread overview]
Message-ID: <20060820111938.GA1577@fox> (raw)
In-Reply-To: <20060819200154.GA1054@fox>

> [...] I'm having trouble getting the big picture of how the MIDI
> parts in ALSA works, so a little help would be appreciated. :-)

Never mind, I finally sucked it up, and forced myself to do the
tedious task of tracking the MIDI events all the way from user
space to hardware, and discovered what the problem was:

Turns out that the buffer that overflows isn't a hardware buffer
in the CM-32L -- it's a software buffer in ALSA that is fixed to
a single page of memory (4096 bytes on x86).

This wouldn't be a problem if there were a mechanism that allowed
incoming events to wait until there's room in the output buffer,
or at least to fail with EAGAIN, allowing the application to retry.

What happens here is that the function in question returns ENOMEM
and prints a warning (but only if you enable ALSA debugging,
which, of course, I had not) saying that events are lost due to
buffer overflow.  Unfortunately, the return code is ignored by
the calling function, so the error is silently ignored.

I _really_ hope this isn't intentional, because it makes the
event interface too fragile to be useful.  I can fix this, but
there are many ways to go about doing it (for example waiting
for the buffer to drain, dynamically increasing buffer size,
or getting the error code propagated up the stack).  I'd like to
know what the authors think is the best solution, so that I can
get the fix into the official sources.

-- 
 Haakon

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

  reply	other threads:[~2006-08-20 11:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-19 10:24 SysEx overflow when using the MIDI sequencer event interface Haakon Riiser
2006-08-19 20:01 ` Haakon Riiser
2006-08-20 11:19   ` Haakon Riiser [this message]
2006-08-21  8:44     ` Clemens Ladisch
2006-08-21  9:34       ` Haakon Riiser
2006-08-21 11:03         ` Clemens Ladisch
2006-08-21 11:52           ` Haakon Riiser

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=20060820111938.GA1577@fox \
    --to=haakon.riiser@fys.uio.no \
    --cc=alsa-devel@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.