220 26176 <062a23c8-fff7-4e83-bc20-2b3523538977@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: alexander.zywicki@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:12:05 -0700 (PDT)
Lines: 126
Approved: news@gmane.org
Message-ID: <062a23c8-fff7-4e83-bc20-2b3523538977@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_1238_500414784.1465049525647"
X-Trace: ger.gmane.org 1465049529 6036 80.91.229.3 (4 Jun 2016 14:12:09 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 4 Jun 2016 14:12:09 +0000 (UTC)
Cc: alexander.zywicki@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCS7TY6DTQOBBNWDZO5AKGQEFVBXL2A@isocpp.org Sat Jun 04 16:12:09 2016
Return-path: <std-proposals+bncBCS7TY6DTQOBBNWDZO5AKGQEFVBXL2A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vk0-f72.google.com ([209.85.213.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCS7TY6DTQOBBNWDZO5AKGQEFVBXL2A@isocpp.org>)
	id 1b9CJ6-0008Jc-Gf
	for gclcip-std-proposals@m.gmane.org; Sat, 04 Jun 2016 16:12:08 +0200
Original-Received: by mail-vk0-f72.google.com with SMTP id f5sf25867085vkb.1
        for <gclcip-std-proposals@m.gmane.org>; Sat, 04 Jun 2016 07:12:08 -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=TeXZ2Regfu3wt89nqGEc6zFapt5cEWyDf5end5JoVmw=;
        b=b/p44tXW+IMZuUurT/oSSkXMh5PN7CkhoQbYZkU+hxEai7lmdq20AH+//toCu6xodu
         IihDzGS7sZzlLziLqIYfNimw8YMzoU+86cKKt8Ne/UzFnWW1y+3WnMkAErxXcHa2jCwA
         zhOfsB+mBgLO1BSLbOkdglhGSoDLBQwseva7Pen7grzUw0T0l9KgKQpWEUt9zRY7Sy6C
         Uo+QeRPy5pZt5Z3rWssKGpqAQsLB8dZSay60Myae5lYAas8es7VyC3MREU/d1bnHzmT/
         Y10V7KWrW2vlQ+kedF46KToLH6SmibUOnmuJZ8tGfd7yP4doR6eL2a+IofNIaUWwnkDG
         gXow==
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=TeXZ2Regfu3wt89nqGEc6zFapt5cEWyDf5end5JoVmw=;
        b=tRTLDKQx8AkiH7JCmMwOYE+SS9sy2tcUm0KxsmmgLAjIHXz+adx6qmMkoUAyIvWuOM
         4WIy12lI89AKo3bxoRME1eiZngfTlWS+Id6XUeXCJX9qqtaEGJYN9YE6XGyTWYmpIULs
         3DNI7iMWQAi7QxAbOjnkcdkaONGrlpvEhd6SrzVUj2JBUB+Rx+1n2BUK1aA0pGbKfuq6
         BWF7xhFAmdkZUoT10TGIPINhL9X5l60Was55oWjwlSuFtakB1vCwYOKXfccXI/aqBnCc
         iOjHq+rr2RmqC3cyOnwJh95peOfOpnL5cmApzo+sW0SRVVd2t6rxoF9YPBg1Pd+v48+B
         NuyQ==
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=TeXZ2Regfu3wt89nqGEc6zFapt5cEWyDf5end5JoVmw=;
        b=dRQ/6QyywJVRYiUpMUMkirOFtBg6JGZ6dDzD6d+1SJ90QfM+9Dk8eVuc2U1QgQp7Jb
         zjneQ0uP/ByYk4sXbfI6PBFwK97UaGFhB5ijcRFZjkr6wbIpKXKwMwR2NGk9NdaVYaOE
         4pF6dsA3HBBLbrVqQsSTMK6HWaa9+EYII5kh3rxZBL4CDauAERbqislLa4MW77IF9jGM
         kTQqFt2il/5NP7MarYT4bmWXhuxt56EiAaQlSHHzaHBZ18Kyg4lVM+GpUrsuf4T0IniX
         wEbShVLzG2Vy/kLGNHTOsnuwi/mzFvWygTusn7df0Zo7Ec6234WkxfoBMya/XFrdGekZ
         xzMw==
X-Gm-Message-State: ALyK8tJrqDpFWb64sv27zDX7ol45qVISrfRTcl+z/eIsdpMUD51bvObH+0ux9dNGFifC/w==
X-Received: by 10.129.82.1 with SMTP id g1mr6250604ywb.28.1465049527495;
        Sat, 04 Jun 2016 07:12:07 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.39.4 with SMTP id n4ls621100ion.26.gmail; Sat, 04 Jun 2016
 07:12:06 -0700 (PDT)
X-Received: by 10.36.57.131 with SMTP id l125mr123184ita.7.1465049526632;
        Sat, 04 Jun 2016 07:12:06 -0700 (PDT)
In-Reply-To: <239cb9ab-c5d5-4ce5-b876-b5220cc1e116@isocpp.org>
X-Original-Sender: alexander.zywicki@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:26176
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26176>

------=_Part_1238_500414784.1465049525647
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

- hide quoted text -
On Saturday, June 4, 2016 at 1:28:01 AM UTC-5, Ron wrote:=20
> Some thoughts...=20
>=20
>=20
> 'N' should be runtime for channels in a frame and for a frame buffer.  Th=
e buffer size might be negotiable with the device.=20
>=20
>=20
> I like a lot of that code in the original post, but I don't like the comp=
arison to iostreams.  Its really the '>>' operator that I don't like.  When=
 you copy into your frame buffer, an '=3D' operator should be used since an=
yone that sees an '=3D' operator knows its a copy.  But really, you shouldn=
't need to move data around so much.  If you stream from input to 'buff', t=
hen process and then move from 'buff' to output then you are moving a lot o=
f data unnecessarily.=20
>=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.=
  Starting at the output, each process kernel calls the previous until it r=
eaches the input where the input device/file/etc copies the data to the cha=
ins frame buffer.  Each process then operates on that single buffer in turn=
 until finally returning to the output, thus altering the buffer instead of=
 moving data from place to place.  I like to think of the processing chain =
as starting from the output or destination.  When the output is ready for d=
ata it calls to a linked process for information, it calls to the next link=
 and so on until data begins to get processed.  So a bottom up approach, wh=
ere the input doesn't officially start until the output is ready.  I know i=
t is opposite of the way audio really flows through a system but it makes t=
hings easier then moving data like a bucket brigade.  It can also allow eas=
ier parallel processing when there are multiple branches on a node.  So if =
you think of an audio mixer, where there are many inputs and a single outpu=
t, the output calls to many channels/nodes at once so they can all be proce=
ssed in parallel and mixed together after each of the processes end.=20
>=20
>=20
>=20
> Also, I'm not sure the word 'format' should be used to refer to files.  I=
 know people like to say "file format" but then, what format is the audio d=
ata in that is in the file format?  Its just confusing, so I think 'contain=
er' is a better word for files.  Then that leaves the word format open for =
use as a way of describing the data format of an audio frame buffer.  So an=
 audio_format class would contain information on sample rate, channels, int=
erleaving, channel routing and other information and a container class woul=
d deal with files.=20
>=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
>=20
> All I can think of at the moment..=20
>=20
>=20
>=20
>=20
>=20
>=20
> On Friday, June 3, 2016 at 9:08:45 PM UTC-7, alexande...@gmail.com wrote:=
=20
> 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
>=20
> On Friday, June 3, 2016 at 10:51:12 PM UTC-5, Ron wrote:=20
> Well, it needs to start somewhere.  I think having basic buffers using st=
d::array or plain old arrays might do for now and get some basic audio reco=
rding and playback into C++.  It should be as simple as possible to get to =
the interfaces on the machine and make them work.  The data processing can =
build onto it with more complex primitives, templates and classes.  This wa=
y there is at least something semi-usable with code we have today while the=
 rest of the building blocks are being worked on.  Just a thought though.=
=20


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/062a23c8-fff7-4e83-bc20-2b3523538977%40isocpp.or=
g.

------=_Part_1238_500414784.1465049525647--

.
