220 26175 <1e023fde-b641-4957-8420-d6426c0e6ebd@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: mlal1811@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Any interest to adding audio support to the std library?
Date: Sat, 4 Jun 2016 07:08:07 -0700 (PDT)
Lines: 125
Approved: news@gmane.org
Message-ID: <1e023fde-b641-4957-8420-d6426c0e6ebd@isocpp.org>
References: <5751B06A.4080501@mail1.stofanet.dk> <5290948.va25uYNizX@tjmaciei-mobl1>
 <CAEhD+6Ca=j3SaS5nC_Qe=6FGMdJLgpQd1LnGfiep8m9GrEU1jQ@mail.gmail.com>
 <1580229.cHEgQxCuA1@tjmaciei-mobl1> <CANh-dX=heKaWzvE+rk8FeCSTQyZ8-FR9UaGdam8quLaEuLJ=-A@mail.gmail.com>
 <62b7649a-5de5-4330-9bac-708375d36e2c@isocpp.org> <CAOcFa=fnWS=T2p6xgQ_EiCnVTmkSk_UrobDMYvXhaKi95cxrdQ@mail.gmail.com>
 <a27c2580-c766-4488-bc26-a7b15783e0fd@isocpp.org>
 <CAOcFa=ethRsOWP2QQeTtOdtQngEVdo5e29nX+SQAFzyxTdhJzA@mail.gmail.com>
 <4cfc7939-1ebf-415f-8ef4-d51e7cdadef5@isocpp.org>
 <239cb9ab-c5d5-4ce5-b876-b5220cc1e116@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1224_1162882466.1465049287909"
X-Trace: ger.gmane.org 1465049294 2791 80.91.229.3 (4 Jun 2016 14:08:14 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 4 Jun 2016 14:08:14 +0000 (UTC)
Cc: alexander.zywicki@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDG2JSELZQORBSOBZO5AKGQEWJUSGLI@isocpp.org Sat Jun 04 16:08:13 2016
Return-path: <std-proposals+bncBDG2JSELZQORBSOBZO5AKGQEWJUSGLI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qg0-f71.google.com ([209.85.192.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDG2JSELZQORBSOBZO5AKGQEWJUSGLI@isocpp.org>)
	id 1b9CFH-0004ZW-0H
	for gclcip-std-proposals@m.gmane.org; Sat, 04 Jun 2016 16:08:11 +0200
Original-Received: by mail-qg0-f71.google.com with SMTP id k63sf98367263qgf.2
        for <gclcip-std-proposals@m.gmane.org>; Sat, 04 Jun 2016 07:08:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=f7KU32He+n5rtr5C7oIK0TsmvdSCXyPqUS5z6O0kNYg=;
        b=EiucMz5HiES5/shnoqwAix5k0zSB2c3R+rwA5UU9XHESrdH3J7Jiy1GvmCUw3ohfKs
         lbWyinlh0SjqvNTtYaSnWUhPPe/UEwd6HzYVmpxs9ldHGwDtL2mEZArInAVORXErPICS
         KR2oZyOolLxnD3O2Wsu3LxIVcbgDmJKgyr+lK6fWvgiBC4uKqTrBooBtnhgbDsuOiSLe
         cAWI8VZz5Mj2jeBONtctLk0LWdYfw66zw0tRpX7aH8mvaEnDREPHi8RQNDaW+WlY47UG
         9TRAebtLnb+fqClLB0vM6k5Fzel5k2o9SlMB06D+iGd4gK69fym3I6K1ZfxCHpGArC63
         D18g==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=f7KU32He+n5rtr5C7oIK0TsmvdSCXyPqUS5z6O0kNYg=;
        b=aV0kqIgQqBS8H/KedI8lgmVqLvIt+B7eKy/xF/0daxxlTRrFujX2WRgtF6AxkEKfHe
         mMx0JaCq/dAcNtKm/gObNHndEdDh+x+im3XZT59PDpbEE8yEVFF0e7L2P8Tx227DcmaJ
         Zm4W1xWcHVWGwalNq9HFBIuHpbHgn2zMQaJDsq2d25e6h7iBv1BifVCi/HU9enh1x4aS
         HHcpiNtucWasrn81kUt8LmLgnNo6CvLBqPo0DPAg8vuvq/yWYRjWl/HPn8b3ax1tpz5C
         cWL4WHUQCt4nvXD2BpB/TJ1LMnhEXIQE0qkJYxrFUwMzJ2w3L8h77P/D9W/cZsxv95NC
         oOqw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=f7KU32He+n5rtr5C7oIK0TsmvdSCXyPqUS5z6O0kNYg=;
        b=CS493RjRlR3Vy7nx8nDVg/J7B3nyvEnNKhU9ZGZ9QbvqqNlWt2LPq98tHaN2sNf369
         p1KQ+niwD3w6FafYv/iBoilhNqOfi8tBa7V+ffoVe3Vd9TqHRlAyhZAhoiRGTca7gdS0
         YURF7Ag0VmKVMrkYCySRLWzrCLSNYZhqmstpVF6mn90itGtrmdsttc0SEygrF48Jx1CA
         +k7N/ff//pH5bO3g7eYIi6/QVzhG5w/3ZdDdUHC99FlQVGv5s6YLJSYwLSqYNOp+Jc3t
         bLJSSEaMAmT3K1UZtlui/G6yobqjRb8smdJu3VE5h3mCPwXjY3mefWgU9gZLqLK9uNqw
         PaCA==
X-Gm-Message-State: ALyK8tJRcc/sJrpsGeCp5PXP5sxHbQ+nWky1UogFJJyQr6Seg2nsQDLmJ1M3XOKuZQ7Jig==
X-Received: by 10.140.20.14 with SMTP id 14mr6240962qgi.7.1465049290098;
        Sat, 04 Jun 2016 07:08:10 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.73.204 with SMTP id e73ls239002itd.10.canary; Sat, 04 Jun
 2016 07:08:08 -0700 (PDT)
X-Received: by 10.36.17.140 with SMTP id 134mr10452itf.6.1465049288946;
        Sat, 04 Jun 2016 07:08:08 -0700 (PDT)
In-Reply-To: <239cb9ab-c5d5-4ce5-b876-b5220cc1e116@isocpp.org>
X-Original-Sender: mlal1811@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:26175
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26175>

------=_Part_1224_1162882466.1465049287909
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Saturday, June 4, 2016 at 1:28:01 AM UTC-5, Ron wrote:
> Some thoughts...
>=20
>=20
> 'N' should be runtime for channels in a frame and for a frame buffer. =C2=
=A0The buffer size might be negotiable with the device.
>=20
>=20
> I like a lot of that code in the original post, but I don't like the comp=
arison to iostreams. =C2=A0Its really the '>>' operator that I don't like. =
=C2=A0When you copy into your frame buffer, an '=3D' operator should be use=
d since anyone that sees an '=3D' operator knows its a copy. =C2=A0But real=
ly, you shouldn't need to move data around so much. =C2=A0If you stream fro=
m input to 'buff', then process and then move from 'buff' to output then yo=
u are moving a lot of data unnecessarily.
>=20
>=20
> I think what should happen is this; The process chain is triggered when t=
he output signals it is ready for data by calling the first linked process.=
 =C2=A0Starting at the output, each process kernel calls the previous until=
 it reaches the input where the input device/file/etc copies the data to th=
e chains frame buffer. =C2=A0Each process then operates on that single buff=
er in turn until finally returning to the output, thus altering the buffer =
instead of moving data from place to place. =C2=A0I like to think of the pr=
ocessing chain as starting from the output or destination. =C2=A0When the o=
utput is ready for data it calls to a linked process for information, it ca=
lls to the next link and so on until data begins to get processed. =C2=A0So=
 a bottom up approach, where the input doesn't officially start until the o=
utput is ready. =C2=A0I know it is opposite of the way audio really flows t=
hrough a system but it makes things easier then moving data like a bucket b=
rigade. =C2=A0It can also allow easier parallel processing when there are m=
ultiple branches on a node. =C2=A0So if you think of an audio mixer, where =
there are many inputs and a single output, the output calls to many channel=
s/nodes at once so they can all be processed in parallel and mixed together=
 after each of the processes end.
>=20
>=20
>=20
> Also, I'm not sure the word 'format' should be used to refer to files. =
=C2=A0I know people like to say "file format" but then, what format is the =
audio data in that is in the file format? =C2=A0Its just confusing, so I th=
ink 'container' is a better word for files. =C2=A0Then that leaves the word=
 format open for use as a way of describing the data format of an audio fra=
me buffer. =C2=A0So an audio_format class would contain information on samp=
le rate, channels, interleaving, channel routing and other information and =
a container class would deal with files.
>=20
>=20
> I personally would rather have all audio with greater than 2 or 3 channel=
s processed in Ambisonic-B format and then have the audio driver figure out=
 how to extract the channels for each speaker, but I know this won't fly wi=
th everyone so we would need a class for channel routing information as wel=
l.
>=20
>=20
> All I can think of at the moment..
>=20
>=20
>=20
>=20
>=20
>=20
> On Friday, June 3, 2016 at 9:08:45 PM UTC-7, alexande...@gmail.com wrote:
> I agree, how do you feel about the concept i proposed in my original abou=
t having std audio stream classes similar to std::fstream. The std::astream=
/iastream/oastream would represent the default audio device on the system a=
s determined by some method of polling the system. The user could either ch=
oose to use them as is or manually select a different device?
>=20
> On Friday, June 3, 2016 at 10:51:12 PM UTC-5, Ron wrote:
> Well, it needs to start somewhere.=C2=A0 I think having basic buffers usi=
ng std::array or plain old arrays might do for now and get some basic audio=
 recording and playback into C++.=C2=A0 It should be as simple as possible =
to get to the interfaces on the machine and make them work.=C2=A0 The data =
processing can build onto it with more complex primitives, templates and cl=
asses.=C2=A0 This way there is at least something semi-usable with code we =
have today while the rest of the building blocks are being worked on.=C2=A0=
 Just a thought though.


For the most part I agree with you, I think that using the << operator in t=
he callback would be confusing and ahold be replaced with =3D to be more cl=
ear, and that the callback parameters should be changed to be of type frame=
_buffer to keeps things simple. But I think that using the << operator for =
routing purposes still may be useful. Consider the situation where you woul=
d like to have multiple types of inputs/outputs or connect to multiple devi=
ces and need to specify which ones you are routing to and from. My intent t=
here was to provide an interface that allowed you to specify that your prog=
ram would take input from 0-N selected inputs and 0-N selected outputs if d=
esired.=20

I think using a pull model for determining order of operations could work i=
n most cases but it would be more complex if you desired a multi out situat=
ion. The model that worked best in theory for me in that situation was to t=
reat the signal flow as a graph and have each node in the graph keep track =
of its completion for the buffer period, the outputs would ask their depend=
ent nodes if they are done and if so take the result, in turn those nodes w=
ould ask their dependent nodes or inputs about completion until the graph r=
eaches all input or non dependent nodes. A friend of mine likened this to A=
* path finding without weighting certain paths. Each node waits on its depe=
ndents, which eventually will be a device input or a file. This all of cour=
se assumes support of a graph model that allows for dynamic connection of I=
/o, which I find to be desirable.=20

Do you think that multiple io should be supported?=20

Do you think that there needs to be some way of routing between the devices=
 and your program?

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/1e023fde-b641-4957-8420-d6426c0e6ebd%40isocpp.or=
g.

------=_Part_1224_1162882466.1465049287909--

.
