> I've been knocking my head against a wall for more than a year trying to
> figure out how to correctly mix two streams of audio while using
> libsndfile for input and libao for output.  My main requirement is that
> I cannot assume anything about the output drivers -- that is, I cannot
> depend on the output driver (ALSA, OSS, Sun, etc) being able to do the
> mixing for me.  Many of my target platforms lack any sort of mixing
> services.  I need to do this myself.  I tried starting a mixer/player
> thread that would work in a producer/consumer relationship with one or
> two audio file decoder threads.  I can play one sound at a time just
> fine. When I try to do both, I get distortion followed by a segfault.

Hi,

not sure if I understood correctly: do you just want to mix N files?

Like you I'm learning libsndfile and libao so this is my attempt to mix some audio files:

http://pastebin.com/dm7z8b3Z

HTH,
Andrea

P.S.
Can someone explain line 88 (I already read the sndfile FAQ)?

On Mon, May 16, 2016 at 11:30 PM, <linux-audio-dev-owner@lists.linuxaudio.org> wrote:
You are not allowed to post to this mailing list, and your message has
been automatically rejected.  If you think that your messages are
being rejected in error, contact the mailing list owner at
linux-audio-dev-owner@lists.linuxaudio.org.



---------- Forwarded message ----------
From: Andrea Del Signore <sejerpz@gmail.com>
To: linux-audio-dev@lists.linuxaudio.org
Cc: 
Date: Mon, 16 May 2016 21:26:40 +0000 (UTC)
Subject: Re: [LAD] mixing while using libao and libsndfile
On Sun, 15 May 2016 16:34:34 +0000, David Griffith wrote:

> I've been knocking my head against a wall for more than a year trying to
> figure out how to correctly mix two streams of audio while using
> libsndfile for input and libao for output.  My main requirement is that
> I cannot assume anything about the output drivers -- that is, I cannot
> depend on the output driver (ALSA, OSS, Sun, etc) being able to do the
> mixing for me.  Many of my target platforms lack any sort of mixing
> services.  I need to do this myself.  I tried starting a mixer/player
> thread that would work in a producer/consumer relationship with one or
> two audio file decoder threads.  I can play one sound at a time just
> fine. When I try to do both, I get distortion followed by a segfault.
>
> So, I'm back to a demo program.  What must I do to this program to cause
> it to start playing one audio file, then play another N seconds later?
>
> David Griffith dave@661.org
>

Hi,

not sure if I understood correctly: do you just want to mix N files?

I'm a noob with both libsndfile and libao :)

Here my code: http://pastebin.com/dm7z8b3Z

HTH,
Andrea

P.S.
Can someone explain line 88 (I already read the sndfile FAQ)?