All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve deRosier <derosier@pianodisc.com>
To: Lee Revell <rlrevell@joe-job.com>
Cc: Alsa-Devel <alsa-devel@lists.sourceforge.net>
Subject: Re: How to tell how many frames gone to PCM
Date: Tue, 26 Apr 2005 14:07:51 -0700	[thread overview]
Message-ID: <426EADA7.4090200@pianodisc.com> (raw)
In-Reply-To: <1114546574.8431.13.camel@mindpipe>

Yeah, already doing that.  I was hoping there was something else I could use to confirm the numbers I'm getting.

Here's the problem...

In order to get my MIDI and audio to sync up, I found about 1.5 years ago I had to add +4 to my sample count per PERIOD_SIZE number of samples I sent to the PCM.  I calculate my midi out time via the number of samples I've sent to the PCM.  I never could account for the discrepancy, and eventually settled for the hack (with a big fat comment in the code and a bug note in our bugzilla) in order to get our first software version shipped.  As you might imagine, this has come back to haunt me periodically as we continue to maintain the software.  It could be I NEED to do what I do in the hack do to something I'm not realizing, but it bothers me when I've got to do something I don't understand and is not supported by the assumptions in the system.  It could be something I'm doing weird (say an off by one bug in the code), or that I'm not using alsa right, but I've not been able to find it.

Now I'm against the wall and I've got to solve the problem (or at least understand why I have to do what I'm doing).  

Using the return value seems to report the expected number of frames as what I sent.  Frankly I was hoping that I'm not sending the expected number of frames to the PCM, figuring that it would give me a string to pull on.

Any more ideas would be great.

Thanks,
- Steve

Lee Revell wrote:
> On Tue, 2005-04-26 at 13:18 -0700, Steve deRosier wrote:
> 
>> All,
>> 
>> I'm having issues w/ synchronizing MIDI and audio data I output via
>> Alsa.  I'm working through my program trying to confirm data flow
>> and I need some help.
>> 
>> Is there a particular function (or other method) I can use to tell
>> me the number of frames I have sent to alsa via snd_pcm_writei()?
>> 
> 
> 
> Just keep track of it yourself.  snd_pcm_writei() returns the number
> of frames written on each call, so keep a running total.
> 
> Lee
> 


-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix

  reply	other threads:[~2005-04-26 21:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-26 20:18 How to tell how many frames gone to PCM Steve deRosier
2005-04-26 20:16 ` Lee Revell
2005-04-26 21:07   ` Steve deRosier [this message]
2005-04-26 21:17     ` Lee Revell
2005-04-26 21:45       ` Steve deRosier
2005-04-27 14:36         ` Clemens Ladisch
2005-04-27 16:56           ` Steve deRosier
2005-04-27 17:22             ` Clemens Ladisch
2005-04-27 20:31               ` Steve deRosier
2005-04-28  8:25                 ` Clemens Ladisch
2005-05-02 18:04                   ` Steve deRosier
2005-05-03  8:05                     ` Clemens Ladisch
     [not found] ` <ad2655cb0504270201165f9859@mail.gmail.com>
2005-04-27 16:43   ` Steve deRosier

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=426EADA7.4090200@pianodisc.com \
    --to=derosier@pianodisc.com \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=rlrevell@joe-job.com \
    /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.