Topic: Any interest to adding audio support to the std library?


Author: alexander.zywicki@gmail.com
Date: Fri, 3 Jun 2016 02:37:30 -0700 (PDT)
Raw View
------=_Part_106_1145794443.1464946650460
Content-Type: multipart/alternative;
 boundary="----=_Part_107_48294388.1464946650462"

------=_Part_107_48294388.1464946650462
Content-Type: text/plain; charset=UTF-8

I have drafted some ideas on how I think the c++ std library could support
audio functionality.

I know that audio functionality is a very operating specific problem, but
with the recent trend towards implementing a file-system library and
possibly a graphics library I believe that audio would not be too much of a
reach anymore.

Here are some of the ideas I have so far. I have both some code examples of
the intended usage as well as a list of the types needed to implement the
given examples.

Please keep in mind my drafts are still very rough.


CODE EXAMPLES

//std::audio example 1 "single process"
void example_1(){
    double sample_rate = 44100;
    std::size_t frame_size =2;
    std::size_t buffer_size=128;

    std::audio_context<float> ctx{sample_rate,buffer_size,frame_size};//contruct
from values

    std::astream_process<float> proc(ctx,[](std::iastream const& input, std
::oastream& output){
        std::frame_buffer<float>& buff = ctx.borrow_buffer();//borrow a
buffer from the context for usage
        //prevents the need for dynamic allocation of a temporary buffer
        input>>buff;//stream data into buffer for manipulation
        for(auto&& frame: buff){
            frame=0.0;//do something with audio
        }
        output<<buff;//stream to output
    });//dsp object
    //uses implied routing equivilent to
    //std::aout<<proc<<std::ain;
    //

    proc.start();
    //do other stuff
    proc.stop();
}

//std::audio example 2 "process group"
void example_2(){

    std::audio_context<float> ctx;//default context created with
std::default_* values

    //version 1: capture context via lambda
    std::astream_process<float> proc1(ctx,[&ctx](std::iastream const& input,
std::oastream& output){
        std::frame_buffer<float>& buff = ctx.borrow_buffer();
        input>>buff;
        for(auto&& frame: buff){
            frame*=0.5;
        }
        output<<buff;
    });//dsp object

    //version 2: have context passed as argument
    std::astream_process<float> proc2(ctx,[](std::iastream const& input, std
::oastream& output,std::audio_context<float> const& context){
        std::frame_buffer<float>& buff = ctx.borrow_buffer();
        input>>buff;
        for(auto&& frame: buff){
            frame*=2.0;
        }
        output<<buff;
    });

    std::process_group<float> pgroup;//a group of processes that will
happen consecutivley
    pgroup.push(proc1);//add to group
    pgroup.push(proc2);//add to group

    //configure stream relationships in terms of std::ain / std:aout
manually
    //std::ain/std::aout are std::astream globals that refer to the default
audio inputs and outputs supplied by the context in use
    //std::ain/std::aout will route the audio to the enpoint specified by
the context reference held by the process that is streaming the data
    std::aout<<proc1<<proc2<<std::ain;//method 1
    //std::ain>>proc2>>proc1>>std::aout;//method 2

    pgroup.start();
    //do other stuff
    pgroup.stop();

}


//std::audio example 3 "audio files"
void example_3(){

    std::audio_context<float> ctx;

    std::astream_process<float> proc(ctx,[](std::iafstream const& input, std
::oafstream& output){
        std::frame_buffer<float>& buff = ctx.borrow_buffer();
        input>>buff;
        for(auto&& frame: buff){
            frame=0.0;
        }
        output<<buff;
    });//dsp object

    std::iafstream audio_file1(ctx,"filename1.extension");//an audio file
handle
    std::oafstream audio_file2(ctx,"filename2.extension");//an audio file
handle

    //routing
    audio_file2<<proc<<audio_file1;//take input from file nad write to file
    //audio_file1>>proc>>audio_file2;//equivilent syntax
    proc.start();
    //do other stuff
    proc.stop();
}


//std::audio example 4 "combination routing"
void example_3(){

    std::audio_context<float> ctx;
    //manually select hardware endpoints
    std::size_t device_id = ctx.default_device_id();
    std::iastream input_device = ctx.get_device<std::input_device>(device_id
);
    std::oastream output_device = ctx.get_device<std::output_device>(
device_id);

    std::astream_process<float> proc(ctx,[](std::iastream const& input,
                                            std::oastream& output,
                                            std::iafstream const& input_file
,
                                             std::oafstream& output_file){
        std::frame_buffer<float>& buff = ctx.borrow_buffer();
        (input + input_file)>>buff;//add streams to perform sum before
writing to buffer
        //or you could use seperate buffers
        //like this
        /*
            std::frame_buffer<float> buff1;
            std::frame_buffer<float> buff2;

            input>>buff1;
            input_file>>buff2;
            buff1+=buff2;//buffer arithmatic
        */
        output<<buff;//send the contents of buff to the hardware out and
the file out
        output_file<<buff;
    });

    std::iafstream audio_file1(ctx,"filename1.extension");//the actual
files to be used above
    std::oafstream audio_file2(ctx,"filename2.extension");

    //connect the files to the process
    //connect the hardware device to the process
    audio_file2<<proc<<audio_file1;//take input from file
    output_device<<proc<<input_device;//also take from hardware
    proc.start();
    //do other stuff
    proc.stop();
}



REQUIRED LIBRARY MEMBERS


namespace std{
    inline namespace audio{
        //working context for audio flow
        template<typename>
        class audio_context;
        /*
        *The context in which all audio data is centered.
        *Contains: sampling rate, buffer size, frame size, etc...
        *The values of ain,aout,afin,afout refer to the endpoints defined
by the context, when applied to routing on a porocess tied to the context
        *think of a context as the program level driver object
        */

        //audio streams (think like std::fstream and its friends)
        class astream;//audio stream
        class oastream;//output audio stream
        class iastream;//input audio stream
        class oafstream;//output audio file stream
        class iafstream;//input audio file stream


        //stream endpoints
        class ain;//audio input endpoint
        class aout;//audio output endpoint
        class afin;//audio file input endpoint
        class afout//audio file output endpoint

        //stream processing
        template<typename>
        class astream_process;//a dsp process applied to a stream

        template<typename>
        class process_group;//a group of processes that will act as one

        //containers
        template<typename>
        class frame_buffer;//a sequence container that is resizeable at
runtime, but only with explicit resize calls. contains frames(see below)
        /*Implementation note on frame_buffer
         *frame_buffer is intended to hold N number of frames which
themselves can hold M number of samples
         *meaning that the total size in samples if frame_buffer = N * M
         *ideally frame_buffers representation of its sample data will be
continuous in memory
        */

        template<typename>
        class frame;//a container that holds samples, thin array wrapper


        //hardware representation
        class device;//an audio device as recognized by the OS
        class input_device;//an input device
        class output_device;//an output device

        // audio file formats
        enum class afformat{
            raw,//raw headerless audio bytes, interpreted only by the
settings of the context.
            //best used for temporary storage within the life of a context
            wav,
            flac//etc...
        }
    }
}



--
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 email 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/f490fd21-cf07-4d7b-8936-c71c97a1ab9d%40isocpp.org.

------=_Part_107_48294388.1464946650462
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I have drafted some ideas on how I think the c++ std libra=
ry could support audio functionality. <br><br>I know that audio functionali=
ty is a very operating specific problem, but with the recent trend towards =
implementing a file-system library and possibly a graphics library I believ=
e that audio would not be too much of a reach anymore.<br><br>Here are some=
 of the ideas I have so far. I have both some code examples of the intended=
 usage as well as a list of the types needed to implement the given example=
s.<br><br>Please keep in mind my drafts are still very rough.<br><br><br>CO=
DE EXAMPLES<br><br><div class=3D"prettyprint" style=3D"background-color: rg=
b(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; bo=
rder-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div c=
lass=3D"subprettyprint"><span style=3D"color: #800;" class=3D"styled-by-pre=
ttify">//std::audio example 1 &quot;single process&quot;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> example_1</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">()</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">double</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> sample_rate </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by=
-prettify">44100</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
>=C2=A0 =C2=A0 std</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
size_t frame_size </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">=3D</span><span style=3D"color: #066;" class=3D"styled-by-prettify"=
>2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0=
 std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">size_t buffer_=
size</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</s=
pan><span style=3D"color: #066;" class=3D"styled-by-prettify">128</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 std</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">audio_context</span><=
span style=3D"color: #080;" class=3D"styled-by-prettify">&lt;float&gt;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> ctx</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">sample_rate</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">buffer_size</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">frame_size</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">};</span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">//contruct from values</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 std</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify">astream_process</span><span styl=
e=3D"color: #080;" class=3D"styled-by-prettify">&lt;float&gt;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> proc</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">ctx</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">,[](</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">std</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">iastream </span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">const</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
input</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">oastream</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> output</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">){</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">frame_buffer</span><span st=
yle=3D"color: #080;" class=3D"styled-by-prettify">&lt;float&gt;</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> buff </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> ctx</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">borrow_buffer</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">();</span><span style=3D"color: #800;" class=3D"=
styled-by-prettify">//borrow a buffer from the context for usage</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-prettify"=
>//prevents the need for dynamic allocation of a temporary buffer</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 input</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&gt;&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">buff</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>;</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//stream=
 data into buffer for manipulation</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">for</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">auto</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> frame</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> buff</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">){</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #06=
6;" class=3D"styled-by-prettify">0.0</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span><span style=3D"color: #800;" class=3D"sty=
led-by-prettify">//do something with audio</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 output</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">bu=
ff</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span>=
<span style=3D"color: #800;" class=3D"styled-by-prettify">//stream to outpu=
t</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>});</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//dsp =
object</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-pretti=
fy">//uses implied routing equivilent to</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">//std::aout&lt;&lt;proc&lt;&lt;std::a=
in;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-prettify"=
>//</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br=
>=C2=A0 =C2=A0 proc</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
start</span><span style=3D"color: #660;" class=3D"styled-by-prettify">();</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//d=
o other stuff</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>=C2=A0 =C2=A0 proc</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">.</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">stop</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
();</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span s=
tyle=3D"color: #800;" class=3D"styled-by-prettify">//std::audio example 2 &=
quot;process group&quot;</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> example_2</span><code class=3D"prettyprint"><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">()</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"></span></code><span style=3D"color: #660;" class=3D=
"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">audio_context</span><span style=3D"color: #080;" class=
=3D"styled-by-prettify">&lt;float&gt;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> ctx</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span><span style=3D"color: #800;" class=3D"styled-b=
y-prettify">//default context created with std::default_* values</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0=
 </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//version=
 1: capture context via lambda</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br>=C2=A0 =C2=A0 std</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">astream_process</span><span style=3D"color: #080;" =
class=3D"styled-by-prettify">&lt;float&gt;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> proc1</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">ctx</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">,[&amp;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">ctx</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">](</span><span style=3D"color: #000;" class=3D"styled-by-prettify">std</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">iastream </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">const</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> input</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">oastream</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> output</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">){</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">frame_buffer</span><span style=3D"color: #080;" class=3D"st=
yled-by-prettify">&lt;float&gt;</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> buff </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> ctx</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">borrow_buf=
fer</span><span style=3D"color: #660;" class=3D"styled-by-prettify">();</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 input</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">&gt;&gt;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">buff</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">for</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">auto</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp=
;&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> fra=
me</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> buff</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">){</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 frame</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">*=3D</span><span style=3D"color: #066;" class=3D"styled-by-pre=
ttify">0.5</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">buff</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">});</span><span style=3D"color: #800;" class=3D"st=
yled-by-prettify">//dsp object</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800=
;" class=3D"styled-by-prettify">//version 2: have context passed as argumen=
t</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 std</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">astr=
eam_process</span><span style=3D"color: #080;" class=3D"styled-by-prettify"=
>&lt;float&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> proc2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">ctx</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,[](</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">std</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">iastream </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">const</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> input</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>oastream</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&=
amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> outpu=
t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify">std</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">audio_context</span><span style=
=3D"color: #080;" class=3D"styled-by-prettify">&lt;float&gt;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">const</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> context</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">){</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">frame_buffer</span><span style=3D"co=
lor: #080;" class=3D"styled-by-prettify">&lt;float&gt;</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> buff </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> ctx</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">borrow_buffer</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">();</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 input</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&gt;&gt;</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify">buff</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">for</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">auto</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> frame</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">:</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> buff</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">){</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">*=3D</span><span style=3D"color: #066;=
" class=3D"styled-by-prettify">2.0</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">buff</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">});</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 std</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">process_group</span><span st=
yle=3D"color: #080;" class=3D"styled-by-prettify">&lt;float&gt;</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> pgroup</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"co=
lor: #800;" class=3D"styled-by-prettify">//a group of processes that will h=
appen consecutivley</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br>=C2=A0 =C2=A0 pgroup</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">push</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
proc1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</s=
pan><span style=3D"color: #800;" class=3D"styled-by-prettify">//add to grou=
p</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 pgroup</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">pu=
sh</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">proc2</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//add to group</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 </=
span><span style=3D"color: #800;" class=3D"styled-by-prettify">//configure =
stream relationships in terms of std::ain / std:aout manually</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span=
><span style=3D"color: #800;" class=3D"styled-by-prettify">//std::ain/std::=
aout are std::astream globals that refer to the default audio inputs and ou=
tputs supplied by the context in use</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #8=
00;" class=3D"styled-by-prettify">//std::ain/std::aout will route the audio=
 to the enpoint specified by the context reference held by the process that=
 is streaming the data</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br>=C2=A0 =C2=A0 std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">aout</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">proc1</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>proc2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;=
&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">std</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">ain</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">//method 1</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//std::ain&gt;&gt;proc2&gt;&=
gt;proc1&gt;&gt;std::aout;//method 2</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 pgroup</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">start</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">();</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800=
;" class=3D"styled-by-prettify">//do other stuff</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 pgroup</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify">stop</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">();</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br><br><br></span><span style=3D"color: #800;" class=3D=
"styled-by-prettify">//std::audio example 3 &quot;audio files&quot;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> example_3</span><code class=
=3D"prettyprint"><span style=3D"color: #660;" class=3D"styled-by-prettify">=
()</span><span style=3D"color: #660;" class=3D"styled-by-prettify"></span><=
/code><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=
=A0 std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">audio_conte=
xt</span><span style=3D"color: #080;" class=3D"styled-by-prettify">&lt;floa=
t&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ctx<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=
=A0 std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">astream_pro=
cess</span><span style=3D"color: #080;" class=3D"styled-by-prettify">&lt;fl=
oat&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> pr=
oc</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">ctx</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">,[](</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">std</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">iafstream </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">const</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> input</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">oaf=
stream</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> output</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">){</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 std</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">f=
rame_buffer</span><span style=3D"color: #080;" class=3D"styled-by-prettify"=
>&lt;float&gt;</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
buff </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ctx</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">borrow_buffer</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">();</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 input</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;=
&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">buff</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>for</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> frame</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">:</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> buff</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">){</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 f=
rame</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</s=
pan><span style=3D"color: #066;" class=3D"styled-by-prettify">0.0</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 output</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">buff</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">});</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//=
dsp object</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br><br>=C2=A0 =C2=A0 std</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">iafstream audio_file1</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">ctx</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">,</span><span style=3D"color: #080;" class=3D"styled-by-prettify">&quot;f=
ilename1.extension&quot;</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">);</span><span style=3D"color: #800;" class=3D"styled-by-pret=
tify">//an audio file handle</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>=C2=A0 =C2=A0 std</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">oafstream audio_file2</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">ctx</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #080;" class=3D"styled-by-pr=
ettify">&quot;filename2.extension&quot;</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">);</span><span style=3D"color: #800;" class=3D=
"styled-by-prettify">//an audio file handle</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//routing</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 audio_file=
2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">proc</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">audio_file1</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span styl=
e=3D"color: #800;" class=3D"styled-by-prettify">//take input from file nad =
write to file</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by=
-prettify">//audio_file1&gt;&gt;proc&gt;&gt;audio_file2;//equivilent syntax=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0=
 =C2=A0 proc</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">start</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">();</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 <=
/span><span style=3D"color: #800;" class=3D"styled-by-prettify">//do other =
stuff</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 proc</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">s=
top</span><span style=3D"color: #660;" class=3D"styled-by-prettify">();</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br><br></span><span sty=
le=3D"color: #800;" class=3D"styled-by-prettify">//std::audio example 4 &qu=
ot;combination routing&quot;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">void</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> example_3</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify"><code class=3D"prettyprint"><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">()</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify"></span></code>{</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">audio_context</span><span style=3D"color: #080;" class=
=3D"styled-by-prettify">&lt;float&gt;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> ctx</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"=
styled-by-prettify">//manually select hardware endpoints</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 std</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">size_t device_id </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> ctx</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">default_device_id</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">();</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 std</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">iastream input_device </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> ctx</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify">get_device</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">std</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">input_device</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&gt;(</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">device_id</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
>=C2=A0 =C2=A0 std</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
oastream output_device </span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> ctx</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
..</span><span style=3D"color: #000;" class=3D"styled-by-prettify">get_devic=
e</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify">std</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">output_device</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">device_id</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 std</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">astream_process</span><span =
style=3D"color: #080;" class=3D"styled-by-prettify">&lt;float&gt;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> proc</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">ctx</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">,[](</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">std</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify">iastream </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">const</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> input</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 s=
td</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">oastream</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> output</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">iafstream </span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">const</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> input_file</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">oafstream</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> output_file</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">){</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">frame_buffer</span><span style=3D"color: #080;" class=
=3D"styled-by-prettify">&lt;float&gt;</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> buff </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> ctx</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">bo=
rrow_buffer</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>();</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">input </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">+</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> inp=
ut_file</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)&g=
t;&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">buff=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><s=
pan style=3D"color: #800;" class=3D"styled-by-prettify">//add streams to pe=
rform sum before writing to buffer</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//or you could use seperate =
buffers</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"s=
tyled-by-prettify">//like this</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"c=
olor: #800;" class=3D"styled-by-prettify">/*<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 std::frame_buffer&lt;float&gt; buff1;<br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 std::frame_buffer&lt;float&gt; buff2;<br><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 input&gt;&gt;buff1;<br>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 input_file&gt;&gt;buff2;<br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 buff1+=3Dbuff2;//buffer arithmatic<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 */</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify">buff</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">;</span><span style=3D"color: #800;" class=3D=
"styled-by-prettify">//send the contents of buff to the hardware out and th=
e file out</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output_file</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">buff</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">});</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">iafstream audio_file1</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">ctx</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">,</span><span style=3D"color: #080;" class=3D"styled-by-=
prettify">&quot;filename1.extension&quot;</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">);</span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">//the actual files to be used above</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 std</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">oafstream audio_file2</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">ctx</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color=
: #080;" class=3D"styled-by-prettify">&quot;filename2.extension&quot;</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 </=
span><span style=3D"color: #800;" class=3D"styled-by-prettify">//connect th=
e files to the process</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"=
styled-by-prettify">//connect the hardware device to the process</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 aud=
io_file2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&l=
t;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">proc=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">audio_file1<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><sp=
an style=3D"color: #800;" class=3D"styled-by-prettify">//take input from fi=
le</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 output_device</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">proc</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">input_device</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">;</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//a=
lso take from hardware</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br>=C2=A0 =C2=A0 proc</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">start</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">();</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by=
-prettify">//do other stuff</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br>=C2=A0 =C2=A0 proc</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">stop</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">();</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>}</span></div></code></div><br><br><br>REQUIRED LIBRARY MEMBERS<br><br><br=
><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); =
border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; w=
ord-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyp=
rint"><span style=3D"color: #008;" class=3D"styled-by-prettify">namespace</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">inline</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">namespace</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> audio</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span s=
tyle=3D"color: #800;" class=3D"styled-by-prettify">//working context for au=
dio flow</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">template</span><span style=3D"color: #080;" class=3D"st=
yled-by-prettify">&lt;typename&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> audio_context</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </spa=
n><span style=3D"color: #800;" class=3D"styled-by-prettify">/*<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 *The context in which all audio data is centered.<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 *Contains: sampling rate, buffer size, frame si=
ze, etc...<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 *The values of ain,aout,afin,afou=
t refer to the endpoints defined by the context, when applied to routing on=
 a porocess tied to the context<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 *think of a =
context as the program level driver object<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=
/</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"st=
yled-by-prettify">//audio streams (think like std::fstream and its friends)=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">class</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> astream</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">;</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//au=
dio stream</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">class</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> oastream</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">;</span><span style=3D"color: #800;" class=3D"styled-by-p=
rettify">//output audio stream</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">class</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> iastream</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #800;" cl=
ass=3D"styled-by-prettify">//input audio stream</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> oafstream</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//output audio file stream</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">class</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> iafstream</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">;</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//i=
nput audio file stream</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br><br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"c=
olor: #800;" class=3D"styled-by-prettify">//stream endpoints</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">cla=
ss</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ain</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span =
style=3D"color: #800;" class=3D"styled-by-prettify">//audio input endpoint<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">class</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> aout</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>;</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//audio =
output endpoint</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">class</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> afin</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">;</span><span style=3D"color: #800;" class=3D"styled-by-=
prettify">//audio file input endpoint</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> afout</span><span style=3D"col=
or: #800;" class=3D"styled-by-prettify">//audio file output endpoint</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by=
-prettify">//stream processing</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">template</span><span style=3D"col=
or: #080;" class=3D"styled-by-prettify">&lt;typename&gt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">class<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> astream_pr=
ocess</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #800;" class=3D"styled-by-prettify">//a dsp proces=
s applied to a stream</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:=
 #008;" class=3D"styled-by-prettify">template</span><span style=3D"color: #=
080;" class=3D"styled-by-prettify">&lt;typename&gt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> process_group</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span=
 style=3D"color: #800;" class=3D"styled-by-prettify">//a group of processes=
 that will act as one</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:=
 #800;" class=3D"styled-by-prettify">//containers</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">template</span=
><span style=3D"color: #080;" class=3D"styled-by-prettify">&lt;typename&gt;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">class</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> frame_buffer</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span><span style=3D"color: #800;" class=3D"styled-by-prettify"=
>//a sequence container that is resizeable at runtime, but only with explic=
it resize calls. contains frames(see below)</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><sp=
an style=3D"color: #800;" class=3D"styled-by-prettify">/*Implementation not=
e on frame_buffer<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*frame_buffer is int=
ended to hold N number of frames which themselves can hold M number of samp=
les<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*meaning that the total size in sa=
mples if frame_buffer =3D N * M<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*ideal=
ly frame_buffers representation of its sample data will be continuous in me=
mory<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 */</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">template</span><span =
style=3D"color: #080;" class=3D"styled-by-prettify">&lt;typename&gt;</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">class</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 frame</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</s=
pan><span style=3D"color: #800;" class=3D"styled-by-prettify">//a container=
 that holds samples, thin array wrapper</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br><br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span=
><span style=3D"color: #800;" class=3D"styled-by-prettify">//hardware repre=
sentation</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">class</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> device</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">;</span><span style=3D"color: #800;" class=3D"styled-by-pretti=
fy">//an audio device as recognized by the OS</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> input_device</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//an input device</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> out=
put_device</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
;</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//an outp=
ut device</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #800;" clas=
s=3D"styled-by-prettify">// audio file formats</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">enum</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">class</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> afformat</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 r=
aw</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span>=
<span style=3D"color: #800;" class=3D"styled-by-prettify">//raw headerless =
audio bytes, interpreted only by the settings of the context.</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-b=
y-prettify">//best used for temporary storage within the life of a context<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 wav</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 flac</span=
><span style=3D"color: #800;" class=3D"styled-by-prettify">//etc...</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span></d=
iv></code></div><br><br><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f490fd21-cf07-4d7b-8936-c71c97a1ab9d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f490fd21-cf07-4d7b-8936-c71c97a1ab9d=
%40isocpp.org</a>.<br />

------=_Part_107_48294388.1464946650462--

------=_Part_106_1145794443.1464946650460
Content-Type: text/plain; charset=US-ASCII; name=required_code.txt
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=required_code.txt
X-Attachment-Id: 016a0680-963e-4a3b-88d0-072500b189b3
Content-ID: <016a0680-963e-4a3b-88d0-072500b189b3>



namespace std{
    inline namespace audio{
        //working context for audio flow
        template<typename>
        class audio_context;
        /*
        *The context in which all audio data is centered.
        *Contains: sampling rate, buffer size, frame size, etc...
        *The values of ain,aout,afin,afout refer to the endpoints defined by the context, when applied to routing on a porocess tied to the context
        *think of a context as the program level driver object
        */

        //audio streams (think like std::fstream and its friends)
        class astream;//audio stream
        class oastream;//output audio stream
        class iastream;//input audio stream
        class oafstream;//output audio file stream
        class iafstream;//input audio file stream


        //stream endpoints
        class ain;//audio input endpoint
        class aout;//audio output endpoint
        class afin;//audio file input endpoint
        class afout//audio file output endpoint

        //stream processing
        template<typename>
        class astream_process;//a dsp process applied to a stream

        template<typename>
        class process_group;//a group of processes that will act as one

        //containers
        template<typename>
        class frame_buffer;//a sequence container that is resizeable at runtime, but only with explicit resize calls. contains frames(see below)
        /*Implementation note on frame_buffer
         *frame_buffer is intended to hold N number of frames which themselves can hold M number of samples
         *meaning that the total size in samples if frame_buffer = N * M
         *ideally frame_buffers representation of its sample data will be continuous in memory
        */

        template<typename>
        class frame;//a container that holds samples, thin array wrapper


        //hardware representation
        class device;//an audio device as recognized by the OS
        class input_device;//an input device
        class output_device;//an output device

        // audio file formats
        enum class afformat{
            raw,//raw headerless audio bytes, interpreted only by the settings of the context.
            //best used for temporary storage within the life of a context
            wav,
            flac//etc...
        }







    }
}

------=_Part_106_1145794443.1464946650460
Content-Type: text/plain; charset=US-ASCII; name=usage_ideas.txt
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=usage_ideas.txt
X-Attachment-Id: 6a7d2a02-1a72-4e10-b0b7-e2fea8e12483
Content-ID: <6a7d2a02-1a72-4e10-b0b7-e2fea8e12483>



//std::audio example 1 "single process"
void example_1{
    double sample_rate = 44100;
    std::size_t frame_size =2;
    std::size_t buffer_size=128;

    std::audio_context<float> ctx{sample_rate,buffer_size,frame_size};//contruct from values

    std::astream_process<float> proc(ctx,[](std::iastream const& input, std::oastream& output){
        std::frame_buffer<float>& buff = ctx.borrow_buffer();//borrow a buffer from the context for usage
        //prevents the need for dynamic allocation of a temporary buffer
        input>>buff;//stream data into buffer for manipulation
        for(auto&& frame: buff){
            frame=0.0;//do something with audio
        }
        output<<buff;//stream to output
    });//dsp object
    //uses implied routing equivilent to
    //std::aout<<proc<<std::ain;
    //

    proc.start();
    //do other stuff
    proc.stop();
}

//std::audio example 2 "process group"
void example_2{

    std::audio_context<float> ctx;//default context created with std::default_* values

    //version 1: capture context via lambda
    std::astream_process<float> proc1(ctx,[&ctx](std::iastream const& input, std::oastream& output){
        std::frame_buffer<float>& buff = ctx.borrow_buffer();
        input>>buff;
        for(auto&& frame: buff){
            frame*=0.5;
        }
        output<<buff;
    });//dsp object

    //version 2: have context passed as argument
    std::astream_process<float> proc2(ctx,[](std::iastream const& input, std::oastream& output,std::audio_context<float> const& context){
        std::frame_buffer<float>& buff = ctx.borrow_buffer();
        input>>buff;
        for(auto&& frame: buff){
            frame*=2.0;
        }
        output<<buff;
    });

    std::process_group<float> pgroup;//a group of processes that will happen consecutivley
    pgroup.push(proc1);//add to group
    pgroup.push(proc2);//add to group

    //configure stream relationships in terms of std::ain / std:aout manually
    //std::ain/std::aout are std::astream globals that refer to the default audio inputs and outputs supplied by the context in use
    //std::ain/std::aout will route the audio to the enpoint specified by the context reference held by the process that is streaming the data
    std::aout<<proc1<<proc2<<std::ain;//method 1
    //std::ain>>proc2>>proc1>>std::aout;//method 2

    pgroup.start();
    //do other stuff
    pgroup.stop();

}


//std::audio example 3 "audio files"
void example_3{

    std::audio_context<float> ctx;

    std::astream_process<float> proc(ctx,[](std::iafstream const& input, std::oafstream& output){
        std::frame_buffer<float>& buff = ctx.borrow_buffer();
        input>>buff;
        for(auto&& frame: buff){
            frame=0.0;
        }
        output<<buff;
    });//dsp object

    std::iafstream audio_file1(ctx,"filename1.extension");//an audio file handle
    std::oafstream audio_file2(ctx,"filename2.extension");//an audio file handle

    //routing
    audio_file2<<proc<<audio_file1;//take input from file nad write to file
    //audio_file1>>proc>>audio_file2;//equivilent syntax
    proc.start();
    //do other stuff
    proc.stop();
}


//std::audio example 4 "combination routing"
void example_3{

    std::audio_context<float> ctx;
    //manually select hardware endpoints
    std::size_t device_id = ctx.default_device_id();
    std::iastream input_device = ctx.get_device<std::input_device>(device_id);
    std::oastream output_device = ctx.get_device<std::output_device>(device_id);

    std::astream_process<float> proc(ctx,[](std::iastream const& input,
                                            std::oastream& output,
                                            std::iafstream const& input_file,
                                             std::oafstream& output_file){
        std::frame_buffer<float>& buff = ctx.borrow_buffer();
        (input + input_file)>>buff;//add streams to perform sum before writing to buffer
        //or you could use seperate buffers
        //like this
        /*
            std::frame_buffer<float> buff1;
            std::frame_buffer<float> buff2;

            input>>buff1;
            input_file>>buff2;
            buff1+=buff2;//buffer arithmatic
        */
        output<<buff;//send the contents of buff to the hardware out and the file out
        output_file<<buff;
    });

    std::iafstream audio_file1(ctx,"filename1.extension");//the actual files to be used above
    std::oafstream audio_file2(ctx,"filename2.extension");

    //connect the files to the process
    //connect the hardware device to the process
    audio_file2<<proc<<audio_file1;//take input from file
    output_device<<proc<<input_device;//also take from hardware
    proc.start();
    //do other stuff
    proc.stop();
}

------=_Part_106_1145794443.1464946650460--

.


Author: =?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?= <mjklaim@gmail.com>
Date: Fri, 3 Jun 2016 12:46:28 +0200
Raw View
--001a11442370639c4a05345d6fb9
Content-Type: text/plain; charset=UTF-8

You might want to forward this at least to SG13 (HMI group).



On 3 June 2016 at 11:37, <alexander.zywicki@gmail.com> wrote:

> I have drafted some ideas on how I think the c++ std library could support
> audio functionality.
>
> I know that audio functionality is a very operating specific problem, but
> with the recent trend towards implementing a file-system library and
> possibly a graphics library I believe that audio would not be too much of a
> reach anymore.
>
> Here are some of the ideas I have so far. I have both some code examples
> of the intended usage as well as a list of the types needed to implement
> the given examples.
>
> Please keep in mind my drafts are still very rough.
>
>
> CODE EXAMPLES
>
> //std::audio example 1 "single process"
> void example_1(){
>     double sample_rate = 44100;
>     std::size_t frame_size =2;
>     std::size_t buffer_size=128;
>
>     std::audio_context<float> ctx{sample_rate,buffer_size,frame_size};//contruct
> from values
>
>     std::astream_process<float> proc(ctx,[](std::iastream const& input,
> std::oastream& output){
>         std::frame_buffer<float>& buff = ctx.borrow_buffer();//borrow a
> buffer from the context for usage
>         //prevents the need for dynamic allocation of a temporary buffer
>         input>>buff;//stream data into buffer for manipulation
>         for(auto&& frame: buff){
>             frame=0.0;//do something with audio
>         }
>         output<<buff;//stream to output
>     });//dsp object
>     //uses implied routing equivilent to
>     //std::aout<<proc<<std::ain;
>     //
>
>     proc.start();
>     //do other stuff
>     proc.stop();
> }
>
> //std::audio example 2 "process group"
> void example_2(){
>
>     std::audio_context<float> ctx;//default context created with
> std::default_* values
>
>     //version 1: capture context via lambda
>     std::astream_process<float> proc1(ctx,[&ctx](std::iastream const&
> input, std::oastream& output){
>         std::frame_buffer<float>& buff = ctx.borrow_buffer();
>         input>>buff;
>         for(auto&& frame: buff){
>             frame*=0.5;
>         }
>         output<<buff;
>     });//dsp object
>
>     //version 2: have context passed as argument
>     std::astream_process<float> proc2(ctx,[](std::iastream const& input,
> std::oastream& output,std::audio_context<float> const& context){
>         std::frame_buffer<float>& buff = ctx.borrow_buffer();
>         input>>buff;
>         for(auto&& frame: buff){
>             frame*=2.0;
>         }
>         output<<buff;
>     });
>
>     std::process_group<float> pgroup;//a group of processes that will
> happen consecutivley
>     pgroup.push(proc1);//add to group
>     pgroup.push(proc2);//add to group
>
>     //configure stream relationships in terms of std::ain / std:aout
> manually
>     //std::ain/std::aout are std::astream globals that refer to the
> default audio inputs and outputs supplied by the context in use
>     //std::ain/std::aout will route the audio to the enpoint specified by
> the context reference held by the process that is streaming the data
>     std::aout<<proc1<<proc2<<std::ain;//method 1
>     //std::ain>>proc2>>proc1>>std::aout;//method 2
>
>     pgroup.start();
>     //do other stuff
>     pgroup.stop();
>
> }
>
>
> //std::audio example 3 "audio files"
> void example_3(){
>
>     std::audio_context<float> ctx;
>
>     std::astream_process<float> proc(ctx,[](std::iafstream const& input,
> std::oafstream& output){
>         std::frame_buffer<float>& buff = ctx.borrow_buffer();
>         input>>buff;
>         for(auto&& frame: buff){
>             frame=0.0;
>         }
>         output<<buff;
>     });//dsp object
>
>     std::iafstream audio_file1(ctx,"filename1.extension");//an audio file
> handle
>     std::oafstream audio_file2(ctx,"filename2.extension");//an audio file
> handle
>
>     //routing
>     audio_file2<<proc<<audio_file1;//take input from file nad write to
> file
>     //audio_file1>>proc>>audio_file2;//equivilent syntax
>     proc.start();
>     //do other stuff
>     proc.stop();
> }
>
>
> //std::audio example 4 "combination routing"
> void example_3(){
>
>     std::audio_context<float> ctx;
>     //manually select hardware endpoints
>     std::size_t device_id = ctx.default_device_id();
>     std::iastream input_device = ctx.get_device<std::input_device>(
> device_id);
>     std::oastream output_device = ctx.get_device<std::output_device>(
> device_id);
>
>     std::astream_process<float> proc(ctx,[](std::iastream const& input,
>                                             std::oastream& output,
>                                             std::iafstream const&
> input_file,
>                                              std::oafstream& output_file){
>         std::frame_buffer<float>& buff = ctx.borrow_buffer();
>         (input + input_file)>>buff;//add streams to perform sum before
> writing to buffer
>         //or you could use seperate buffers
>         //like this
>         /*
>             std::frame_buffer<float> buff1;
>             std::frame_buffer<float> buff2;
>
>             input>>buff1;
>             input_file>>buff2;
>             buff1+=buff2;//buffer arithmatic
>         */
>         output<<buff;//send the contents of buff to the hardware out and
> the file out
>         output_file<<buff;
>     });
>
>     std::iafstream audio_file1(ctx,"filename1.extension");//the actual
> files to be used above
>     std::oafstream audio_file2(ctx,"filename2.extension");
>
>     //connect the files to the process
>     //connect the hardware device to the process
>     audio_file2<<proc<<audio_file1;//take input from file
>     output_device<<proc<<input_device;//also take from hardware
>     proc.start();
>     //do other stuff
>     proc.stop();
> }
>
>
>
> REQUIRED LIBRARY MEMBERS
>
>
> namespace std{
>     inline namespace audio{
>         //working context for audio flow
>         template<typename>
>         class audio_context;
>         /*
>         *The context in which all audio data is centered.
>         *Contains: sampling rate, buffer size, frame size, etc...
>         *The values of ain,aout,afin,afout refer to the endpoints defined
> by the context, when applied to routing on a porocess tied to the context
>         *think of a context as the program level driver object
>         */
>
>         //audio streams (think like std::fstream and its friends)
>         class astream;//audio stream
>         class oastream;//output audio stream
>         class iastream;//input audio stream
>         class oafstream;//output audio file stream
>         class iafstream;//input audio file stream
>
>
>         //stream endpoints
>         class ain;//audio input endpoint
>         class aout;//audio output endpoint
>         class afin;//audio file input endpoint
>         class afout//audio file output endpoint
>
>         //stream processing
>         template<typename>
>         class astream_process;//a dsp process applied to a stream
>
>         template<typename>
>         class process_group;//a group of processes that will act as one
>
>         //containers
>         template<typename>
>         class frame_buffer;//a sequence container that is resizeable at
> runtime, but only with explicit resize calls. contains frames(see below)
>         /*Implementation note on frame_buffer
>          *frame_buffer is intended to hold N number of frames which
> themselves can hold M number of samples
>          *meaning that the total size in samples if frame_buffer = N * M
>          *ideally frame_buffers representation of its sample data will be
> continuous in memory
>         */
>
>         template<typename>
>         class frame;//a container that holds samples, thin array wrapper
>
>
>         //hardware representation
>         class device;//an audio device as recognized by the OS
>         class input_device;//an input device
>         class output_device;//an output device
>
>         // audio file formats
>         enum class afformat{
>             raw,//raw headerless audio bytes, interpreted only by the
> settings of the context.
>             //best used for temporary storage within the life of a context
>             wav,
>             flac//etc...
>         }
>     }
> }
>
>
>
> --
> 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
> email 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/f490fd21-cf07-4d7b-8936-c71c97a1ab9d%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f490fd21-cf07-4d7b-8936-c71c97a1ab9d%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>

--
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 email 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/CAOU91OOHbnRDM0u2mcp-U04y85WvW7wbLr7xvR4zGBNG%3D7wfUg%40mail.gmail.com.

--001a11442370639c4a05345d6fb9
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">You might want to forward this at least to SG13 (HMI group=
).<div><br></div><div><br></div></div><div class=3D"gmail_extra"><br><div c=
lass=3D"gmail_quote">On 3 June 2016 at 11:37,  <span dir=3D"ltr">&lt;<a hre=
f=3D"mailto:alexander.zywicki@gmail.com" target=3D"_blank">alexander.zywick=
i@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div di=
r=3D"ltr">I have drafted some ideas on how I think the c++ std library coul=
d support audio functionality. <br><br>I know that audio functionality is a=
 very operating specific problem, but with the recent trend towards impleme=
nting a file-system library and possibly a graphics library I believe that =
audio would not be too much of a reach anymore.<br><br>Here are some of the=
 ideas I have so far. I have both some code examples of the intended usage =
as well as a list of the types needed to implement the given examples.<br><=
br>Please keep in mind my drafts are still very rough.<br><br><br>CODE EXAM=
PLES<br><br><div style=3D"background-color:rgb(250,250,250);border-color:rg=
b(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><c=
ode><div><span style=3D"color:#800">//std::audio example 1 &quot;single pro=
cess&quot;</span><span style=3D"color:#000"><br></span><span style=3D"color=
:#008">void</span><span style=3D"color:#000"> example_1</span><span style=
=3D"color:#660">()</span><span style=3D"color:#660">{</span><span style=3D"=
color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">double</spa=
n><span style=3D"color:#000"> sample_rate </span><span style=3D"color:#660"=
>=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#066">44=
100</span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br=
>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=3D=
"color:#000">size_t frame_size </span><span style=3D"color:#660">=3D</span>=
<span style=3D"color:#066">2</span><span style=3D"color:#660">;</span><span=
 style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660=
">::</span><span style=3D"color:#000">size_t buffer_size</span><span style=
=3D"color:#660">=3D</span><span style=3D"color:#066">128</span><span style=
=3D"color:#660">;</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 st=
d</span><span style=3D"color:#660">::</span><span style=3D"color:#000">audi=
o_context</span><span style=3D"color:#080">&lt;float&gt;</span><span style=
=3D"color:#000"> ctx</span><span style=3D"color:#660">{</span><span style=
=3D"color:#000">sample_rate</span><span style=3D"color:#660">,</span><span =
style=3D"color:#000">buffer_size</span><span style=3D"color:#660">,</span><=
span style=3D"color:#000">frame_size</span><span style=3D"color:#660">};</s=
pan><span style=3D"color:#800">//contruct from values</span><span style=3D"=
color:#000"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</=
span><span style=3D"color:#000">astream_process</span><span style=3D"color:=
#080">&lt;float&gt;</span><span style=3D"color:#000"> proc</span><span styl=
e=3D"color:#660">(</span><span style=3D"color:#000">ctx</span><span style=
=3D"color:#660">,[](</span><span style=3D"color:#000">std</span><span style=
=3D"color:#660">::</span><span style=3D"color:#000">iastream </span><span s=
tyle=3D"color:#008">const</span><span style=3D"color:#660">&amp;</span><spa=
n style=3D"color:#000"> input</span><span style=3D"color:#660">,</span><spa=
n style=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span=
 style=3D"color:#000">oastream</span><span style=3D"color:#660">&amp;</span=
><span style=3D"color:#000"> output</span><span style=3D"color:#660">){</sp=
an><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><sp=
an style=3D"color:#660">::</span><span style=3D"color:#000">frame_buffer</s=
pan><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#66=
0">&amp;</span><span style=3D"color:#000"> buff </span><span style=3D"color=
:#660">=3D</span><span style=3D"color:#000"> ctx</span><span style=3D"color=
:#660">.</span><span style=3D"color:#000">borrow_buffer</span><span style=
=3D"color:#660">();</span><span style=3D"color:#800">//borrow a buffer from=
 the context for usage</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 </span><span style=3D"color:#800">//prevents the need for dyn=
amic allocation of a temporary buffer</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 input</span><span style=3D"color:#660">&gt;&gt;=
</span><span style=3D"color:#000">buff</span><span style=3D"color:#660">;</=
span><span style=3D"color:#800">//stream data into buffer for manipulation<=
/span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><sp=
an style=3D"color:#008">for</span><span style=3D"color:#660">(</span><span =
style=3D"color:#008">auto</span><span style=3D"color:#660">&amp;&amp;</span=
><span style=3D"color:#000"> frame</span><span style=3D"color:#660">:</span=
><span style=3D"color:#000"> buff</span><span style=3D"color:#660">){</span=
><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 f=
rame</span><span style=3D"color:#660">=3D</span><span style=3D"color:#066">=
0.0</span><span style=3D"color:#660">;</span><span style=3D"color:#800">//d=
o something with audio</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span style=3D"color:#=
660">&lt;&lt;</span><span style=3D"color:#000">buff</span><span style=3D"co=
lor:#660">;</span><span style=3D"color:#800">//stream to output</span><span=
 style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">}=
);</span><span style=3D"color:#800">//dsp object</span><span style=3D"color=
:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">//uses implied r=
outing equivilent to</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color:#800">//std::aout&lt;&lt;proc&lt;&lt;std::ain;</sp=
an><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color=
:#800">//</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 proc</span=
><span style=3D"color:#660">.</span><span style=3D"color:#000">start</span>=
<span style=3D"color:#660">();</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:#800">//do other stuff</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 proc</span><span style=3D"color:#660">.</=
span><span style=3D"color:#000">stop</span><span style=3D"color:#660">();</=
span><span style=3D"color:#000"><br></span><span style=3D"color:#660">}</sp=
an><span style=3D"color:#000"><br><br></span><span style=3D"color:#800">//s=
td::audio example 2 &quot;process group&quot;</span><span style=3D"color:#0=
00"><br></span><span style=3D"color:#008">void</span><span style=3D"color:#=
000"> example_2</span><code><span style=3D"color:#660">()</span><span style=
=3D"color:#660"></span></code><span style=3D"color:#660">{</span><span styl=
e=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660"=
>::</span><span style=3D"color:#000">audio_context</span><span style=3D"col=
or:#080">&lt;float&gt;</span><span style=3D"color:#000"> ctx</span><span st=
yle=3D"color:#660">;</span><span style=3D"color:#800">//default context cre=
ated with std::default_* values</span><span style=3D"color:#000"><br><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#800">//version 1: capture contex=
t via lambda</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><=
span style=3D"color:#660">::</span><span style=3D"color:#000">astream_proce=
ss</span><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"colo=
r:#000"> proc1</span><span style=3D"color:#660">(</span><span style=3D"colo=
r:#000">ctx</span><span style=3D"color:#660">,[&amp;</span><span style=3D"c=
olor:#000">ctx</span><span style=3D"color:#660">](</span><span style=3D"col=
or:#000">std</span><span style=3D"color:#660">::</span><span style=3D"color=
:#000">iastream </span><span style=3D"color:#008">const</span><span style=
=3D"color:#660">&amp;</span><span style=3D"color:#000"> input</span><span s=
tyle=3D"color:#660">,</span><span style=3D"color:#000"> std</span><span sty=
le=3D"color:#660">::</span><span style=3D"color:#000">oastream</span><span =
style=3D"color:#660">&amp;</span><span style=3D"color:#000"> output</span><=
span style=3D"color:#660">){</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span st=
yle=3D"color:#000">frame_buffer</span><span style=3D"color:#080">&lt;float&=
gt;</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"=
> buff </span><span style=3D"color:#660">=3D</span><span style=3D"color:#00=
0"> ctx</span><span style=3D"color:#660">.</span><span style=3D"color:#000"=
>borrow_buffer</span><span style=3D"color:#660">();</span><span style=3D"co=
lor:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 input</span><span style=3D"color:=
#660">&gt;&gt;</span><span style=3D"color:#000">buff</span><span style=3D"c=
olor:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:#008">for</span><span style=3D"color:#660">=
(</span><span style=3D"color:#008">auto</span><span style=3D"color:#660">&a=
mp;&amp;</span><span style=3D"color:#000"> frame</span><span style=3D"color=
:#660">:</span><span style=3D"color:#000"> buff</span><span style=3D"color:=
#660">){</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 frame</span><span style=3D"color:#660">*=3D</span><span style=
=3D"color:#066">0.5</span><span style=3D"color:#660">;</span><span style=3D=
"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#6=
60">}</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 outp=
ut</span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#00=
0">buff</span><span style=3D"color:#660">;</span><span style=3D"color:#000"=
><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">});</span><span style=
=3D"color:#800">//dsp object</span><span style=3D"color:#000"><br><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:#800">//version 2: have context pass=
ed as argument</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span=
><span style=3D"color:#660">::</span><span style=3D"color:#000">astream_pro=
cess</span><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"co=
lor:#000"> proc2</span><span style=3D"color:#660">(</span><span style=3D"co=
lor:#000">ctx</span><span style=3D"color:#660">,[](</span><span style=3D"co=
lor:#000">std</span><span style=3D"color:#660">::</span><span style=3D"colo=
r:#000">iastream </span><span style=3D"color:#008">const</span><span style=
=3D"color:#660">&amp;</span><span style=3D"color:#000"> input</span><span s=
tyle=3D"color:#660">,</span><span style=3D"color:#000"> std</span><span sty=
le=3D"color:#660">::</span><span style=3D"color:#000">oastream</span><span =
style=3D"color:#660">&amp;</span><span style=3D"color:#000"> output</span><=
span style=3D"color:#660">,</span><span style=3D"color:#000">std</span><spa=
n style=3D"color:#660">::</span><span style=3D"color:#000">audio_context</s=
pan><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#008">const</span><span style=3D"color:#660=
">&amp;</span><span style=3D"color:#000"> context</span><span style=3D"colo=
r:#660">){</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 std</span><span style=3D"color:#660">::</span><span style=3D"color:#000">f=
rame_buffer</span><span style=3D"color:#080">&lt;float&gt;</span><span styl=
e=3D"color:#660">&amp;</span><span style=3D"color:#000"> buff </span><span =
style=3D"color:#660">=3D</span><span style=3D"color:#000"> ctx</span><span =
style=3D"color:#660">.</span><span style=3D"color:#000">borrow_buffer</span=
><span style=3D"color:#660">();</span><span style=3D"color:#000"><br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 input</span><span style=3D"color:#660">&gt;&gt;</span=
><span style=3D"color:#000">buff</span><span style=3D"color:#660">;</span><=
span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span styl=
e=3D"color:#008">for</span><span style=3D"color:#660">(</span><span style=
=3D"color:#008">auto</span><span style=3D"color:#660">&amp;&amp;</span><spa=
n style=3D"color:#000"> frame</span><span style=3D"color:#660">:</span><spa=
n style=3D"color:#000"> buff</span><span style=3D"color:#660">){</span><spa=
n style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame<=
/span><span style=3D"color:#660">*=3D</span><span style=3D"color:#066">2.0<=
/span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span st=
yle=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span style=
=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000">buff</span><span =
style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 <=
/span><span style=3D"color:#660">});</span><span style=3D"color:#000"><br><=
br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=
=3D"color:#000">process_group</span><span style=3D"color:#080">&lt;float&gt=
;</span><span style=3D"color:#000"> pgroup</span><span style=3D"color:#660"=
>;</span><span style=3D"color:#800">//a group of processes that will happen=
 consecutivley</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 pgroup</s=
pan><span style=3D"color:#660">.</span><span style=3D"color:#000">push</spa=
n><span style=3D"color:#660">(</span><span style=3D"color:#000">proc1</span=
><span style=3D"color:#660">);</span><span style=3D"color:#800">//add to gr=
oup</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 pgroup</span><span s=
tyle=3D"color:#660">.</span><span style=3D"color:#000">push</span><span sty=
le=3D"color:#660">(</span><span style=3D"color:#000">proc2</span><span styl=
e=3D"color:#660">);</span><span style=3D"color:#800">//add to group</span><=
span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color=
:#800">//configure stream relationships in terms of std::ain / std:aout man=
ually</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color:#800">//std::ain/std::aout are std::astream globals that refer to=
 the default audio inputs and outputs supplied by the context in use</span>=
<span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#8=
00">//std::ain/std::aout will route the audio to the enpoint specified by t=
he context reference held by the process that is streaming the data</span><=
span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:=
#660">::</span><span style=3D"color:#000">aout</span><span style=3D"color:#=
660">&lt;&lt;</span><span style=3D"color:#000">proc1</span><span style=3D"c=
olor:#660">&lt;&lt;</span><span style=3D"color:#000">proc2</span><span styl=
e=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000">std</span><span =
style=3D"color:#660">::</span><span style=3D"color:#000">ain</span><span st=
yle=3D"color:#660">;</span><span style=3D"color:#800">//method 1</span><spa=
n style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">=
//std::ain&gt;&gt;proc2&gt;&gt;proc1&gt;&gt;std::aout;//method 2</span><spa=
n style=3D"color:#000"><br><br>=C2=A0 =C2=A0 pgroup</span><span style=3D"co=
lor:#660">.</span><span style=3D"color:#000">start</span><span style=3D"col=
or:#660">();</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><spa=
n style=3D"color:#800">//do other stuff</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 pgroup</span><span style=3D"color:#660">.</span><span style=
=3D"color:#000">stop</span><span style=3D"color:#660">();</span><span style=
=3D"color:#000"><br><br></span><span style=3D"color:#660">}</span><span sty=
le=3D"color:#000"><br><br><br></span><span style=3D"color:#800">//std::audi=
o example 3 &quot;audio files&quot;</span><span style=3D"color:#000"><br></=
span><span style=3D"color:#008">void</span><span style=3D"color:#000"> exam=
ple_3</span><code><span style=3D"color:#660">()</span><span style=3D"color:=
#660"></span></code><span style=3D"color:#660">{</span><span style=3D"color=
:#000"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span>=
<span style=3D"color:#000">audio_context</span><span style=3D"color:#080">&=
lt;float&gt;</span><span style=3D"color:#000"> ctx</span><span style=3D"col=
or:#660">;</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span=
><span style=3D"color:#660">::</span><span style=3D"color:#000">astream_pro=
cess</span><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"co=
lor:#000"> proc</span><span style=3D"color:#660">(</span><span style=3D"col=
or:#000">ctx</span><span style=3D"color:#660">,[](</span><span style=3D"col=
or:#000">std</span><span style=3D"color:#660">::</span><span style=3D"color=
:#000">iafstream </span><span style=3D"color:#008">const</span><span style=
=3D"color:#660">&amp;</span><span style=3D"color:#000"> input</span><span s=
tyle=3D"color:#660">,</span><span style=3D"color:#000"> std</span><span sty=
le=3D"color:#660">::</span><span style=3D"color:#000">oafstream</span><span=
 style=3D"color:#660">&amp;</span><span style=3D"color:#000"> output</span>=
<span style=3D"color:#660">){</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span st=
yle=3D"color:#000">frame_buffer</span><span style=3D"color:#080">&lt;float&=
gt;</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"=
> buff </span><span style=3D"color:#660">=3D</span><span style=3D"color:#00=
0"> ctx</span><span style=3D"color:#660">.</span><span style=3D"color:#000"=
>borrow_buffer</span><span style=3D"color:#660">();</span><span style=3D"co=
lor:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 input</span><span style=3D"color:=
#660">&gt;&gt;</span><span style=3D"color:#000">buff</span><span style=3D"c=
olor:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:#008">for</span><span style=3D"color:#660">=
(</span><span style=3D"color:#008">auto</span><span style=3D"color:#660">&a=
mp;&amp;</span><span style=3D"color:#000"> frame</span><span style=3D"color=
:#660">:</span><span style=3D"color:#000"> buff</span><span style=3D"color:=
#660">){</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 frame</span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#066">0.0</span><span style=3D"color:#660">;</span><span style=3D=
"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#6=
60">}</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 outp=
ut</span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#00=
0">buff</span><span style=3D"color:#660">;</span><span style=3D"color:#000"=
><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">});</span><span style=
=3D"color:#800">//dsp object</span><span style=3D"color:#000"><br><br>=C2=
=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=3D"col=
or:#000">iafstream audio_file1</span><span style=3D"color:#660">(</span><sp=
an style=3D"color:#000">ctx</span><span style=3D"color:#660">,</span><span =
style=3D"color:#080">&quot;filename1.extension&quot;</span><span style=3D"c=
olor:#660">);</span><span style=3D"color:#800">//an audio file handle</span=
><span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"colo=
r:#660">::</span><span style=3D"color:#000">oafstream audio_file2</span><sp=
an style=3D"color:#660">(</span><span style=3D"color:#000">ctx</span><span =
style=3D"color:#660">,</span><span style=3D"color:#080">&quot;filename2.ext=
ension&quot;</span><span style=3D"color:#660">);</span><span style=3D"color=
:#800">//an audio file handle</span><span style=3D"color:#000"><br><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:#800">//routing</span><span style=3D=
"color:#000"><br>=C2=A0 =C2=A0 audio_file2</span><span style=3D"color:#660"=
>&lt;&lt;</span><span style=3D"color:#000">proc</span><span style=3D"color:=
#660">&lt;&lt;</span><span style=3D"color:#000">audio_file1</span><span sty=
le=3D"color:#660">;</span><span style=3D"color:#800">//take input from file=
 nad write to file</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </spa=
n><span style=3D"color:#800">//audio_file1&gt;&gt;proc&gt;&gt;audio_file2;/=
/equivilent syntax</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 proc<=
/span><span style=3D"color:#660">.</span><span style=3D"color:#000">start</=
span><span style=3D"color:#660">();</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#800">//do other stuff</span><spa=
n style=3D"color:#000"><br>=C2=A0 =C2=A0 proc</span><span style=3D"color:#6=
60">.</span><span style=3D"color:#000">stop</span><span style=3D"color:#660=
">();</span><span style=3D"color:#000"><br></span><span style=3D"color:#660=
">}</span><span style=3D"color:#000"><br><br><br></span><span style=3D"colo=
r:#800">//std::audio example 4 &quot;combination routing&quot;</span><span =
style=3D"color:#000"><br></span><span style=3D"color:#008">void</span><span=
 style=3D"color:#000"> example_3</span><span style=3D"color:#660"><code><sp=
an style=3D"color:#660">()</span><span style=3D"color:#660"></span></code>{=
</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span><span sty=
le=3D"color:#660">::</span><span style=3D"color:#000">audio_context</span><=
span style=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#000"> c=
tx</span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#800">//manually select hardware =
endpoints</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><spa=
n style=3D"color:#660">::</span><span style=3D"color:#000">size_t device_id=
 </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> ct=
x</span><span style=3D"color:#660">.</span><span style=3D"color:#000">defau=
lt_device_id</span><span style=3D"color:#660">();</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><sp=
an style=3D"color:#000">iastream input_device </span><span style=3D"color:#=
660">=3D</span><span style=3D"color:#000"> ctx</span><span style=3D"color:#=
660">.</span><span style=3D"color:#000">get_device</span><span style=3D"col=
or:#660">&lt;</span><span style=3D"color:#000">std</span><span style=3D"col=
or:#660">::</span><span style=3D"color:#000">input_device</span><span style=
=3D"color:#660">&gt;(</span><span style=3D"color:#000">device_id</span><spa=
n style=3D"color:#660">);</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 std</span><span style=3D"color:#660">::</span><span style=3D"color:#000=
">oastream output_device </span><span style=3D"color:#660">=3D</span><span =
style=3D"color:#000"> ctx</span><span style=3D"color:#660">.</span><span st=
yle=3D"color:#000">get_device</span><span style=3D"color:#660">&lt;</span><=
span style=3D"color:#000">std</span><span style=3D"color:#660">::</span><sp=
an style=3D"color:#000">output_device</span><span style=3D"color:#660">&gt;=
(</span><span style=3D"color:#000">device_id</span><span style=3D"color:#66=
0">);</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span><spa=
n style=3D"color:#660">::</span><span style=3D"color:#000">astream_process<=
/span><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#=
000"> proc</span><span style=3D"color:#660">(</span><span style=3D"color:#0=
00">ctx</span><span style=3D"color:#660">,[](</span><span style=3D"color:#0=
00">std</span><span style=3D"color:#660">::</span><span style=3D"color:#000=
">iastream </span><span style=3D"color:#008">const</span><span style=3D"col=
or:#660">&amp;</span><span style=3D"color:#000"> input</span><span style=3D=
"color:#660">,</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span=
 style=3D"color:#660">::</span><span style=3D"color:#000">oastream</span><s=
pan style=3D"color:#660">&amp;</span><span style=3D"color:#000"> output</sp=
an><span style=3D"color:#660">,</span><span style=3D"color:#000"><br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 s=
td</span><span style=3D"color:#660">::</span><span style=3D"color:#000">iaf=
stream </span><span style=3D"color:#008">const</span><span style=3D"color:#=
660">&amp;</span><span style=3D"color:#000"> input_file</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0std</span=
><span style=3D"color:#660">::</span><span style=3D"color:#000">oafstream</=
span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"> out=
put_file</span><span style=3D"color:#660">){</span><span style=3D"color:#00=
0"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color:#660">::<=
/span><span style=3D"color:#000">frame_buffer</span><span style=3D"color:#0=
80">&lt;float&gt;</span><span style=3D"color:#660">&amp;</span><span style=
=3D"color:#000"> buff </span><span style=3D"color:#660">=3D</span><span sty=
le=3D"color:#000"> ctx</span><span style=3D"color:#660">.</span><span style=
=3D"color:#000">borrow_buffer</span><span style=3D"color:#660">();</span><s=
pan style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=
=3D"color:#660">(</span><span style=3D"color:#000">input </span><span style=
=3D"color:#660">+</span><span style=3D"color:#000"> input_file</span><span =
style=3D"color:#660">)&gt;&gt;</span><span style=3D"color:#000">buff</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#800">//add streams=
 to perform sum before writing to buffer</span><span style=3D"color:#000"><=
br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">//or you c=
ould use seperate buffers</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">//like this</span><span=
 style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D=
"color:#800">/*<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::frame_buf=
fer&lt;float&gt; buff1;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::f=
rame_buffer&lt;float&gt; buff2;<br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 input&gt;&gt;buff1;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 inp=
ut_file&gt;&gt;buff2;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 buff1+=
=3Dbuff2;//buffer arithmatic<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 */</span><span =
style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span sty=
le=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000">buff</span><spa=
n style=3D"color:#660">;</span><span style=3D"color:#800">//send the conten=
ts of buff to the hardware out and the file out</span><span style=3D"color:=
#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output_file</span><span style=3D"colo=
r:#660">&lt;&lt;</span><span style=3D"color:#000">buff</span><span style=3D=
"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><s=
pan style=3D"color:#660">});</span><span style=3D"color:#000"><br><br>=C2=
=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=3D"col=
or:#000">iafstream audio_file1</span><span style=3D"color:#660">(</span><sp=
an style=3D"color:#000">ctx</span><span style=3D"color:#660">,</span><span =
style=3D"color:#080">&quot;filename1.extension&quot;</span><span style=3D"c=
olor:#660">);</span><span style=3D"color:#800">//the actual files to be use=
d above</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><span =
style=3D"color:#660">::</span><span style=3D"color:#000">oafstream audio_fi=
le2</span><span style=3D"color:#660">(</span><span style=3D"color:#000">ctx=
</span><span style=3D"color:#660">,</span><span style=3D"color:#080">&quot;=
filename2.extension&quot;</span><span style=3D"color:#660">);</span><span s=
tyle=3D"color:#000"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800"=
>//connect the files to the process</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#800">//connect the hardware devi=
ce to the process</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 audio_=
file2</span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:=
#000">proc</span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"c=
olor:#000">audio_file1</span><span style=3D"color:#660">;</span><span style=
=3D"color:#800">//take input from file</span><span style=3D"color:#000"><br=
>=C2=A0 =C2=A0 output_device</span><span style=3D"color:#660">&lt;&lt;</spa=
n><span style=3D"color:#000">proc</span><span style=3D"color:#660">&lt;&lt;=
</span><span style=3D"color:#000">input_device</span><span style=3D"color:#=
660">;</span><span style=3D"color:#800">//also take from hardware</span><sp=
an style=3D"color:#000"><br>=C2=A0 =C2=A0 proc</span><span style=3D"color:#=
660">.</span><span style=3D"color:#000">start</span><span style=3D"color:#6=
60">();</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span sty=
le=3D"color:#800">//do other stuff</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 proc</span><span style=3D"color:#660">.</span><span style=3D"col=
or:#000">stop</span><span style=3D"color:#660">();</span><span style=3D"col=
or:#000"><br></span><span style=3D"color:#660">}</span></div></code></div><=
br><br><br>REQUIRED LIBRARY MEMBERS<br><br><br><div style=3D"background-col=
or:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border=
-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#008">name=
space</span><span style=3D"color:#000"> std</span><span style=3D"color:#660=
">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color:#008">inline</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">namespace</span><span style=3D"color:#000"> audio</span><sp=
an style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">//working context for a=
udio flow</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
</span><span style=3D"color:#008">template</span><span style=3D"color:#080"=
>&lt;typename&gt;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 </span><span style=3D"color:#008">class</span><span style=3D"color:=
#000"> audio_context</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color=
:#800">/*<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 *The context in which all audio da=
ta is centered.<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 *Contains: sampling rate, bu=
ffer size, frame size, etc...<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 *The values of=
 ain,aout,afin,afout refer to the endpoints defined by the context, when ap=
plied to routing on a porocess tied to the context<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 *think of a context as the program level driver object<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 */</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 </span><span style=3D"color:#800">//audio streams (think lik=
e std::fstream and its friends)</span><span style=3D"color:#000"><br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span><span s=
tyle=3D"color:#000"> astream</span><span style=3D"color:#660">;</span><span=
 style=3D"color:#800">//audio stream</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span><=
span style=3D"color:#000"> oastream</span><span style=3D"color:#660">;</spa=
n><span style=3D"color:#800">//output audio stream</span><span style=3D"col=
or:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">=
class</span><span style=3D"color:#000"> iastream</span><span style=3D"color=
:#660">;</span><span style=3D"color:#800">//input audio stream</span><span =
style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"=
color:#008">class</span><span style=3D"color:#000"> oafstream</span><span s=
tyle=3D"color:#660">;</span><span style=3D"color:#800">//output audio file =
stream</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </s=
pan><span style=3D"color:#008">class</span><span style=3D"color:#000"> iafs=
tream</span><span style=3D"color:#660">;</span><span style=3D"color:#800">/=
/input audio file stream</span><span style=3D"color:#000"><br><br><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">//stream endpoin=
ts</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span>=
<span style=3D"color:#008">class</span><span style=3D"color:#000"> ain</spa=
n><span style=3D"color:#660">;</span><span style=3D"color:#800">//audio inp=
ut endpoint</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:#008">class</span><span style=3D"color:#000=
"> aout</span><span style=3D"color:#660">;</span><span style=3D"color:#800"=
>//audio output endpoint</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span><span style=3D=
"color:#000"> afin</span><span style=3D"color:#660">;</span><span style=3D"=
color:#800">//audio file input endpoint</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span=
><span style=3D"color:#000"> afout</span><span style=3D"color:#800">//audio=
 file output endpoint</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">//stream processing</sp=
an><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span =
style=3D"color:#008">template</span><span style=3D"color:#080">&lt;typename=
&gt;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </spa=
n><span style=3D"color:#008">class</span><span style=3D"color:#000"> astrea=
m_process</span><span style=3D"color:#660">;</span><span style=3D"color:#80=
0">//a dsp process applied to a stream</span><span style=3D"color:#000"><br=
><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">template=
</span><span style=3D"color:#080">&lt;typename&gt;</span><span style=3D"col=
or:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">=
class</span><span style=3D"color:#000"> process_group</span><span style=3D"=
color:#660">;</span><span style=3D"color:#800">//a group of processes that =
will act as one</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span style=3D"color:#800">//containers</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color=
:#008">template</span><span style=3D"color:#080">&lt;typename&gt;</span><sp=
an style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=
=3D"color:#008">class</span><span style=3D"color:#000"> frame_buffer</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#800">//a sequence =
container that is resizeable at runtime, but only with explicit resize call=
s. contains frames(see below)</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">/*Implementation not=
e on frame_buffer<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*frame_buffer is int=
ended to hold N number of frames which themselves can hold M number of samp=
les<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*meaning that the total size in sa=
mples if frame_buffer =3D N * M<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*ideal=
ly frame_buffers representation of its sample data will be continuous in me=
mory<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 */</span><span style=3D"color:#000"><br=
><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">template=
</span><span style=3D"color:#080">&lt;typename&gt;</span><span style=3D"col=
or:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">=
class</span><span style=3D"color:#000"> frame</span><span style=3D"color:#6=
60">;</span><span style=3D"color:#800">//a container that holds samples, th=
in array wrapper</span><span style=3D"color:#000"><br><br><br>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 </span><span style=3D"color:#800">//hardware representation<=
/span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><sp=
an style=3D"color:#008">class</span><span style=3D"color:#000"> device</spa=
n><span style=3D"color:#660">;</span><span style=3D"color:#800">//an audio =
device as recognized by the OS</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span><span st=
yle=3D"color:#000"> input_device</span><span style=3D"color:#660">;</span><=
span style=3D"color:#800">//an input device</span><span style=3D"color:#000=
"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</=
span><span style=3D"color:#000"> output_device</span><span style=3D"color:#=
660">;</span><span style=3D"color:#800">//an output device</span><span styl=
e=3D"color:#000"><br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"=
color:#800">// audio file formats</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">enum</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#008">class</span><span =
style=3D"color:#000"> afformat</span><span style=3D"color:#660">{</span><sp=
an style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 raw</=
span><span style=3D"color:#660">,</span><span style=3D"color:#800">//raw he=
aderless audio bytes, interpreted only by the settings of the context.</spa=
n><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
</span><span style=3D"color:#800">//best used for temporary storage within =
the life of a context</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 wav</span><span style=3D"color:#660">,</span><s=
pan style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 flac=
</span><span style=3D"color:#800">//etc...</span><span style=3D"color:#000"=
><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span>=
<span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#6=
60">}</span><span style=3D"color:#000"><br></span><span style=3D"color:#660=
">}</span></div></code></div><span class=3D"HOEnZb"><font color=3D"#888888"=
><br><br><br></font></span></div><span class=3D"HOEnZb"><font color=3D"#888=
888">

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f490fd21-cf07-4d7b-8936-c71c97a1ab9d%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f490fd21-cf07-=
4d7b-8936-c71c97a1ab9d%40isocpp.org</a>.<br>
</font></span></blockquote></div><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAOU91OOHbnRDM0u2mcp-U04y85WvW7wbLr7x=
vR4zGBNG%3D7wfUg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOU91OOHbnRDM0=
u2mcp-U04y85WvW7wbLr7xvR4zGBNG%3D7wfUg%40mail.gmail.com</a>.<br />

--001a11442370639c4a05345d6fb9--

.


Author: "'Jeffrey Yasskin' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Fri, 3 Jun 2016 08:43:21 -0700
Raw View
Is this based on an existing library? We're much more likely to adopt
a proposal that's been used widely than one that was invented for the
standard.

On Fri, Jun 3, 2016 at 2:37 AM,  <alexander.zywicki@gmail.com> wrote:
> I have drafted some ideas on how I think the c++ std library could support
> audio functionality.
>
> I know that audio functionality is a very operating specific problem, but
> with the recent trend towards implementing a file-system library and
> possibly a graphics library I believe that audio would not be too much of a
> reach anymore.
>
> Here are some of the ideas I have so far. I have both some code examples of
> the intended usage as well as a list of the types needed to implement the
> given examples.
>
> Please keep in mind my drafts are still very rough.
>
>
> CODE EXAMPLES
>
> //std::audio example 1 "single process"
> void example_1(){
>     double sample_rate = 44100;
>     std::size_t frame_size =2;
>     std::size_t buffer_size=128;
>
>     std::audio_context<float>
> ctx{sample_rate,buffer_size,frame_size};//contruct from values
>
>     std::astream_process<float> proc(ctx,[](std::iastream const& input,
> std::oastream& output){
>         std::frame_buffer<float>& buff = ctx.borrow_buffer();//borrow a
> buffer from the context for usage
>         //prevents the need for dynamic allocation of a temporary buffer
>         input>>buff;//stream data into buffer for manipulation
>         for(auto&& frame: buff){
>             frame=0.0;//do something with audio
>         }
>         output<<buff;//stream to output
>     });//dsp object
>     //uses implied routing equivilent to
>     //std::aout<<proc<<std::ain;
>     //
>
>     proc.start();
>     //do other stuff
>     proc.stop();
> }
>
> //std::audio example 2 "process group"
> void example_2(){
>
>     std::audio_context<float> ctx;//default context created with
> std::default_* values
>
>     //version 1: capture context via lambda
>     std::astream_process<float> proc1(ctx,[&ctx](std::iastream const& input,
> std::oastream& output){
>         std::frame_buffer<float>& buff = ctx.borrow_buffer();
>         input>>buff;
>         for(auto&& frame: buff){
>             frame*=0.5;
>         }
>         output<<buff;
>     });//dsp object
>
>     //version 2: have context passed as argument
>     std::astream_process<float> proc2(ctx,[](std::iastream const& input,
> std::oastream& output,std::audio_context<float> const& context){
>         std::frame_buffer<float>& buff = ctx.borrow_buffer();
>         input>>buff;
>         for(auto&& frame: buff){
>             frame*=2.0;
>         }
>         output<<buff;
>     });
>
>     std::process_group<float> pgroup;//a group of processes that will happen
> consecutivley
>     pgroup.push(proc1);//add to group
>     pgroup.push(proc2);//add to group
>
>     //configure stream relationships in terms of std::ain / std:aout
> manually
>     //std::ain/std::aout are std::astream globals that refer to the default
> audio inputs and outputs supplied by the context in use
>     //std::ain/std::aout will route the audio to the enpoint specified by
> the context reference held by the process that is streaming the data
>     std::aout<<proc1<<proc2<<std::ain;//method 1
>     //std::ain>>proc2>>proc1>>std::aout;//method 2
>
>     pgroup.start();
>     //do other stuff
>     pgroup.stop();
>
> }
>
>
> //std::audio example 3 "audio files"
> void example_3(){
>
>     std::audio_context<float> ctx;
>
>     std::astream_process<float> proc(ctx,[](std::iafstream const& input,
> std::oafstream& output){
>         std::frame_buffer<float>& buff = ctx.borrow_buffer();
>         input>>buff;
>         for(auto&& frame: buff){
>             frame=0.0;
>         }
>         output<<buff;
>     });//dsp object
>
>     std::iafstream audio_file1(ctx,"filename1.extension");//an audio file
> handle
>     std::oafstream audio_file2(ctx,"filename2.extension");//an audio file
> handle
>
>     //routing
>     audio_file2<<proc<<audio_file1;//take input from file nad write to file
>     //audio_file1>>proc>>audio_file2;//equivilent syntax
>     proc.start();
>     //do other stuff
>     proc.stop();
> }
>
>
> //std::audio example 4 "combination routing"
> void example_3(){
>
>     std::audio_context<float> ctx;
>     //manually select hardware endpoints
>     std::size_t device_id = ctx.default_device_id();
>     std::iastream input_device =
> ctx.get_device<std::input_device>(device_id);
>     std::oastream output_device =
> ctx.get_device<std::output_device>(device_id);
>
>     std::astream_process<float> proc(ctx,[](std::iastream const& input,
>                                             std::oastream& output,
>                                             std::iafstream const&
> input_file,
>                                              std::oafstream& output_file){
>         std::frame_buffer<float>& buff = ctx.borrow_buffer();
>         (input + input_file)>>buff;//add streams to perform sum before
> writing to buffer
>         //or you could use seperate buffers
>         //like this
>         /*
>             std::frame_buffer<float> buff1;
>             std::frame_buffer<float> buff2;
>
>             input>>buff1;
>             input_file>>buff2;
>             buff1+=buff2;//buffer arithmatic
>         */
>         output<<buff;//send the contents of buff to the hardware out and the
> file out
>         output_file<<buff;
>     });
>
>     std::iafstream audio_file1(ctx,"filename1.extension");//the actual files
> to be used above
>     std::oafstream audio_file2(ctx,"filename2.extension");
>
>     //connect the files to the process
>     //connect the hardware device to the process
>     audio_file2<<proc<<audio_file1;//take input from file
>     output_device<<proc<<input_device;//also take from hardware
>     proc.start();
>     //do other stuff
>     proc.stop();
> }
>
>
>
> REQUIRED LIBRARY MEMBERS
>
>
> namespace std{
>     inline namespace audio{
>         //working context for audio flow
>         template<typename>
>         class audio_context;
>         /*
>         *The context in which all audio data is centered.
>         *Contains: sampling rate, buffer size, frame size, etc...
>         *The values of ain,aout,afin,afout refer to the endpoints defined by
> the context, when applied to routing on a porocess tied to the context
>         *think of a context as the program level driver object
>         */
>
>         //audio streams (think like std::fstream and its friends)
>         class astream;//audio stream
>         class oastream;//output audio stream
>         class iastream;//input audio stream
>         class oafstream;//output audio file stream
>         class iafstream;//input audio file stream
>
>
>         //stream endpoints
>         class ain;//audio input endpoint
>         class aout;//audio output endpoint
>         class afin;//audio file input endpoint
>         class afout//audio file output endpoint
>
>         //stream processing
>         template<typename>
>         class astream_process;//a dsp process applied to a stream
>
>         template<typename>
>         class process_group;//a group of processes that will act as one
>
>         //containers
>         template<typename>
>         class frame_buffer;//a sequence container that is resizeable at
> runtime, but only with explicit resize calls. contains frames(see below)
>         /*Implementation note on frame_buffer
>          *frame_buffer is intended to hold N number of frames which
> themselves can hold M number of samples
>          *meaning that the total size in samples if frame_buffer = N * M
>          *ideally frame_buffers representation of its sample data will be
> continuous in memory
>         */
>
>         template<typename>
>         class frame;//a container that holds samples, thin array wrapper
>
>
>         //hardware representation
>         class device;//an audio device as recognized by the OS
>         class input_device;//an input device
>         class output_device;//an output device
>
>         // audio file formats
>         enum class afformat{
>             raw,//raw headerless audio bytes, interpreted only by the
> settings of the context.
>             //best used for temporary storage within the life of a context
>             wav,
>             flac//etc...
>         }
>     }
> }
>
>
>
> --
> 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
> email 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/f490fd21-cf07-4d7b-8936-c71c97a1ab9d%40isocpp.org.

--
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 email 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/CANh-dX%3DR4Oa0OPZSrL7c9PXGyAdvM2CCBdP9C%2Bh--N4Vt-J%3D9g%40mail.gmail.com.

.


Author: Bjorn Reese <breese@mail1.stofanet.dk>
Date: Fri, 3 Jun 2016 18:29:30 +0200
Raw View
I would approach an audio API differently.

The basic audio primitives are playing and recording. These are
essentially I/O (write and read) operations. Therefore I would base
them on io_context from Networking TS, so we can have both synchronous
and asynchronous audio operations. That way we have not imposed an
audio pipeline architecture.

Such a low-level audio API should not include things like decoding,
demuxing, resampling, or signal processing. If needed, they can be
added later as part of a higher level audio API.

--
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 email 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/5751B06A.4080501%40mail1.stofanet.dk.

.


Author: alexander.zywicki@gmail.com
Date: Fri, 3 Jun 2016 11:35:04 -0500
Raw View
Not currently, I am trying to gather syntactical usage, library feature ide=
as and design considerations so that I may implement a version of this that=
 is more complete than what I present here. I understand that something lik=
e this is most likely only to be considered if it is in common practice or =
use, unfortunately=20
I have not found an audio library based off of modern C++. Most of the ones=
 I know well are either pure C or very thin wrappers over an existing C lib=
rary. My goal is to create a library with becoming a standard down the line=
 in sight, but allow it to become mature enough for possible standardizatio=
n.
> On Jun 3, 2016, at 10:43 AM, 'Jeffrey Yasskin' via ISO C++ Standard - Fut=
ure Proposals <std-proposals@isocpp.org> wrote:
>=20
> Is this based on an existing library? We're much more likely to adopt
> a proposal that's been used widely than one that was invented for the
> standard.
>=20
>> On Fri, Jun 3, 2016 at 2:37 AM,  <alexander.zywicki@gmail.com> wrote:
>> I have drafted some ideas on how I think the c++ std library could suppo=
rt
>> audio functionality.
>>=20
>> I know that audio functionality is a very operating specific problem, bu=
t
>> with the recent trend towards implementing a file-system library and
>> possibly a graphics library I believe that audio would not be too much o=
f a
>> reach anymore.
>>=20
>> Here are some of the ideas I have so far. I have both some code examples=
 of
>> the intended usage as well as a list of the types needed to implement th=
e
>> given examples.
>>=20
>> Please keep in mind my drafts are still very rough.
>>=20
>>=20
>> CODE EXAMPLES
>>=20
>> //std::audio example 1 "single process"
>> void example_1(){
>>    double sample_rate =3D 44100;
>>    std::size_t frame_size =3D2;
>>    std::size_t buffer_size=3D128;
>>=20
>>    std::audio_context<float>
>> ctx{sample_rate,buffer_size,frame_size};//contruct from values
>>=20
>>    std::astream_process<float> proc(ctx,[](std::iastream const& input,
>> std::oastream& output){
>>        std::frame_buffer<float>& buff =3D ctx.borrow_buffer();//borrow a
>> buffer from the context for usage
>>        //prevents the need for dynamic allocation of a temporary buffer
>>        input>>buff;//stream data into buffer for manipulation
>>        for(auto&& frame: buff){
>>            frame=3D0.0;//do something with audio
>>        }
>>        output<<buff;//stream to output
>>    });//dsp object
>>    //uses implied routing equivilent to
>>    //std::aout<<proc<<std::ain;
>>    //
>>=20
>>    proc.start();
>>    //do other stuff
>>    proc.stop();
>> }
>>=20
>> //std::audio example 2 "process group"
>> void example_2(){
>>=20
>>    std::audio_context<float> ctx;//default context created with
>> std::default_* values
>>=20
>>    //version 1: capture context via lambda
>>    std::astream_process<float> proc1(ctx,[&ctx](std::iastream const& inp=
ut,
>> std::oastream& output){
>>        std::frame_buffer<float>& buff =3D ctx.borrow_buffer();
>>        input>>buff;
>>        for(auto&& frame: buff){
>>            frame*=3D0.5;
>>        }
>>        output<<buff;
>>    });//dsp object
>>=20
>>    //version 2: have context passed as argument
>>    std::astream_process<float> proc2(ctx,[](std::iastream const& input,
>> std::oastream& output,std::audio_context<float> const& context){
>>        std::frame_buffer<float>& buff =3D ctx.borrow_buffer();
>>        input>>buff;
>>        for(auto&& frame: buff){
>>            frame*=3D2.0;
>>        }
>>        output<<buff;
>>    });
>>=20
>>    std::process_group<float> pgroup;//a group of processes that will hap=
pen
>> consecutivley
>>    pgroup.push(proc1);//add to group
>>    pgroup.push(proc2);//add to group
>>=20
>>    //configure stream relationships in terms of std::ain / std:aout
>> manually
>>    //std::ain/std::aout are std::astream globals that refer to the defau=
lt
>> audio inputs and outputs supplied by the context in use
>>    //std::ain/std::aout will route the audio to the enpoint specified by
>> the context reference held by the process that is streaming the data
>>    std::aout<<proc1<<proc2<<std::ain;//method 1
>>    //std::ain>>proc2>>proc1>>std::aout;//method 2
>>=20
>>    pgroup.start();
>>    //do other stuff
>>    pgroup.stop();
>>=20
>> }
>>=20
>>=20
>> //std::audio example 3 "audio files"
>> void example_3(){
>>=20
>>    std::audio_context<float> ctx;
>>=20
>>    std::astream_process<float> proc(ctx,[](std::iafstream const& input,
>> std::oafstream& output){
>>        std::frame_buffer<float>& buff =3D ctx.borrow_buffer();
>>        input>>buff;
>>        for(auto&& frame: buff){
>>            frame=3D0.0;
>>        }
>>        output<<buff;
>>    });//dsp object
>>=20
>>    std::iafstream audio_file1(ctx,"filename1.extension");//an audio file
>> handle
>>    std::oafstream audio_file2(ctx,"filename2.extension");//an audio file
>> handle
>>=20
>>    //routing
>>    audio_file2<<proc<<audio_file1;//take input from file nad write to fi=
le
>>    //audio_file1>>proc>>audio_file2;//equivilent syntax
>>    proc.start();
>>    //do other stuff
>>    proc.stop();
>> }
>>=20
>>=20
>> //std::audio example 4 "combination routing"
>> void example_3(){
>>=20
>>    std::audio_context<float> ctx;
>>    //manually select hardware endpoints
>>    std::size_t device_id =3D ctx.default_device_id();
>>    std::iastream input_device =3D
>> ctx.get_device<std::input_device>(device_id);
>>    std::oastream output_device =3D
>> ctx.get_device<std::output_device>(device_id);
>>=20
>>    std::astream_process<float> proc(ctx,[](std::iastream const& input,
>>                                            std::oastream& output,
>>                                            std::iafstream const&
>> input_file,
>>                                             std::oafstream& output_file)=
{
>>        std::frame_buffer<float>& buff =3D ctx.borrow_buffer();
>>        (input + input_file)>>buff;//add streams to perform sum before
>> writing to buffer
>>        //or you could use seperate buffers
>>        //like this
>>        /*
>>            std::frame_buffer<float> buff1;
>>            std::frame_buffer<float> buff2;
>>=20
>>            input>>buff1;
>>            input_file>>buff2;
>>            buff1+=3Dbuff2;//buffer arithmatic
>>        */
>>        output<<buff;//send the contents of buff to the hardware out and =
the
>> file out
>>        output_file<<buff;
>>    });
>>=20
>>    std::iafstream audio_file1(ctx,"filename1.extension");//the actual fi=
les
>> to be used above
>>    std::oafstream audio_file2(ctx,"filename2.extension");
>>=20
>>    //connect the files to the process
>>    //connect the hardware device to the process
>>    audio_file2<<proc<<audio_file1;//take input from file
>>    output_device<<proc<<input_device;//also take from hardware
>>    proc.start();
>>    //do other stuff
>>    proc.stop();
>> }
>>=20
>>=20
>>=20
>> REQUIRED LIBRARY MEMBERS
>>=20
>>=20
>> namespace std{
>>    inline namespace audio{
>>        //working context for audio flow
>>        template<typename>
>>        class audio_context;
>>        /*
>>        *The context in which all audio data is centered.
>>        *Contains: sampling rate, buffer size, frame size, etc...
>>        *The values of ain,aout,afin,afout refer to the endpoints defined=
 by
>> the context, when applied to routing on a porocess tied to the context
>>        *think of a context as the program level driver object
>>        */
>>=20
>>        //audio streams (think like std::fstream and its friends)
>>        class astream;//audio stream
>>        class oastream;//output audio stream
>>        class iastream;//input audio stream
>>        class oafstream;//output audio file stream
>>        class iafstream;//input audio file stream
>>=20
>>=20
>>        //stream endpoints
>>        class ain;//audio input endpoint
>>        class aout;//audio output endpoint
>>        class afin;//audio file input endpoint
>>        class afout//audio file output endpoint
>>=20
>>        //stream processing
>>        template<typename>
>>        class astream_process;//a dsp process applied to a stream
>>=20
>>        template<typename>
>>        class process_group;//a group of processes that will act as one
>>=20
>>        //containers
>>        template<typename>
>>        class frame_buffer;//a sequence container that is resizeable at
>> runtime, but only with explicit resize calls. contains frames(see below)
>>        /*Implementation note on frame_buffer
>>         *frame_buffer is intended to hold N number of frames which
>> themselves can hold M number of samples
>>         *meaning that the total size in samples if frame_buffer =3D N * =
M
>>         *ideally frame_buffers representation of its sample data will be
>> continuous in memory
>>        */
>>=20
>>        template<typename>
>>        class frame;//a container that holds samples, thin array wrapper
>>=20
>>=20
>>        //hardware representation
>>        class device;//an audio device as recognized by the OS
>>        class input_device;//an input device
>>        class output_device;//an output device
>>=20
>>        // audio file formats
>>        enum class afformat{
>>            raw,//raw headerless audio bytes, interpreted only by the
>> settings of the context.
>>            //best used for temporary storage within the life of a contex=
t
>>            wav,
>>            flac//etc...
>>        }
>>    }
>> }
>>=20
>>=20
>>=20
>> --
>> You received this message because you are subscribed to the Google Group=
s
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n
>> email 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/f490fd21-cf=
07-4d7b-8936-c71c97a1ab9d%40isocpp.org.
>=20
> --=20
> You received this message because you are subscribed to a topic in the Go=
ogle Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.=
org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to std-p=
roposals+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/isoc=
pp.org/d/msgid/std-proposals/CANh-dX%3DR4Oa0OPZSrL7c9PXGyAdvM2CCBdP9C%2Bh--=
N4Vt-J%3D9g%40mail.gmail.com.

--=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/68BBAF0D-27AD-4D2E-8F95-47644F5A1382%40gmail.com=
..

.


Author: mlal1811@gmail.com
Date: Fri, 3 Jun 2016 09:47:54 -0700 (PDT)
Raw View
------=_Part_992_2086859694.1464972475004
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I do tend to agree with you on your point of synchronous and asynchronous p=
rocessing models. Keep in mind that an audio system at least in a non embed=
ded context is already going to be an asynchronous system. I also agree tha=
t including higher level functionality such a dsp is not the right thing to=
 do here, BUT I do believe that a std audio library needs to include the bu=
ilding blocks for others to implement signal processing on their own. That =
was the intention of the "steam_process" class design. My overall design ab=
stracts from the typical audio library's implementation that gives you only=
 a callback and says go to work... I rather chose to think of audio in term=
s of source and destination and providing the user a way to interact with a=
udio at a callback level if so chosen. I do not intend to add audio algorit=
hmic functionality as part of the library. In the most basic example using =
my concept you could simply create a default context and route from std::ai=
m to std::aout to creat a duplex play through situation or route from std::=
sin to a file to record or a file to std::aout to play a file.

--=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/f2f04a5e-bdb0-4810-9a6c-e4e6de9db08e%40isocpp.or=
g.

------=_Part_992_2086859694.1464972475004--

.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Fri, 03 Jun 2016 20:10:05 +0300
Raw View
This is a multi-part message in MIME format.

--nextPart2394372.o8tatPDBsP
Content-Type: text/plain; charset=UTF-8

On Friday, 3 June 2016 20:04:59 MSK Bjorn Reese wrote:
> I would approach an audio API differently.
>
> The basic audio primitives are playing and recording.

I disagree. I would say the basic primitives are a sample and a
frame. Samples can be obtained and processed in different ways,
including recording, reading from file or generating algorithmically.

The processing is often represented as a pipeline or graph with
producer, filter and consumer nodes. This is a higher level
framework that builds upon the basic blocks of frames and digital
signal processing algorithms.

--
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 email 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/4539123.eWIb3U4yhc%40lastique-pc.

--nextPart2394372.o8tatPDBsP
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-=
html40/strict.dtd">
<html><head><meta name=3D"qrichtext" content=3D"1" /><style type=3D"text/cs=
s">
p, li { white-space: pre-wrap; }
</style></head><body style=3D" font-family:'DejaVu Sans Mono'; font-size:9p=
t; font-weight:400; font-style:normal;">
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Friday, =
3 June 2016 20:04:59 MSK Bjorn Reese wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; I woul=
d approach an audio API differently.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; The ba=
sic audio primitives are playing and recording.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">I disagree.=
 I would say the basic primitives are a sample and a frame. Samples can be =
obtained and processed in different ways, including recording, reading from=
 file or generating algorithmically.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">The process=
ing is often represented as a pipeline or graph with producer, filter and c=
onsumer nodes. This is a higher level framework that builds upon the basic =
blocks of frames and digital signal processing algorithms.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/4539123.eWIb3U4yhc%40lastique-pc?utm_=
medium=3Demail&utm_source=3Dfooter">https://groups.google.com/a/isocpp.org/=
d/msgid/std-proposals/4539123.eWIb3U4yhc%40lastique-pc</a>.<br />

--nextPart2394372.o8tatPDBsP--


.


Author: mlal1811@gmail.com
Date: Fri, 3 Jun 2016 12:06:33 -0700 (PDT)
Raw View
------=_Part_249_1305695195.1464980793772
Content-Type: text/plain; charset=UTF-8

That is precisely what I had in mind. I come from a electronic music perspective where signal processing and generation are a must so I wanted to make sure that it would be possible to and easy to implement with the library.

--
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 email 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/82f7441e-4de7-43ea-8abe-f77f6de3cea8%40isocpp.org.

------=_Part_249_1305695195.1464980793772--

.


Author: Tony V E <tvaneerd@gmail.com>
Date: Fri, 03 Jun 2016 17:13:41 -0400
Raw View
<html><head></head><body lang=3D"en-US" style=3D"background-color: rgb(255,=
 255, 255); line-height: initial;">                                        =
                                              <div style=3D"width: 100%; fo=
nt-size: initial; font-family: Calibri, 'Slate Pro', sans-serif, sans-serif=
; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, =
255, 255);">The pipeline/graph model also works for images and other data.&=
nbsp;</div><div style=3D"width: 100%; font-size: initial; font-family: Cali=
bri, 'Slate Pro', sans-serif, sans-serif; color: rgb(31, 73, 125); text-ali=
gn: initial; background-color: rgb(255, 255, 255);"><br></div><div style=3D=
"width: 100%; font-size: initial; font-family: Calibri, 'Slate Pro', sans-s=
erif, sans-serif; color: rgb(31, 73, 125); text-align: initial; background-=
color: rgb(255, 255, 255);">A movie or a sound, etc, is a function f(t) tha=
t returns data at a given time.&nbsp;</div><div style=3D"width: 100%; font-=
size: initial; font-family: Calibri, 'Slate Pro', sans-serif, sans-serif; c=
olor: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 255=
, 255);"><br></div><div style=3D"width: 100%; font-size: initial; font-fami=
ly: Calibri, 'Slate Pro', sans-serif, sans-serif; color: rgb(31, 73, 125); =
text-align: initial; background-color: rgb(255, 255, 255);">Should we build=
 a library that does more than sound?</div><div style=3D"width: 100%; font-=
size: initial; font-family: Calibri, 'Slate Pro', sans-serif, sans-serif; c=
olor: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 255=
, 255);"><br></div><div style=3D"width: 100%; font-size: initial; font-fami=
ly: Calibri, 'Slate Pro', sans-serif, sans-serif; color: rgb(31, 73, 125); =
text-align: initial; background-color: rgb(255, 255, 255);">(and yes I know=
 (20+ years of audio / video) it is not as simple as it sounds=E2=80=8E and=
 the devil is in the details, but at the high level it is and should be sim=
ple)</div>                                                                 =
                                                                    <div st=
yle=3D"width: 100%; font-size: initial; font-family: Calibri, 'Slate Pro', =
sans-serif, sans-serif; color: rgb(31, 73, 125); text-align: initial; backg=
round-color: rgb(255, 255, 255);"><br style=3D"display:initial"></div>     =
                                                                           =
                                                                           =
                                        <div style=3D"font-size: initial; f=
ont-family: Calibri, 'Slate Pro', sans-serif, sans-serif; color: rgb(31, 73=
, 125); text-align: initial; background-color: rgb(255, 255, 255);">Sent&nb=
sp;from&nbsp;my&nbsp;BlackBerry&nbsp;portable&nbsp;Babbage&nbsp;Device</div=
>                                                                          =
                                                                           =
                             <table width=3D"100%" style=3D"background-colo=
r:white;border-spacing:0px;"> <tbody><tr><td colspan=3D"2" style=3D"font-si=
ze: initial; text-align: initial; background-color: rgb(255, 255, 255);">  =
                         <div style=3D"border-style: solid none none; borde=
r-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0i=
n; font-family: Tahoma, 'BB Alpha Sans', 'Slate Pro'; font-size: 10pt;">  <=
div><b>From: </b>Andrey Semashev</div><div><b>Sent: </b>Friday, June 3, 201=
6 1:10 PM</div><div><b>To: </b>std-proposals@isocpp.org</div><div><b>Reply =
To: </b>std-proposals@isocpp.org</div><div><b>Subject: </b>Re: [std-proposa=
ls] Any interest to adding audio support to the std library?</div></div></t=
d></tr></tbody></table><div style=3D"border-style: solid none none; border-=
top-color: rgb(186, 188, 209); border-top-width: 1pt; font-size: initial; t=
ext-align: initial; background-color: rgb(255, 255, 255);"></div><br><div i=
d=3D"_originalContent" style=3D"">
<meta name=3D"qrichtext" content=3D"1"><style type=3D"text/css">
p, li { white-space: pre-wrap; }
</style>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Friday, =
3 June 2016 20:04:59 MSK Bjorn Reese wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; I woul=
d approach an audio API differently.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; The ba=
sic audio primitives are playing and recording.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">I disagree.=
 I would say the basic primitives are a sample and a frame. Samples can be =
obtained and processed in different ways, including recording, reading from=
 file or generating algorithmically.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">The process=
ing is often represented as a pipeline or graph with producer, filter and c=
onsumer nodes. This is a higher level framework that builds upon the basic =
blocks of frames and digital signal processing algorithms.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/4539123.eWIb3U4yhc%40lastique-pc?utm_=
medium=3Demail&amp;utm_source=3Dfooter">https://groups.google.com/a/isocpp.=
org/d/msgid/std-proposals/4539123.eWIb3U4yhc%40lastique-pc</a>.<br>
<br><!--end of _originalContent --></div></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/20160603211341.4915281.1974.11611%40g=
mail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/20160603211341.4915281.1974.11611%40gmai=
l.com</a>.<br />

.


Author: ron novy <rsn10100@gmail.com>
Date: Fri, 3 Jun 2016 14:32:05 -0700
Raw View
--94eb2c0770e84d4ba80534667422
Content-Type: text/plain; charset=UTF-8

I had some thoughts on this last year and started throwing down ideas.  I
decided to start with DSP instead of standardizing ways of opening streams
to/from devices.  Without a standard way of processing the data going
to/from these devices, how can you create an interface that looks like it
really belongs?

Here is a quick slide show presentation of some things I worked on.  The
presentation is incomplete, but you should get the basic idea.  There is a
lot of templates here.

https://docs.google.com/presentation/d/1KGhLZz53RbUkXBwTEf87UypDnyErqkBuoxf3Oe-PMYs/edit?usp=sharing

The dsparray and dspvector classes inherit from their respective standard
library components.  The project is on github and I'm sure its got some
code rot by now.  I've since moved on to something else so I haven't been
working on it lately.

https://github.com/RonNovy/CppDSP

The basic concept was to take the idea of valarray and expand it to be
something much more usable and capable of being processed in parallel.
Being able to automatically have parallel processing by using these classes
was one of the key things I wanted to achieve here.

Also, I believe removing the _Native component to the templates would make
things easier since it would rarely be needed and its function can be
accomplished in a better way like through a function in each container
class.

Hopefully someone can grab some ideas from there.

--
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 email 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/CAOcFa%3Dec74JprsTu3o08yUuveHLFt8gZrDmSq_FKBKRwhZpQZA%40mail.gmail.com.

--94eb2c0770e84d4ba80534667422
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I had some thoughts on this last year and started throwing=
 down ideas.=C2=A0 I decided to start with DSP instead of standardizing way=
s of opening streams to/from devices.=C2=A0 Without a standard way of proce=
ssing the data going to/from these devices, how can you create an interface=
 that looks like it really belongs?<div><br></div><div>Here is a quick slid=
e show presentation of some things I worked on.=C2=A0 The presentation is i=
ncomplete, but you should get the basic idea.=C2=A0 There is a lot of templ=
ates here.</div><div><br></div><div><a href=3D"https://docs.google.com/pres=
entation/d/1KGhLZz53RbUkXBwTEf87UypDnyErqkBuoxf3Oe-PMYs/edit?usp=3Dsharing"=
>https://docs.google.com/presentation/d/1KGhLZz53RbUkXBwTEf87UypDnyErqkBuox=
f3Oe-PMYs/edit?usp=3Dsharing</a><br></div><div><br></div><div><div>The dspa=
rray and dspvector classes inherit from their respective standard library c=
omponents.=C2=A0 The project is on github and I&#39;m sure its got some cod=
e rot by now.=C2=A0=C2=A0I&#39;ve since moved on to something else so I hav=
en&#39;t been working on it lately.</div></div><div><br></div><div><a href=
=3D"https://github.com/RonNovy/CppDSP">https://github.com/RonNovy/CppDSP</a=
><br></div><div><br></div><div>The basic concept was to take the idea of va=
larray and expand it to be something much more usable and capable of being =
processed in parallel.=C2=A0 Being able to automatically have parallel proc=
essing by using these classes was one of the key things I wanted to achieve=
 here.</div><div><br></div><div>Also, I believe removing the _Native compon=
ent to the templates would make things easier since it would rarely be need=
ed and its function can be accomplished in a better way like through a func=
tion in each container class.</div><div><br></div><div><div>Hopefully someo=
ne can grab some ideas from there.</div></div><div><br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAOcFa%3Dec74JprsTu3o08yUuveHLFt8gZrD=
mSq_FKBKRwhZpQZA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOcFa%3Dec74Jp=
rsTu3o08yUuveHLFt8gZrDmSq_FKBKRwhZpQZA%40mail.gmail.com</a>.<br />

--94eb2c0770e84d4ba80534667422--

.


Author: alexander.zywicki@gmail.com
Date: Fri, 3 Jun 2016 14:50:18 -0700 (PDT)
Raw View
------=_Part_392_984669070.1464990618701
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

That was my original plan. My original plan looked fairly similar but abstr=
acted in a way that allowed for connection to various types of hardware dev=
ices, software devices and files in a generic way. My thought on a dsp mode=
l was to organize processing nodes in a directed a cyclic graph that connec=
ted to endpoints that represented various kinds of inputs and outputs

--=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/53a7fa8b-3cf5-4ff9-afe9-67be7e96f830%40isocpp.or=
g.

------=_Part_392_984669070.1464990618701--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Fri, 03 Jun 2016 18:58:43 -0300
Raw View
On sexta-feira, 3 de junho de 2016 20:10:05 BRT Andrey Semashev wrote:
> On Friday, 3 June 2016 20:04:59 MSK Bjorn Reese wrote:
> > I would approach an audio API differently.
> >
> > The basic audio primitives are playing and recording.
>
> I disagree. I would say the basic primitives are a sample and a
> frame. Samples can be obtained and processed in different ways,
> including recording, reading from file or generating algorithmically.
>
> The processing is often represented as a pipeline or graph with
> producer, filter and consumer nodes. This is a higher level
> framework that builds upon the basic blocks of frames and digital
> signal processing algorithms.

Considering the domain of media codecs is a patent minefield, the API should be
designed around never having access to the actual contents of the frames, only
that they exist.

More than likely, just "here's a file or URL, go play it", plus some time-sync
API and some hints on what type of audio it is, so system can route it to the
correct speaker (headphones? bluetooth? loudspeaker?). Plus the converse
recording.

IMHO, just like the 2D graphics proposal, I think this is ill-advised as
content for the C++ Standard Library.

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--
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 email 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/2028636.MhYnudsMAW%40tjmaciei-mobl1.

.


Author: alexander.zywicki@gmail.com
Date: Fri, 3 Jun 2016 15:30:03 -0700 (PDT)
Raw View
------=_Part_377_1348442960.1464993003135
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I feel that you may be missing the point of the library, in order to do any=
 "real" audio work you need direct access to the audio data. And yes I agre=
e that multimedia is a patent minefield but there are open source versions =
of most media formats that could be used if needed. But that is besides the=
 point here, the library would only provide a standardized interface of how=
 to interact with audio(or other signal types) and place only the needed co=
nstraints on the implementors of the library. The only guarantee that needs=
 to be made is that data will be delivered to and from the application in t=
he requested format if possible, the how will be OS specific and implementa=
tion defined

--=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/f94572e6-9d6a-4a46-af33-81bfc8e63520%40isocpp.or=
g.

------=_Part_377_1348442960.1464993003135--

.


Author: alexander.zywicki@gmail.com
Date: Fri, 3 Jun 2016 15:32:10 -0700 (PDT)
Raw View
------=_Part_358_830094722.1464993130611
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

That was the basis of my original idea for the library but I found it to be=
e too broad and constrained the idea to an audio context for the mean time,=
 I am planning on working up an alternative version that does what you are =
suggesting. The same concepts that I use in my library can be applied to an=
y type of signal so long as the program can receive that data from the OS=
=20

--=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/d9ecb64d-87e6-492c-9d87-0636aed66d9e%40isocpp.or=
g.

------=_Part_358_830094722.1464993130611--

.


Author: ron novy <rsn10100@gmail.com>
Date: Fri, 3 Jun 2016 15:32:49 -0700
Raw View
--94eb2c0770e88091e30534674d8e
Content-Type: text/plain; charset=UTF-8

>Considering the domain of media codecs is a patent minefield, the API
should be
designed around never having access to the actual contents of the frames,
only
that they exist.

I disagree with this concept.  Frames contain information to be processed.
If someone wants/needs to create a closed system then they can do that on
their own in their own proprietary system.  And its not just about playing
or recording audio, there is mixing, transcoding, interleaving,
deinterleaving etc.  The system driver should be capable of giving you
access to a buffer with properties that you choose and the driver itself
should then handle getting it to the speakers, but these processing
features should still be accessible to C++ in a standard way.

I honestly don't think reading specific types of files should be a part of
the standard, but as someone who develops audio applications, there could
be a better standard for getting the data to or from an audio file or
device.  And like actual hardware, an audio file or codec could be just
another device that you open.  If the system supports it and its driver is
installed properly then you can enumerate codecs like devices and use them
to open file streams.

On Fri, Jun 3, 2016 at 3:32 PM, <alexander.zywicki@gmail.com> wrote:

> That was the basis of my original idea for the library but I found it to
> bee too broad and constrained the idea to an audio context for the mean
> time, I am planning on working up an alternative version that does what you
> are suggesting. The same concepts that I use in my library can be applied
> to any type of signal so long as the program can receive that data from the
> OS
>
> --
> 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
> email 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/d9ecb64d-87e6-492c-9d87-0636aed66d9e%40isocpp.org
> .
>

--
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 email 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/CAOcFa%3DcqxCGYV0iQuEuLcMPhnxFvUVb-X4bcNwxGmtwg5XKxfQ%40mail.gmail.com.

--94eb2c0770e88091e30534674d8e
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>&gt;Considering the domain of media codecs is a paten=
t minefield, the API should be</div><div>designed around never having acces=
s to the actual contents of the frames, only</div><div>that they exist.</di=
v><div><br></div><div>I disagree with this concept.=C2=A0 Frames contain in=
formation to be processed.=C2=A0 If someone wants/needs to create a closed =
system then they can do that on their own in their own proprietary system.=
=C2=A0 And its not just about playing or recording audio, there is mixing, =
transcoding, interleaving, deinterleaving etc.=C2=A0 The system driver shou=
ld be capable of giving you access to a buffer with properties that you cho=
ose and the driver itself should then handle getting it to the speakers, bu=
t these processing features should still be accessible to C++ in a standard=
 way. =C2=A0</div><div><br></div><div>I honestly don&#39;t think reading sp=
ecific types of files should be a part of the standard, but as someone who =
develops audio applications, there could be a better standard for getting t=
he data to or from an audio file or device.=C2=A0 And like actual hardware,=
 an audio file or codec could be just another device that you open.=C2=A0 I=
f the system supports it and its driver is installed properly then you can =
enumerate codecs like devices and use them to open file streams.</div></div=
><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Fri, Jun 3, 2=
016 at 3:32 PM,  <span dir=3D"ltr">&lt;<a href=3D"mailto:alexander.zywicki@=
gmail.com" target=3D"_blank">alexander.zywicki@gmail.com</a>&gt;</span> wro=
te:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-=
left:1px #ccc solid;padding-left:1ex">That was the basis of my original ide=
a for the library but I found it to bee too broad and constrained the idea =
to an audio context for the mean time, I am planning on working up an alter=
native version that does what you are suggesting. The same concepts that I =
use in my library can be applied to any type of signal so long as the progr=
am can receive that data from the OS<br>
<span class=3D""><br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-propo=
sals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
</span>To view this discussion on the web visit <a href=3D"https://groups.g=
oogle.com/a/isocpp.org/d/msgid/std-proposals/d9ecb64d-87e6-492c-9d87-0636ae=
d66d9e%40isocpp.org" rel=3D"noreferrer" target=3D"_blank">https://groups.go=
ogle.com/a/isocpp.org/d/msgid/std-proposals/d9ecb64d-87e6-492c-9d87-0636aed=
66d9e%40isocpp.org</a>.<br>
</blockquote></div><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAOcFa%3DcqxCGYV0iQuEuLcMPhnxFvUVb-X4=
bcNwxGmtwg5XKxfQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOcFa%3DcqxCGY=
V0iQuEuLcMPhnxFvUVb-X4bcNwxGmtwg5XKxfQ%40mail.gmail.com</a>.<br />

--94eb2c0770e88091e30534674d8e--

.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Sat, 4 Jun 2016 01:37:34 +0300
Raw View
On Sat, Jun 4, 2016 at 12:13 AM, Tony V E <tvaneerd@gmail.com> wrote:
>
> The pipeline/graph model also works for images and other data.
>
> A movie or a sound, etc, is a function f(t) that returns data at a given time.

It's not always time-dependent. Standalone image processing, for
example, is not.

My understanding is that the different abstraction layers such as data
structures (pixel, sample, audio/video frame), algorithms (conversion,
resampling, scaling, etc) and higher level tools (timing,
pipeline/graph, multithreading, I/O) should be as decoupled as
possible.

> Should we build a library that does more than sound?

I think the pipeline/graph framework is orthogonal to audio or
whatever media processing, although can be employed for these tasks as
well. Think of a generic framework like in TBB.

That, however, does not immediately help audio/video processing as the
sample/pixel/frame and DSP layers are still missing and, IMHO, would
be a very useful addition even without the graph framework.

--
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 email 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/CAEhD%2B6DqBNjzGzV_AJbVH57suEmviFm9XK7fPtE%2BFfdk5qsgOg%40mail.gmail.com.

.


Author: alexander.zywicki@gmail.com
Date: Fri, 3 Jun 2016 15:39:10 -0700 (PDT)
Raw View
------=_Part_1129_970987539.1464993550360
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

my overall goal is to provide access to real time data streams Ina uniform =
manor, these stream could be from hardware, software or a file. the types o=
f streams that are supported would have to be up to the system that the pro=
gram is running upon. There is a need for a standard interface for processi=
ng and routing sampled data

--=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/0aa4f9d1-b483-426a-8559-74c75bb520b7%40isocpp.or=
g.

------=_Part_1129_970987539.1464993550360--

.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Sat, 4 Jun 2016 01:44:40 +0300
Raw View
On Sat, Jun 4, 2016 at 12:50 AM,  <alexander.zywicki@gmail.com> wrote:
> That was my original plan. My original plan looked fairly similar but abs=
tracted in a way that allowed for connection to various types of hardware d=
evices, software devices and files in a generic way. My thought on a dsp mo=
del was to organize processing nodes in a directed a cyclic graph that conn=
ected to endpoints that represented various kinds of inputs and outputs

Could you please keep the relevant quotation you reply to? It's
difficult to read a message not really knowing what it responds to.

--=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/CAEhD%2B6Aw0txXzbGmxbU4ifVE83bcqMFE4rD9sKZUC5OBE=
a0TuQ%40mail.gmail.com.

.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Sat, 4 Jun 2016 01:54:55 +0300
Raw View
On Sat, Jun 4, 2016 at 12:58 AM, Thiago Macieira <thiago@macieira.org> wrote:
> On sexta-feira, 3 de junho de 2016 20:10:05 BRT Andrey Semashev wrote:
>> On Friday, 3 June 2016 20:04:59 MSK Bjorn Reese wrote:
>> > I would approach an audio API differently.
>> >
>> > The basic audio primitives are playing and recording.
>>
>> I disagree. I would say the basic primitives are a sample and a
>> frame. Samples can be obtained and processed in different ways,
>> including recording, reading from file or generating algorithmically.
>>
>> The processing is often represented as a pipeline or graph with
>> producer, filter and consumer nodes. This is a higher level
>> framework that builds upon the basic blocks of frames and digital
>> signal processing algorithms.
>
> Considering the domain of media codecs is a patent minefield, the API should be
> designed around never having access to the actual contents of the frames, only
> that they exist.

Well, regarding codecs, there are different ones, including the
unencumbered ones. But the point of the proposal is not so much aimed
at codecs but rather at raw media processing.

> More than likely, just "here's a file or URL, go play it", plus some time-sync
> API and some hints on what type of audio it is, so system can route it to the
> correct speaker (headphones? bluetooth? loudspeaker?). Plus the converse
> recording.
>
> IMHO, just like the 2D graphics proposal, I think this is ill-advised as
> content for the C++ Standard Library.

The way you described it - it would be a proposal of a fairly limited
use. And if that was the case I would agree it's not suitable for the
standard library.

However, what the OP described is different and something like what I
implemented to a certain degree in a closed project. I would really
have liked if something like that was in the standard library.

--
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 email 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/CAEhD%2B6DbXNRm030MSycRhAxUk2Ji2saDJBv-np32TbseZNDnVw%40mail.gmail.com.

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Fri, 03 Jun 2016 19:56:19 -0300
Raw View
On sexta-feira, 3 de junho de 2016 15:32:49 BRT ron novy wrote:
> I honestly don't think reading specific types of files should be a part of
> the standard, but as someone who develops audio applications, there could
> be a better standard for getting the data to or from an audio file or
> device.  And like actual hardware, an audio file or codec could be just
> another device that you open.  If the system supports it and its driver is
> installed properly then you can enumerate codecs like devices and use them
> to open file streams.

I would say that playing sounds from a file and recoding a microphone into a
file are the two most common uses of an audio API.

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--
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 email 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/3930995.ZdIMBr08p9%40tjmaciei-mobl1.

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Fri, 03 Jun 2016 20:02:44 -0300
Raw View
On sexta-feira, 3 de junho de 2016 15:30:03 BRT alexander.zywicki@gmail.com
wrote:
> I feel that you may be missing the point of the library, in order to do any
> "real" audio work you need direct access to the audio data.

I might be missing your orignial intention, but nonetheless it is a valid
concern and a very common (probably the most common) use-case for an audio
API.

> And yes I agree
> that multimedia is a patent minefield but there are open source versions of
> most media formats that could be used if needed.

That's not how patents work. Please design your system without ever writing a
line of code that reads directly from or writes directly to a file. I would say
that uncompressed PCM is probably safe, but I am not a lawyer and I can't even
say that (note: .wav files are not just plain PCM).

Instead, write it so that it will work on a heavily locked-down system like
iOS.

> But that is besides the
> point here, the library would only provide a standardized interface of how
> to interact with audio(or other signal types) and place only the needed
> constraints on the implementors of the library. The only guarantee that
> needs to be made is that data will be delivered to and from the application
> in the requested format if possible, the how will be OS specific and
> implementation defined

That's orthogonal to what I was asking. And somewhat useless if you can't play
or record audio, nor load it from a file or save it after processing.

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--
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 email 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/2537589.a8BC4svcIn%40tjmaciei-mobl1.

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Fri, 03 Jun 2016 20:04:02 -0300
Raw View
On s=C3=A1bado, 4 de junho de 2016 01:54:55 BRT Andrey Semashev wrote:
> > Considering the domain of media codecs is a patent minefield, the API
> > should be designed around never having access to the actual contents of
> > the frames, only that they exist.
>=20
> Well, regarding codecs, there are different ones, including the
> unencumbered ones. But the point of the proposal is not so much aimed
> at codecs but rather at raw media processing.

As replied to Alexander: that's not how patents work and raw processing is =
not=20
useful if you can't load a file or save your work.

--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--=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/5290948.va25uYNizX%40tjmaciei-mobl1.

.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Sat, 4 Jun 2016 02:05:08 +0300
Raw View
On Sat, Jun 4, 2016 at 1:56 AM, Thiago Macieira <thiago@macieira.org> wrote:
> On sexta-feira, 3 de junho de 2016 15:32:49 BRT ron novy wrote:
>> I honestly don't think reading specific types of files should be a part of
>> the standard, but as someone who develops audio applications, there could
>> be a better standard for getting the data to or from an audio file or
>> device.  And like actual hardware, an audio file or codec could be just
>> another device that you open.  If the system supports it and its driver is
>> installed properly then you can enumerate codecs like devices and use them
>> to open file streams.
>
> I would say that playing sounds from a file and recoding a microphone into a
> file are the two most common uses of an audio API.

I would say real time communication is the most common use case for
audio recording nowdays. And it's not just about recording a
microphone and throwing it to network, unfortunately. There is a fair
bit of media processing going on under the hood.

--
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 email 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/CAEhD%2B6BtgjwVyR18Z%2BTkJxxvF%3DetBENXUURa_9%3DPcQop%3DWEANA%40mail.gmail.com.

.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Sat, 4 Jun 2016 02:20:15 +0300
Raw View
On Sat, Jun 4, 2016 at 2:04 AM, Thiago Macieira <thiago@macieira.org> wrote=
:
> On s=C3=A1bado, 4 de junho de 2016 01:54:55 BRT Andrey Semashev wrote:
>> > Considering the domain of media codecs is a patent minefield, the API
>> > should be designed around never having access to the actual contents o=
f
>> > the frames, only that they exist.
>>
>> Well, regarding codecs, there are different ones, including the
>> unencumbered ones. But the point of the proposal is not so much aimed
>> at codecs but rather at raw media processing.
>
> As replied to Alexander: that's not how patents work and raw processing i=
s not
> useful if you can't load a file or save your work.

I think patents are irrelevant in this proposal. I don't think anyone
patented the concept of audio samples or pixel representation, at
least not the conventional ones.

How you save and load these samples and which codecs you use is a
question of the available modules you have - whether these modules are
provided by your compiler or OS vendor or a third party or even your
hardware. For all I care, all this stuff could be handled by ffmpeg
internally. The codecs themselves need not be in the C++ standard.
What is needed is a standardized interface for these different modules
to work with each other. The interface should also allow me, the
developer, to work with the media (e.g. create my own audio or image
filter or a new codec or a new device driver).

--=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/CAEhD%2B6Ca%3Dj3SaS5nC_Qe%3D6FGMdJLgpQd1LnGfiep8=
m9GrEU1jQ%40mail.gmail.com.

.


Author: alexander.zywicki@gmail.com
Date: Fri, 3 Jun 2016 16:29:47 -0700 (PDT)
Raw View
------=_Part_1112_902969872.1464996587756
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Friday, June 3, 2016 at 6:20:17 PM UTC-5, Andrey Semashev wrote:
> On Sat, Jun 4, 2016 at 2:04 AM, Thiago Macieira <thiago@macieira.org> wro=
te:
> > On s=C3=A1bado, 4 de junho de 2016 01:54:55 BRT Andrey Semashev wrote:
> >> > Considering the domain of media codecs is a patent minefield, the AP=
I
> >> > should be designed around never having access to the actual contents=
 of
> >> > the frames, only that they exist.
> >>
> >> Well, regarding codecs, there are different ones, including the
> >> unencumbered ones. But the point of the proposal is not so much aimed
> >> at codecs but rather at raw media processing.
> >
> > As replied to Alexander: that's not how patents work and raw processing=
 is not
> > useful if you can't load a file or save your work.
>=20
> I think patents are irrelevant in this proposal. I don't think anyone
> patented the concept of audio samples or pixel representation, at
> least not the conventional ones.
>=20
> How you save and load these samples and which codecs you use is a
> question of the available modules you have - whether these modules are
> provided by your compiler or OS vendor or a third party or even your
> hardware. For all I care, all this stuff could be handled by ffmpeg
> internally. The codecs themselves need not be in the C++ standard.
> What is needed is a standardized interface for these different modules
> to work with each other. The interface should also allow me, the
> developer, to work with the media (e.g. create my own audio or image
> filter or a new codec or a new device driver).
That is exactly what I intended=20

--=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/39918e2f-8224-4b66-8ed5-6d1df51fb605%40isocpp.or=
g.

------=_Part_1112_902969872.1464996587756--

.


Author: alexander.zywicki@gmail.com
Date: Fri, 3 Jun 2016 17:59:37 -0700 (PDT)
Raw View
------=_Part_1210_981135175.1465001978231
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I will work up a revised version in the next day or so attempting to take i=
nto account some of the concerns expressed thus far.

This time I will skip the usage examples and write a specification of the t=
ypes and behaviors needed for the library as well as the libraries relation=
 to the platform that it is being used on. Hopefully that will make my inte=
nt for the library more clear and developable=20

--=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/a52ac785-eaf9-480d-96b4-8a8abb6870a2%40isocpp.or=
g.

------=_Part_1210_981135175.1465001978231--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Fri, 03 Jun 2016 22:05:28 -0300
Raw View
On s=C3=A1bado, 4 de junho de 2016 02:05:08 BRT Andrey Semashev wrote:
> > I would say that playing sounds from a file and recoding a microphone i=
nto
> > a file are the two most common uses of an audio API.
>=20
> I would say real time communication is the most common use case for
> audio recording nowdays. And it's not just about recording a
> microphone and throwing it to network, unfortunately. There is a fair
> bit of media processing going on under the hood.

No doubt. But you can't process if you can't record. And even if you do=20
process some data and send it over the network with proper time sync'ing, y=
ou=20
will want to play it.

--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--=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/77201316.QUy4E49TlF%40tjmaciei-mobl1.

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Fri, 03 Jun 2016 22:09:06 -0300
Raw View
On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:
> What is needed is a standardized interface for these different modules
> to work with each other. The interface should also allow me, the
> developer, to work with the media (e.g. create my own audio or image
> filter or a new codec or a new device driver).

That I agree with.

But should the standard mandate that there should be at least one? How does=
=20
someone write a plugin to the C++ Standard Library? Will we now mandate thi=
s=20
kind of ability?

If not, then will there be a requirement that the C++ library vendor provid=
e=20
it? If so, please think carefully how Apple should code libc++ to work on i=
OS.

Again, I think this is not material for the C++ Standard Library.

--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--=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/1580229.cHEgQxCuA1%40tjmaciei-mobl1.

.


Author: alexander.zywicki@gmail.com
Date: Fri, 3 Jun 2016 18:26:04 -0700 (PDT)
Raw View
------=_Part_1136_157290055.1465003565033
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Friday, June 3, 2016 at 8:09:11 PM UTC-5, Thiago Macieira wrote:
> On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:
> > What is needed is a standardized interface for these different modules
> > to work with each other. The interface should also allow me, the
> > developer, to work with the media (e.g. create my own audio or image
> > filter or a new codec or a new device driver).
>=20
> That I agree with.
>=20
> But should the standard mandate that there should be at least one? How do=
es=20
> someone write a plugin to the C++ Standard Library? Will we now mandate t=
his=20
> kind of ability?
>=20
> If not, then will there be a requirement that the C++ library vendor prov=
ide=20
> it? If so, please think carefully how Apple should code libc++ to work on=
 iOS.
>=20
> Again, I think this is not material for the C++ Standard Library.
>=20
> --=20
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>    Software Architect - Intel Open Source Technology Center

I do not think that this is as big as an issue as you portray it, each majo=
r platform provides its own mechanism for interfacing with audio hardware. =
Core Audio on OS X, Alsa on many Linux systems, etc... The standard would s=
upply a specification of an interface that the compiler vendor could use to=
 wrap the platform specific code needed to interact with the audio hardware=
.. if the target platform provides a platform specific library for audio it =
should be reasonable for a compiler vendor for that platform to integrate t=
hat library into its version of libc++.=20

As far as how someone would write a plugin for the std library? You can wri=
te custom alligators, deleters and such, why couldn't you write a device dr=
iver given a interface specification?=20

Should at least one possible driver be available? In an ideal world yes, at=
 minimum you should be able to load a file right? But an audio driver for t=
he library? If it's available from the system, the compiler vendor would be=
 allowed to create a driver around that library. rather than specifying a m=
inimum required number of drivers be available, why not just specify that i=
n the case that your vendor does not supply one that a interface is provide=
d for you to create your own. But at the same time it would not be very dif=
ficult for the vendor to supply at least one for major platforms? The only =
issue I could see is for an embedded system which may not run an OS? But ev=
en then the developer could just create one for that target...

--=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/d8b400fc-1fe2-4878-b389-abaace8818d7%40isocpp.or=
g.

------=_Part_1136_157290055.1465003565033--

.


Author: "'Jeffrey Yasskin' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Fri, 3 Jun 2016 18:30:28 -0700
Raw View
--001a1143d182f1c7e5053469c952
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira <thiago@macieira.org> wrote=
:

> On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:
> > What is needed is a standardized interface for these different modules
> > to work with each other. The interface should also allow me, the
> > developer, to work with the media (e.g. create my own audio or image
> > filter or a new codec or a new device driver).
>
> That I agree with.
>
> But should the standard mandate that there should be at least one? How do=
es
> someone write a plugin to the C++ Standard Library? Will we now mandate
> this
> kind of ability?
>

Yes. We already do this with things like the random engines.

If not, then will there be a requirement that the C++ library vendor provid=
e
> it? If so, please think carefully how Apple should code libc++ to work on
> iOS.
>

WebCrypto has an example of navigating a legal minefield for implementers.

Also remember to leave the legal speculation to lawyers. It's good to have
the heads-up that "hey lawyers should look at this", but anything more is
unwise.

Again, I think this is not material for the C++ Standard Library.
>

I think it's a great area for the C++ library to expand into. I'm
definitely worried about the expertise of the people writing the proposal
(e.g. if I proposed an audio library for C++, I should be laughed off the
stage), but we can overcome that by asking well-known audio users for their
opinions before standardizing the proposal.

Jeffrey

--=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/CANh-dX%3DheKaWzvE%2Brk8FeCSTQyZ8-FR9UaGdam8quLa=
EuLJ%3D-A%40mail.gmail.com.

--001a1143d182f1c7e5053469c952
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On F=
ri, Jun 3, 2016 at 6:09 PM, Thiago Macieira <span dir=3D"ltr">&lt;<a href=
=3D"mailto:thiago@macieira.org" class=3D"gmail-cremed gmail-cremed cremed">=
thiago@macieira.org</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quo=
te" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-sty=
le:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class=
=3D"gmail-">On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev=
 wrote:<br>
&gt; What is needed is a standardized interface for these different modules=
<br>
&gt; to work with each other. The interface should also allow me, the<br>
&gt; developer, to work with the media (e.g. create my own audio or image<b=
r>
&gt; filter or a new codec or a new device driver).<br>
<br>
</span>That I agree with.<br>
<br>
But should the standard mandate that there should be at least one? How does=
<br>
someone write a plugin to the C++ Standard Library? Will we now mandate thi=
s<br>
kind of ability?<br></blockquote><div><br></div><div>Yes. We already do thi=
s with things like the random engines.</div><div><br></div><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;b=
order-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"=
>
If not, then will there be a requirement that the C++ library vendor provid=
e<br>
it? If so, please think carefully how Apple should code libc++ to work on i=
OS.<br></blockquote><div><br></div><div>WebCrypto has an example of=C2=A0na=
vigating a legal minefield for implementers.<br></div><div><br></div><div>A=
lso remember to leave the legal speculation to lawyers. It&#39;s good to ha=
ve the heads-up that &quot;hey lawyers should look at this&quot;, but anyth=
ing more is unwise.</div><div><br></div><blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:so=
lid;border-left-color:rgb(204,204,204);padding-left:1ex">
Again, I think this is not material for the C++ Standard Library.<br></bloc=
kquote><div><br></div></div>I think it&#39;s a great area for the C++ libra=
ry to expand into. I&#39;m definitely worried about the expertise of the pe=
ople writing the proposal (e.g. if I proposed an audio library for C++, I s=
hould be laughed off the stage), but we can overcome that by asking well-kn=
own audio users for their opinions before standardizing the proposal.</div>=
<div class=3D"gmail_extra"><br></div><div class=3D"gmail_extra">Jeffrey</di=
v></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CANh-dX%3DheKaWzvE%2Brk8FeCSTQyZ8-FR9=
UaGdam8quLaEuLJ%3D-A%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CANh-dX%3Dh=
eKaWzvE%2Brk8FeCSTQyZ8-FR9UaGdam8quLaEuLJ%3D-A%40mail.gmail.com</a>.<br />

--001a1143d182f1c7e5053469c952--

.


Author: alexander.zywicki@gmail.com
Date: Fri, 3 Jun 2016 18:47:29 -0700 (PDT)
Raw View
------=_Part_515_821277321.1465004849129
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Friday, June 3, 2016 at 8:30:49 PM UTC-5, Jeffrey Yasskin wrote:
> On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira <thi...@macieira.org> wro=
te:
> On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:
>=20
> > What is needed is a standardized interface for these different modules
>=20
> > to work with each other. The interface should also allow me, the
>=20
> > developer, to work with the media (e.g. create my own audio or image
>=20
> > filter or a new codec or a new device driver).
>=20
>=20
>=20
> That I agree with.
>=20
>=20
>=20
> But should the standard mandate that there should be at least one? How do=
es
>=20
> someone write a plugin to the C++ Standard Library? Will we now mandate t=
his
>=20
> kind of ability?
>=20
>=20
>=20
> Yes. We already do this with things like the random engines.
>=20
>=20
> If not, then will there be a requirement that the C++ library vendor prov=
ide
>=20
> it? If so, please think carefully how Apple should code libc++ to work on=
 iOS.
>=20
>=20
>=20
> WebCrypto has an example of=C2=A0navigating a legal minefield for impleme=
nters.
>=20
>=20
>=20
> Also remember to leave the legal speculation to lawyers. It's good to hav=
e the heads-up that "hey lawyers should look at this", but anything more is=
 unwise.
>=20
>=20
> Again, I think this is not material for the C++ Standard Library.
>=20
>=20
> I think it's a great area for the C++ library to expand into. I'm definit=
ely worried about the expertise of the people writing the proposal (e.g. if=
 I proposed an audio library for C++, I should be laughed off the stage), b=
ut we can overcome that by asking well-known audio users for their opinions=
 before standardizing the proposal.
>=20
>=20
> Jeffrey

I agree about the issue of expertise. By no means would I call myself an ex=
pert, but I have a degree in audio engineering and a pretty solid grasp of =
the c++ language. Are there people out there more skilled than me at each t=
opic? Of course, but that's why I am here, to get the opinions of those peo=
ple if I can an figure out what needs to be done to make this library a rea=
lity.=20

--=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/62b7649a-5de5-4330-9bac-708375d36e2c%40isocpp.or=
g.

------=_Part_515_821277321.1465004849129--

.


Author: ron novy <rsn10100@gmail.com>
Date: Fri, 3 Jun 2016 19:11:23 -0700
Raw View
--001a1141cf0c2e8c9105346a5bda
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Okay, I've done some thinking here.  The simplest solution should be the
correct one.  I think the standard should stick to something very basic
here, otherwise we get into an area that is too complicated to implement.
All we should have in terms of a standard audio interface for C++ is:

1) A method for enumerating the interfaces on a machine.
2) A method for getting each interfaces capabilities (supported rates, bit
depths etc.).
3) A method for activating a requested device for sending and receiving
frames in the requested format.

Valid types for audio samples should be either a signed integer, a float or
a double.  And that's pretty much it.  Get audio input, put audio output.
Anything other than that would be a different proposal all together.
Audio, video or DSP processing in general should certainly be a different
proposal.

But I would propose we also add an int24_t class into the standard for
processing 24-bit samples.  Something as simple as this would suffice for
now:
class int24_t
{
private:
    int8_t val[3];
};

Something more fully featured would be desirable, like this:
https://github.com/RonNovy/CppDSP/blob/master/src/int24_t.h
But I guess that, would be another proposal.

On Fri, Jun 3, 2016 at 6:47 PM, <alexander.zywicki@gmail.com> wrote:

> On Friday, June 3, 2016 at 8:30:49 PM UTC-5, Jeffrey Yasskin wrote:
> > On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira <thi...@macieira.org>
> wrote:
> > On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:
> >
> > > What is needed is a standardized interface for these different module=
s
> >
> > > to work with each other. The interface should also allow me, the
> >
> > > developer, to work with the media (e.g. create my own audio or image
> >
> > > filter or a new codec or a new device driver).
> >
> >
> >
> > That I agree with.
> >
> >
> >
> > But should the standard mandate that there should be at least one? How
> does
> >
> > someone write a plugin to the C++ Standard Library? Will we now mandate
> this
> >
> > kind of ability?
> >
> >
> >
> > Yes. We already do this with things like the random engines.
> >
> >
> > If not, then will there be a requirement that the C++ library vendor
> provide
> >
> > it? If so, please think carefully how Apple should code libc++ to work
> on iOS.
> >
> >
> >
> > WebCrypto has an example of navigating a legal minefield for
> implementers.
> >
> >
> >
> > Also remember to leave the legal speculation to lawyers. It's good to
> have the heads-up that "hey lawyers should look at this", but anything mo=
re
> is unwise.
> >
> >
> > Again, I think this is not material for the C++ Standard Library.
> >
> >
> > I think it's a great area for the C++ library to expand into. I'm
> definitely worried about the expertise of the people writing the proposal
> (e.g. if I proposed an audio library for C++, I should be laughed off the
> stage), but we can overcome that by asking well-known audio users for the=
ir
> opinions before standardizing the proposal.
> >
> >
> > Jeffrey
>
> I agree about the issue of expertise. By no means would I call myself an
> expert, but I have a degree in audio engineering and a pretty solid grasp
> of the c++ language. Are there people out there more skilled than me at
> each topic? Of course, but that's why I am here, to get the opinions of
> those people if I can an figure out what needs to be done to make this
> library a reality.
>
> --
> 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
> email 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/62b7649a-5de=
5-4330-9bac-708375d36e2c%40isocpp.org
> .
>

--=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/CAOcFa%3DfnWS%3DT2p6xgQ_EiCnVTmkSk_UrobDMYvXhaKi=
95cxrdQ%40mail.gmail.com.

--001a1141cf0c2e8c9105346a5bda
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Okay, I&#39;ve done some thinking here.=C2=A0 The sim=
plest solution should be the correct one.=C2=A0 I think the standard should=
 stick to something very basic here, otherwise we get into an area that is =
too complicated to implement.=C2=A0 All we should have in terms of a standa=
rd audio interface for C++ is:</div><div><br></div><div>1) A method for enu=
merating the interfaces on a machine.</div><div>2) A method for getting eac=
h interfaces capabilities (supported rates, bit depths etc.).</div><div>3) =
A method for activating a requested device for sending and receiving frames=
 in the requested format.</div><div><br></div><div>Valid types for audio sa=
mples should be either a signed integer, a float or a double.=C2=A0 And tha=
t&#39;s pretty much it.=C2=A0 Get audio input, put audio output.=C2=A0 Anyt=
hing other than that would be a different proposal all together.=C2=A0 Audi=
o, video or DSP processing in general should certainly be a different propo=
sal.</div><div><br></div><div>But I would propose we also add an int24_t cl=
ass into the standard for processing 24-bit samples.=C2=A0 Something as sim=
ple as this would suffice for now:</div><div>class int24_t</div><div>{</div=
><div>private:</div><div>=C2=A0 =C2=A0 int8_t val[3];</div><div>};</div><di=
v><br></div><div>Something more fully featured would be desirable, like thi=
s: <a href=3D"https://github.com/RonNovy/CppDSP/blob/master/src/int24_t.h">=
https://github.com/RonNovy/CppDSP/blob/master/src/int24_t.h</a></div><div>B=
ut I guess that, would be another proposal.</div></div><div class=3D"gmail_=
extra"><br><div class=3D"gmail_quote">On Fri, Jun 3, 2016 at 6:47 PM,  <spa=
n dir=3D"ltr">&lt;<a href=3D"mailto:alexander.zywicki@gmail.com" target=3D"=
_blank">alexander.zywicki@gmail.com</a>&gt;</span> wrote:<br><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;p=
adding-left:1ex">On Friday, June 3, 2016 at 8:30:49 PM UTC-5, Jeffrey Yassk=
in wrote:<br>
<span class=3D"">&gt; On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira &lt;<=
a href=3D"mailto:thi...@macieira.org">thi...@macieira.org</a>&gt; wrote:<br=
>
&gt; On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:=
<br>
&gt;<br>
&gt; &gt; What is needed is a standardized interface for these different mo=
dules<br>
&gt;<br>
&gt; &gt; to work with each other. The interface should also allow me, the<=
br>
&gt;<br>
&gt; &gt; developer, to work with the media (e.g. create my own audio or im=
age<br>
&gt;<br>
&gt; &gt; filter or a new codec or a new device driver).<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; That I agree with.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; But should the standard mandate that there should be at least one? How=
 does<br>
&gt;<br>
&gt; someone write a plugin to the C++ Standard Library? Will we now mandat=
e this<br>
&gt;<br>
&gt; kind of ability?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Yes. We already do this with things like the random engines.<br>
&gt;<br>
&gt;<br>
&gt; If not, then will there be a requirement that the C++ library vendor p=
rovide<br>
&gt;<br>
&gt; it? If so, please think carefully how Apple should code libc++ to work=
 on iOS.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; WebCrypto has an example of=C2=A0navigating a legal minefield for impl=
ementers.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Also remember to leave the legal speculation to lawyers. It&#39;s good=
 to have the heads-up that &quot;hey lawyers should look at this&quot;, but=
 anything more is unwise.<br>
&gt;<br>
&gt;<br>
&gt; Again, I think this is not material for the C++ Standard Library.<br>
&gt;<br>
&gt;<br>
&gt; I think it&#39;s a great area for the C++ library to expand into. I&#3=
9;m definitely worried about the expertise of the people writing the propos=
al (e.g. if I proposed an audio library for C++, I should be laughed off th=
e stage), but we can overcome that by asking well-known audio users for the=
ir opinions before standardizing the proposal.<br>
&gt;<br>
&gt;<br>
&gt; Jeffrey<br>
<br>
</span>I agree about the issue of expertise. By no means would I call mysel=
f an expert, but I have a degree in audio engineering and a pretty solid gr=
asp of the c++ language. Are there people out there more skilled than me at=
 each topic? Of course, but that&#39;s why I am here, to get the opinions o=
f those people if I can an figure out what needs to be done to make this li=
brary a reality.<br>
<span class=3D""><br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-propo=
sals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
</span>To view this discussion on the web visit <a href=3D"https://groups.g=
oogle.com/a/isocpp.org/d/msgid/std-proposals/62b7649a-5de5-4330-9bac-708375=
d36e2c%40isocpp.org" rel=3D"noreferrer" target=3D"_blank">https://groups.go=
ogle.com/a/isocpp.org/d/msgid/std-proposals/62b7649a-5de5-4330-9bac-708375d=
36e2c%40isocpp.org</a>.<br>
</blockquote></div><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAOcFa%3DfnWS%3DT2p6xgQ_EiCnVTmkSk_Ur=
obDMYvXhaKi95cxrdQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOcFa%3DfnWS=
%3DT2p6xgQ_EiCnVTmkSk_UrobDMYvXhaKi95cxrdQ%40mail.gmail.com</a>.<br />

--001a1141cf0c2e8c9105346a5bda--

.


Author: alexander.zywicki@gmail.com
Date: Fri, 3 Jun 2016 19:35:36 -0700 (PDT)
Raw View
------=_Part_1147_620087267.1465007736584
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Friday, June 3, 2016 at 9:11:26 PM UTC-5, Ron wrote:
> Okay, I've done some thinking here.=C2=A0 The simplest solution should be=
 the correct one.=C2=A0 I think the standard should stick to something very=
 basic here, otherwise we get into an area that is too complicated to imple=
ment.=C2=A0 All we should have in terms of a standard audio interface for C=
++ is:
>=20
>=20
> 1) A method for enumerating the interfaces on a machine.
> 2) A method for getting each interfaces capabilities (supported rates, bi=
t depths etc.).
> 3) A method for activating a requested device for sending and receiving f=
rames in the requested format.
>=20
>=20
> Valid types for audio samples should be either a signed integer, a float =
or a double.=C2=A0 And that's pretty much it.=C2=A0 Get audio input, put au=
dio output.=C2=A0 Anything other than that would be a different proposal al=
l together.=C2=A0 Audio, video or DSP processing in general should certainl=
y be a different proposal.
>=20
>=20
> But I would propose we also add an int24_t class into the standard for pr=
ocessing 24-bit samples.=C2=A0 Something as simple as this would suffice fo=
r now:
> class int24_t
> {
> private:
> =C2=A0 =C2=A0 int8_t val[3];
> };
>=20
>=20
> Something more fully featured would be desirable, like this: https://gith=
ub.com/RonNovy/CppDSP/blob/master/src/int24_t.h
> But I guess that, would be another proposal.
>=20
>=20
> On Fri, Jun 3, 2016 at 6:47 PM,  <alexande...@gmail.com> wrote:
> On Friday, June 3, 2016 at 8:30:49 PM UTC-5, Jeffrey Yasskin wrote:
>=20
> > On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira <thi...@macieira.org> w=
rote:
>=20
> > On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:
>=20
> >
>=20
> > > What is needed is a standardized interface for these different module=
s
>=20
> >
>=20
> > > to work with each other. The interface should also allow me, the
>=20
> >
>=20
> > > developer, to work with the media (e.g. create my own audio or image
>=20
> >
>=20
> > > filter or a new codec or a new device driver).
>=20
> >
>=20
> >
>=20
> >
>=20
> > That I agree with.
>=20
> >
>=20
> >
>=20
> >
>=20
> > But should the standard mandate that there should be at least one? How =
does
>=20
> >
>=20
> > someone write a plugin to the C++ Standard Library? Will we now mandate=
 this
>=20
> >
>=20
> > kind of ability?
>=20
> >
>=20
> >
>=20
> >
>=20
> > Yes. We already do this with things like the random engines.
>=20
> >
>=20
> >
>=20
> > If not, then will there be a requirement that the C++ library vendor pr=
ovide
>=20
> >
>=20
> > it? If so, please think carefully how Apple should code libc++ to work =
on iOS.
>=20
> >
>=20
> >
>=20
> >
>=20
> > WebCrypto has an example of=C2=A0navigating a legal minefield for imple=
menters.
>=20
> >
>=20
> >
>=20
> >
>=20
> > Also remember to leave the legal speculation to lawyers. It's good to h=
ave the heads-up that "hey lawyers should look at this", but anything more =
is unwise.
>=20
> >
>=20
> >
>=20
> > Again, I think this is not material for the C++ Standard Library.
>=20
> >
>=20
> >
>=20
> > I think it's a great area for the C++ library to expand into. I'm defin=
itely worried about the expertise of the people writing the proposal (e.g. =
if I proposed an audio library for C++, I should be laughed off the stage),=
 but we can overcome that by asking well-known audio users for their opinio=
ns before standardizing the proposal.
>=20
> >
>=20
> >
>=20
> > Jeffrey
>=20
>=20
>=20
> I agree about the issue of expertise. By no means would I call myself an =
expert, but I have a degree in audio engineering and a pretty solid grasp o=
f the c++ language. Are there people out there more skilled than me at each=
 topic? Of course, but that's why I am here, to get the opinions of those p=
eople if I can an figure out what needs to be done to make this library a r=
eality.
>=20
>=20
>=20
> --
>=20
> You received this message because you are subscribed to the Google Groups=
 "ISO C++ Standard - Future Proposals" group.
>=20
> To unsubscribe from this group and stop receiving emails from it, send an=
 email to std-proposal...@isocpp.org.
>=20
> To post to this group, send email to std-pr...@isocpp.org.
>=20
> To view this discussion on the web visit https://groups.google.com/a/isoc=
pp.org/d/msgid/std-proposals/62b7649a-5de5-4330-9bac-708375d36e2c%40isocpp.=
org.

I think that simplicity is a good way to go but I believe that what you are=
 proposing may be too basic. As it stands none of the std containers meet t=
he needs for audio. The closest I would argue could be std::array of you ar=
e okay with a buffer length fixed at compile time or std::vector but std::v=
ector could cause a dynamic memory allocation on a real time thread if the =
user tries to push_back and the vector needs to expand. This allocation cou=
ld lead to an unknown wait time for the audio thread and possibly result in=
 buffer under flow to the driver. You could use a plain array but that leav=
es room for memory leaks and makes copying buffers difficult.=20

A container designed for real-time usage would be needed.=20

I don't see how processing would need to be a different proposal, what is a=
n audio library without a well organized and effiecint way means for intera=
cting with the audio data?=20

If processing does need to be a different proposal, I do believe that they =
would need to be designed simultaneously so that they might be easily inter=
faces with each other, because I feel that they would most likely be used i=
n conjunction in many cases.

--=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/a27c2580-c766-4488-bc26-a7b15783e0fd%40isocpp.or=
g.

------=_Part_1147_620087267.1465007736584--

.


Author: ron novy <rsn10100@gmail.com>
Date: Fri, 3 Jun 2016 20:51:09 -0700
Raw View
--001a1143e8e001208d05346bc0d3
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Well, it needs to start somewhere.  I think having basic buffers using
std::array or plain old arrays might do for now and get some basic audio
recording 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 way 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.


On Fri, Jun 3, 2016 at 7:35 PM, <alexander.zywicki@gmail.com> wrote:

> On Friday, June 3, 2016 at 9:11:26 PM UTC-5, Ron wrote:
> > Okay, I've done some thinking here.  The simplest solution should be th=
e
> correct one.  I think the standard should stick to something very basic
> here, otherwise we get into an area that is too complicated to implement.
> All we should have in terms of a standard audio interface for C++ is:
> >
> >
> > 1) A method for enumerating the interfaces on a machine.
> > 2) A method for getting each interfaces capabilities (supported rates,
> bit depths etc.).
> > 3) A method for activating a requested device for sending and receiving
> frames in the requested format.
> >
> >
> > Valid types for audio samples should be either a signed integer, a floa=
t
> or a double.  And that's pretty much it.  Get audio input, put audio
> output.  Anything other than that would be a different proposal all
> together.  Audio, video or DSP processing in general should certainly be =
a
> different proposal.
> >
> >
> > But I would propose we also add an int24_t class into the standard for
> processing 24-bit samples.  Something as simple as this would suffice for
> now:
> > class int24_t
> > {
> > private:
> >     int8_t val[3];
> > };
> >
> >
> > Something more fully featured would be desirable, like this:
> https://github.com/RonNovy/CppDSP/blob/master/src/int24_t.h
> > But I guess that, would be another proposal.
> >
> >
> > On Fri, Jun 3, 2016 at 6:47 PM,  <alexande...@gmail.com> wrote:
> > On Friday, June 3, 2016 at 8:30:49 PM UTC-5, Jeffrey Yasskin wrote:
> >
> > > On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira <thi...@macieira.org>
> wrote:
> >
> > > On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote=
:
> >
> > >
> >
> > > > What is needed is a standardized interface for these different
> modules
> >
> > >
> >
> > > > to work with each other. The interface should also allow me, the
> >
> > >
> >
> > > > developer, to work with the media (e.g. create my own audio or imag=
e
> >
> > >
> >
> > > > filter or a new codec or a new device driver).
> >
> > >
> >
> > >
> >
> > >
> >
> > > That I agree with.
> >
> > >
> >
> > >
> >
> > >
> >
> > > But should the standard mandate that there should be at least one? Ho=
w
> does
> >
> > >
> >
> > > someone write a plugin to the C++ Standard Library? Will we now
> mandate this
> >
> > >
> >
> > > kind of ability?
> >
> > >
> >
> > >
> >
> > >
> >
> > > Yes. We already do this with things like the random engines.
> >
> > >
> >
> > >
> >
> > > If not, then will there be a requirement that the C++ library vendor
> provide
> >
> > >
> >
> > > it? If so, please think carefully how Apple should code libc++ to wor=
k
> on iOS.
> >
> > >
> >
> > >
> >
> > >
> >
> > > WebCrypto has an example of navigating a legal minefield for
> implementers.
> >
> > >
> >
> > >
> >
> > >
> >
> > > Also remember to leave the legal speculation to lawyers. It's good to
> have the heads-up that "hey lawyers should look at this", but anything mo=
re
> is unwise.
> >
> > >
> >
> > >
> >
> > > Again, I think this is not material for the C++ Standard Library.
> >
> > >
> >
> > >
> >
> > > I think it's a great area for the C++ library to expand into. I'm
> definitely worried about the expertise of the people writing the proposal
> (e.g. if I proposed an audio library for C++, I should be laughed off the
> stage), but we can overcome that by asking well-known audio users for the=
ir
> opinions before standardizing the proposal.
> >
> > >
> >
> > >
> >
> > > Jeffrey
> >
> >
> >
> > I agree about the issue of expertise. By no means would I call myself a=
n
> expert, but I have a degree in audio engineering and a pretty solid grasp
> of the c++ language. Are there people out there more skilled than me at
> each topic? Of course, but that's why I am here, to get the opinions of
> those people if I can an figure out what needs to be done to make this
> library a reality.
> >
> >
> >
> > --
> >
> > 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 email to std-proposal...@isocpp.org.
> >
> > To post to this group, send email to std-pr...@isocpp.org.
> >
> > To view this discussion on the web visit
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/62b7649a-5de=
5-4330-9bac-708375d36e2c%40isocpp.org
> .
>
> I think that simplicity is a good way to go but I believe that what you
> are proposing may be too basic. As it stands none of the std containers
> meet the needs for audio. The closest I would argue could be std::array o=
f
> you are okay with a buffer length fixed at compile time or std::vector bu=
t
> std::vector could cause a dynamic memory allocation on a real time thread
> if the user tries to push_back and the vector needs to expand. This
> allocation could lead to an unknown wait time for the audio thread and
> possibly result in buffer under flow to the driver. You could use a plain
> array but that leaves room for memory leaks and makes copying buffers
> difficult.
>
> A container designed for real-time usage would be needed.
>
> I don't see how processing would need to be a different proposal, what is
> an audio library without a well organized and effiecint way means for
> interacting with the audio data?
>
> If processing does need to be a different proposal, I do believe that the=
y
> would need to be designed simultaneously so that they might be easily
> interfaces with each other, because I feel that they would most likely be
> used in conjunction in many cases.
>
> --
> 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
> email 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/a27c2580-c76=
6-4488-bc26-a7b15783e0fd%40isocpp.org
> .
>

--=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/CAOcFa%3DethRsOWP2QQeTtOdtQngEVdo5e29nX%2BSQAFzy=
xTdhJzA%40mail.gmail.com.

--001a1143e8e001208d05346bc0d3
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Well, it needs to start somewhere.=C2=A0 I think having ba=
sic buffers using std::array or plain old arrays might do for now and get s=
ome basic audio recording and playback into C++.=C2=A0 It should be as simp=
le 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 classes.=C2=A0 This way there is at least something semi-usab=
le with code we have today while the rest of the building blocks are being =
worked on.=C2=A0 Just a thought though.<div><br></div></div><div class=3D"g=
mail_extra"><br><div class=3D"gmail_quote">On Fri, Jun 3, 2016 at 7:35 PM, =
 <span dir=3D"ltr">&lt;<a href=3D"mailto:alexander.zywicki@gmail.com" targe=
t=3D"_blank">alexander.zywicki@gmail.com</a>&gt;</span> wrote:<br><blockquo=
te class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc so=
lid;padding-left:1ex"><span class=3D"">On Friday, June 3, 2016 at 9:11:26 P=
M UTC-5, Ron wrote:<br>
&gt; Okay, I&#39;ve done some thinking here.=C2=A0 The simplest solution sh=
ould be the correct one.=C2=A0 I think the standard should stick to somethi=
ng very basic here, otherwise we get into an area that is too complicated t=
o implement.=C2=A0 All we should have in terms of a standard audio interfac=
e for C++ is:<br>
&gt;<br>
&gt;<br>
&gt; 1) A method for enumerating the interfaces on a machine.<br>
&gt; 2) A method for getting each interfaces capabilities (supported rates,=
 bit depths etc.).<br>
&gt; 3) A method for activating a requested device for sending and receivin=
g frames in the requested format.<br>
&gt;<br>
&gt;<br>
&gt; Valid types for audio samples should be either a signed integer, a flo=
at or a double.=C2=A0 And that&#39;s pretty much it.=C2=A0 Get audio input,=
 put audio output.=C2=A0 Anything other than that would be a different prop=
osal all together.=C2=A0 Audio, video or DSP processing in general should c=
ertainly be a different proposal.<br>
&gt;<br>
&gt;<br>
&gt; But I would propose we also add an int24_t class into the standard for=
 processing 24-bit samples.=C2=A0 Something as simple as this would suffice=
 for now:<br>
&gt; class int24_t<br>
&gt; {<br>
&gt; private:<br>
&gt; =C2=A0 =C2=A0 int8_t val[3];<br>
&gt; };<br>
&gt;<br>
&gt;<br>
&gt; Something more fully featured would be desirable, like this: <a href=
=3D"https://github.com/RonNovy/CppDSP/blob/master/src/int24_t.h" rel=3D"nor=
eferrer" target=3D"_blank">https://github.com/RonNovy/CppDSP/blob/master/sr=
c/int24_t.h</a><br>
&gt; But I guess that, would be another proposal.<br>
&gt;<br>
&gt;<br>
</span><span class=3D"">&gt; On Fri, Jun 3, 2016 at 6:47 PM,=C2=A0 &lt;<a h=
ref=3D"mailto:alexande...@gmail.com">alexande...@gmail.com</a>&gt; wrote:<b=
r>
&gt; On Friday, June 3, 2016 at 8:30:49 PM UTC-5, Jeffrey Yasskin wrote:<br=
>
&gt;<br>
&gt; &gt; On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira &lt;<a href=3D"ma=
ilto:thi...@macieira.org">thi...@macieira.org</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev w=
rote:<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; &gt; What is needed is a standardized interface for these differe=
nt modules<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; &gt; to work with each other. The interface should also allow me,=
 the<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; &gt; developer, to work with the media (e.g. create my own audio =
or image<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; &gt; filter or a new codec or a new device driver).<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; That I agree with.<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; But should the standard mandate that there should be at least one=
? How does<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; someone write a plugin to the C++ Standard Library? Will we now m=
andate this<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; kind of ability?<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; Yes. We already do this with things like the random engines.<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; If not, then will there be a requirement that the C++ library ven=
dor provide<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; it? If so, please think carefully how Apple should code libc++ to=
 work on iOS.<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; WebCrypto has an example of=C2=A0navigating a legal minefield for=
 implementers.<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; Also remember to leave the legal speculation to lawyers. It&#39;s=
 good to have the heads-up that &quot;hey lawyers should look at this&quot;=
, but anything more is unwise.<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; Again, I think this is not material for the C++ Standard Library.=
<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; I think it&#39;s a great area for the C++ library to expand into.=
 I&#39;m definitely worried about the expertise of the people writing the p=
roposal (e.g. if I proposed an audio library for C++, I should be laughed o=
ff the stage), but we can overcome that by asking well-known audio users fo=
r their opinions before standardizing the proposal.<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; Jeffrey<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; I agree about the issue of expertise. By no means would I call myself =
an expert, but I have a degree in audio engineering and a pretty solid gras=
p of the c++ language. Are there people out there more skilled than me at e=
ach topic? Of course, but that&#39;s why I am here, to get the opinions of =
those people if I can an figure out what needs to be done to make this libr=
ary a reality.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt;<br>
&gt; You received this message because you are subscribed to the Google Gro=
ups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
&gt;<br>
</span>&gt; To unsubscribe from this group and stop receiving emails from i=
t, send an email to <a href=3D"mailto:std-proposal...@isocpp.org">std-propo=
sal...@isocpp.org</a>.<br>
&gt;<br>
&gt; To post to this group, send email to <a href=3D"mailto:std-pr...@isocp=
p.org">std-pr...@isocpp.org</a>.<br>
<span class=3D"">&gt;<br>
&gt; To view this discussion on the web visit <a href=3D"https://groups.goo=
gle.com/a/isocpp.org/d/msgid/std-proposals/62b7649a-5de5-4330-9bac-708375d3=
6e2c%40isocpp.org" rel=3D"noreferrer" target=3D"_blank">https://groups.goog=
le.com/a/isocpp.org/d/msgid/std-proposals/62b7649a-5de5-4330-9bac-708375d36=
e2c%40isocpp.org</a>.<br>
<br>
</span>I think that simplicity is a good way to go but I believe that what =
you are proposing may be too basic. As it stands none of the std containers=
 meet the needs for audio. The closest I would argue could be std::array of=
 you are okay with a buffer length fixed at compile time or std::vector but=
 std::vector could cause a dynamic memory allocation on a real time thread =
if the user tries to push_back and the vector needs to expand. This allocat=
ion could lead to an unknown wait time for the audio thread and possibly re=
sult in buffer under flow to the driver. You could use a plain array but th=
at leaves room for memory leaks and makes copying buffers difficult.<br>
<br>
A container designed for real-time usage would be needed.<br>
<br>
I don&#39;t see how processing would need to be a different proposal, what =
is an audio library without a well organized and effiecint way means for in=
teracting with the audio data?<br>
<br>
If processing does need to be a different proposal, I do believe that they =
would need to be designed simultaneously so that they might be easily inter=
faces with each other, because I feel that they would most likely be used i=
n conjunction in many cases.<br>
<span class=3D""><br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-propo=
sals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
</span>To view this discussion on the web visit <a href=3D"https://groups.g=
oogle.com/a/isocpp.org/d/msgid/std-proposals/a27c2580-c766-4488-bc26-a7b157=
83e0fd%40isocpp.org" rel=3D"noreferrer" target=3D"_blank">https://groups.go=
ogle.com/a/isocpp.org/d/msgid/std-proposals/a27c2580-c766-4488-bc26-a7b1578=
3e0fd%40isocpp.org</a>.<br>
</blockquote></div><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAOcFa%3DethRsOWP2QQeTtOdtQngEVdo5e29=
nX%2BSQAFzyxTdhJzA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOcFa%3DethR=
sOWP2QQeTtOdtQngEVdo5e29nX%2BSQAFzyxTdhJzA%40mail.gmail.com</a>.<br />

--001a1143e8e001208d05346bc0d3--

.


Author: alexander.zywicki@gmail.com
Date: Fri, 3 Jun 2016 21:04:20 -0700 (PDT)
Raw View
------=_Part_2708_1354587437.1465013060639
Content-Type: multipart/alternative;
 boundary="----=_Part_2709_948455483.1465013060639"

------=_Part_2709_948455483.1465013060639
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I have drafted up a list of basic definitions about how audio could be=20
represented based on your comment here. I think if we are to attempt to=20
move forward a consensus must be reached about the fundamental=20
representation of audio data the library will take.=20

C++ std::audio library

theory and definitions:

    sample:
    a single sample of audio data.
    can be represented by a signed integer, float or double.
    must pass the following test to be a valid sample type:
        ((std::is_integral<T>::value && std::is_signed<T>::value) ||=20
std::is_floating_point<T>::value) =3D=3D true
    or could be constrained by:
         std::is_arithmetic<T>::value=3D=3Dtrue
     if unsigned samples are allowed/desired

    frame:
    a collection of 0-N samples
    each sample represents an individual channel of audio data
    indexable as an array
    (should N be runtime or compile time?)

    buffer:
    a collection of 0-N frames
    indexable as an array
    (should N be runtime or compile time?)
    ideally maintains a continous piece of memory to house its frames

    device /interface:
    a device recognized by the system as being capable of reading and=20
writing audio data
    can be polled for information regarding the capabilities of the=20
device/interface


    audio callback:
    a function/lambda/functor registered with the library to be called once=
=20
per buffer interval

    sampling rate: the number of samples per second of audio data

    frame interval: the length of a frame in seconds (1.0/sample_rate)
    buffer interval: the length of a buffer in seconds (frame_interval*=20
buffer_size)

What should be added/removed/edited or clarified?


On Friday, June 3, 2016 at 9:11:26 PM UTC-5, Ron wrote:
>
> Okay, I've done some thinking here.  The simplest solution should be the=
=20
> correct one.  I think the standard should stick to something very basic=
=20
> here, otherwise we get into an area that is too complicated to implement.=
 =20
> All we should have in terms of a standard audio interface for C++ is:
>
> 1) A method for enumerating the interfaces on a machine.
> 2) A method for getting each interfaces capabilities (supported rates, bi=
t=20
> depths etc.).
> 3) A method for activating a requested device for sending and receiving=
=20
> frames in the requested format.
>
> Valid types for audio samples should be either a signed integer, a float=
=20
> or a double.  And that's pretty much it.  Get audio input, put audio=20
> output.  Anything other than that would be a different proposal all=20
> together.  Audio, video or DSP processing in general should certainly be =
a=20
> different proposal.
>
> But I would propose we also add an int24_t class into the standard for=20
> processing 24-bit samples.  Something as simple as this would suffice for=
=20
> now:
> class int24_t
> {
> private:
>     int8_t val[3];
> };
>
> Something more fully featured would be desirable, like this:=20
> https://github.com/RonNovy/CppDSP/blob/master/src/int24_t.h
> But I guess that, would be another proposal.
>
> On Fri, Jun 3, 2016 at 6:47 PM, <alexande...@gmail.com <javascript:>>=20
> wrote:
>
>> On Friday, June 3, 2016 at 8:30:49 PM UTC-5, Jeffrey Yasskin wrote:
>> > On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira <thi...@macieira.org>=
=20
>> wrote:
>> > On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:
>> >
>> > > What is needed is a standardized interface for these different modul=
es
>> >
>> > > to work with each other. The interface should also allow me, the
>> >
>> > > developer, to work with the media (e.g. create my own audio or image
>> >
>> > > filter or a new codec or a new device driver).
>> >
>> >
>> >
>> > That I agree with.
>> >
>> >
>> >
>> > But should the standard mandate that there should be at least one? How=
=20
>> does
>> >
>> > someone write a plugin to the C++ Standard Library? Will we now mandat=
e=20
>> this
>> >
>> > kind of ability?
>> >
>> >
>> >
>> > Yes. We already do this with things like the random engines.
>> >
>> >
>> > If not, then will there be a requirement that the C++ library vendor=
=20
>> provide
>> >
>> > it? If so, please think carefully how Apple should code libc++ to work=
=20
>> on iOS.
>> >
>> >
>> >
>> > WebCrypto has an example of navigating a legal minefield for=20
>> implementers.
>> >
>> >
>> >
>> > Also remember to leave the legal speculation to lawyers. It's good to=
=20
>> have the heads-up that "hey lawyers should look at this", but anything m=
ore=20
>> is unwise.
>> >
>> >
>> > Again, I think this is not material for the C++ Standard Library.
>> >
>> >
>> > I think it's a great area for the C++ library to expand into. I'm=20
>> definitely worried about the expertise of the people writing the proposa=
l=20
>> (e.g. if I proposed an audio library for C++, I should be laughed off th=
e=20
>> stage), but we can overcome that by asking well-known audio users for th=
eir=20
>> opinions before standardizing the proposal.
>> >
>> >
>> > Jeffrey
>>
>> I agree about the issue of expertise. By no means would I call myself an=
=20
>> expert, but I have a degree in audio engineering and a pretty solid gras=
p=20
>> of the c++ language. Are there people out there more skilled than me at=
=20
>> each topic? Of course, but that's why I am here, to get the opinions of=
=20
>> those people if I can an figure out what needs to be done to make this=
=20
>> library a reality.
>>
>> --
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit=20
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/62b7649a-5d=
e5-4330-9bac-708375d36e2c%40isocpp.org
>> .
>>
>
>

--=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/3c0fde91-671d-4751-955d-7b04cfa120bc%40isocpp.or=
g.

------=_Part_2709_948455483.1465013060639
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I have drafted up a list of basic definitions about how au=
dio could be represented based on your comment here. I think if we are to a=
ttempt to move forward a consensus must be reached about the fundamental re=
presentation of audio data the library will take. <br><br><div style=3D"tex=
t-align: center;">C++ std::audio library<br><br>theory and definitions:<br>=
<br>=C2=A0=C2=A0=C2=A0 sample:<br>=C2=A0=C2=A0=C2=A0 a single sample of aud=
io data.<br>=C2=A0=C2=A0=C2=A0 can be represented by a signed integer, floa=
t or double.<br>=C2=A0=C2=A0=C2=A0 must pass the following test to be a val=
id sample type:<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((std::is_int=
egral&lt;T&gt;::value &amp;&amp; std::is_signed&lt;T&gt;::value) || std::is=
_floating_point&lt;T&gt;::value) =3D=3D true<br>=C2=A0=C2=A0=C2=A0 or could=
 be constrained by:<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 std=
::is_arithmetic&lt;T&gt;::value=3D=3Dtrue<br>=C2=A0=C2=A0=C2=A0=C2=A0 if un=
signed samples are allowed/desired<br><br>=C2=A0=C2=A0=C2=A0 frame:<br>=C2=
=A0=C2=A0=C2=A0 a collection of 0-N samples<br>=C2=A0=C2=A0=C2=A0 each samp=
le represents an individual channel of audio data<br>=C2=A0=C2=A0=C2=A0 ind=
exable as an array<br>=C2=A0=C2=A0=C2=A0 (should N be runtime or compile ti=
me?)<br><br>=C2=A0=C2=A0=C2=A0 buffer:<br>=C2=A0=C2=A0=C2=A0 a collection o=
f 0-N frames<br>=C2=A0=C2=A0=C2=A0 indexable as an array<br>=C2=A0=C2=A0=C2=
=A0 (should N be runtime or compile time?)<br>=C2=A0=C2=A0=C2=A0 ideally ma=
intains a continous piece of memory to house its frames<br><br>=C2=A0=C2=A0=
=C2=A0 device /interface:<br>=C2=A0=C2=A0=C2=A0 a device recognized by the =
system as being capable of reading and writing audio data<br>=C2=A0=C2=A0=
=C2=A0 can be polled for information regarding the capabilities of the devi=
ce/interface<br><br><br>=C2=A0=C2=A0=C2=A0 audio callback:<br>=C2=A0=C2=A0=
=C2=A0 a function/lambda/functor registered with the library to be called o=
nce per buffer interval<br><br>=C2=A0=C2=A0=C2=A0 sampling rate: the number=
 of samples per second of audio data<br><br>=C2=A0=C2=A0=C2=A0 frame interv=
al: the length of a frame in seconds (1.0/sample_rate)<br>=C2=A0=C2=A0=C2=
=A0 buffer interval: the length of a buffer in seconds (frame_interval* buf=
fer_size)<br><br><div style=3D"text-align: left;">What should be added/remo=
ved/edited or clarified?<br></div></div><br><br>On Friday, June 3, 2016 at =
9:11:26 PM UTC-5, Ron wrote:<blockquote class=3D"gmail_quote" style=3D"marg=
in: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><d=
iv dir=3D"ltr"><div>Okay, I&#39;ve done some thinking here.=C2=A0 The simpl=
est solution should be the correct one.=C2=A0 I think the standard should s=
tick to something very basic here, otherwise we get into an area that is to=
o complicated to implement.=C2=A0 All we should have in terms of a standard=
 audio interface for C++ is:</div><div><br></div><div>1) A method for enume=
rating the interfaces on a machine.</div><div>2) A method for getting each =
interfaces capabilities (supported rates, bit depths etc.).</div><div>3) A =
method for activating a requested device for sending and receiving frames i=
n the requested format.</div><div><br></div><div>Valid types for audio samp=
les should be either a signed integer, a float or a double.=C2=A0 And that&=
#39;s pretty much it.=C2=A0 Get audio input, put audio output.=C2=A0 Anythi=
ng other than that would be a different proposal all together.=C2=A0 Audio,=
 video or DSP processing in general should certainly be a different proposa=
l.</div><div><br></div><div>But I would propose we also add an int24_t clas=
s into the standard for processing 24-bit samples.=C2=A0 Something as simpl=
e as this would suffice for now:</div><div>class int24_t</div><div>{</div><=
div>private:</div><div>=C2=A0 =C2=A0 int8_t val[3];</div><div>};</div><div>=
<br></div><div>Something more fully featured would be desirable, like this:=
 <a href=3D"https://github.com/RonNovy/CppDSP/blob/master/src/int24_t.h" ta=
rget=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://ww=
w.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FRonNovy%2FCppDSP%2Fblob%2F=
master%2Fsrc%2Fint24_t.h\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH43AqVQTU-=
hwL7G8EiOcSTbZPweA&#39;;return true;" onclick=3D"this.href=3D&#39;https://w=
ww.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FRonNovy%2FCppDSP%2Fblob%2=
Fmaster%2Fsrc%2Fint24_t.h\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH43AqVQTU=
-hwL7G8EiOcSTbZPweA&#39;;return true;">https://github.com/RonNovy/<wbr>CppD=
SP/blob/master/src/int24_<wbr>t.h</a></div><div>But I guess that, would be =
another proposal.</div></div><div><br><div class=3D"gmail_quote">On Fri, Ju=
n 3, 2016 at 6:47 PM,  <span dir=3D"ltr">&lt;<a href=3D"javascript:" target=
=3D"_blank" gdf-obfuscated-mailto=3D"w80Ybt52AQAJ" rel=3D"nofollow" onmouse=
down=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.hre=
f=3D&#39;javascript:&#39;;return true;">alexande...@gmail.com</a>&gt;</span=
> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex">On Friday, June 3, 2016 at 8:30:=
49 PM UTC-5, Jeffrey Yasskin wrote:<br>
<span>&gt; On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira &lt;<a>thi...@ma=
cieira.org</a>&gt; wrote:<br>
&gt; On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:=
<br>
&gt;<br>
&gt; &gt; What is needed is a standardized interface for these different mo=
dules<br>
&gt;<br>
&gt; &gt; to work with each other. The interface should also allow me, the<=
br>
&gt;<br>
&gt; &gt; developer, to work with the media (e.g. create my own audio or im=
age<br>
&gt;<br>
&gt; &gt; filter or a new codec or a new device driver).<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; That I agree with.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; But should the standard mandate that there should be at least one? How=
 does<br>
&gt;<br>
&gt; someone write a plugin to the C++ Standard Library? Will we now mandat=
e this<br>
&gt;<br>
&gt; kind of ability?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Yes. We already do this with things like the random engines.<br>
&gt;<br>
&gt;<br>
&gt; If not, then will there be a requirement that the C++ library vendor p=
rovide<br>
&gt;<br>
&gt; it? If so, please think carefully how Apple should code libc++ to work=
 on iOS.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; WebCrypto has an example of=C2=A0navigating a legal minefield for impl=
ementers.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Also remember to leave the legal speculation to lawyers. It&#39;s good=
 to have the heads-up that &quot;hey lawyers should look at this&quot;, but=
 anything more is unwise.<br>
&gt;<br>
&gt;<br>
&gt; Again, I think this is not material for the C++ Standard Library.<br>
&gt;<br>
&gt;<br>
&gt; I think it&#39;s a great area for the C++ library to expand into. I&#3=
9;m definitely worried about the expertise of the people writing the propos=
al (e.g. if I proposed an audio library for C++, I should be laughed off th=
e stage), but we can overcome that by asking well-known audio users for the=
ir opinions before standardizing the proposal.<br>
&gt;<br>
&gt;<br>
&gt; Jeffrey<br>
<br>
</span>I agree about the issue of expertise. By no means would I call mysel=
f an expert, but I have a degree in audio engineering and a pretty solid gr=
asp of the c++ language. Are there people out there more skilled than me at=
 each topic? Of course, but that&#39;s why I am here, to get the opinions o=
f those people if I can an figure out what needs to be done to make this li=
brary a reality.<br>
<span><br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
w80Ybt52AQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&=
#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"w80Ybt52AQAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">std-pr...@isocpp.org</a>.<br>
</span>To view this discussion on the web visit <a href=3D"https://groups.g=
oogle.com/a/isocpp.org/d/msgid/std-proposals/62b7649a-5de5-4330-9bac-708375=
d36e2c%40isocpp.org" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this=
..href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/6=
2b7649a-5de5-4330-9bac-708375d36e2c%40isocpp.org&#39;;return true;" onclick=
=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/std-pro=
posals/62b7649a-5de5-4330-9bac-708375d36e2c%40isocpp.org&#39;;return true;"=
>https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/62b=
7649a-5de5-4330-<wbr>9bac-708375d36e2c%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></div>
</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/3c0fde91-671d-4751-955d-7b04cfa120bc%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/3c0fde91-671d-4751-955d-7b04cfa120bc=
%40isocpp.org</a>.<br />

------=_Part_2709_948455483.1465013060639--

------=_Part_2708_1354587437.1465013060639
Content-Type: text/plain; charset=US-ASCII;
 name=std_audio_theories_concepts.txt
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=std_audio_theories_concepts.txt
X-Attachment-Id: 6627695d-c41d-48ad-b42f-b3a67af03d47
Content-ID: <6627695d-c41d-48ad-b42f-b3a67af03d47>

C++ std::audio library

theory and definitions:

    sample:
    a single sample of audio data.
    can be represented by a signed integer, float or double.
    must pass the following test to be a valid sample type:
        ((std::is_integral<T>::value && std::is_signed<T>::value) || std::is_floating_point<T>::value) == true
    or could be constrained by:
         std::is_arithmetic<T>::value==true
     if unsigned samples are allowed/desired

    frame:
    a collection of 0-N samples
    each sample represents an individual channel of audio data
    indexable as an array
    (should N be runtime or compile time?)

    buffer:
    a collection of 0-N frames
    indexable as an array
    (should N be runtime or compile time?)
    ideally maintains a continous piece of memory to house its frames

    device /interface:
    a device recognized by the system as being capable of reading and writing audio data
    can be polled for information regarding the capabilities of the device/interface


    audio callback:
    a function/lambda/functor registered with the library to be called once per buffer interval

    sampling rate: the number of samples per second of audio data

    frame interval: the length of a frame in seconds (1.0/sample_rate)
    buffer interval: the length of a buffer in seconds (frame_interval* buffer_size)

------=_Part_2708_1354587437.1465013060639--

.


Author: alexander.zywicki@gmail.com
Date: Fri, 3 Jun 2016 21:08:44 -0700 (PDT)
Raw View
------=_Part_92_668365805.1465013324987
Content-Type: multipart/alternative;
 boundary="----=_Part_93_1962716670.1465013324987"

------=_Part_93_1962716670.1465013324987
Content-Type: text/plain; charset=UTF-8

I agree, how do you feel about the concept i proposed in my original about
having std audio stream classes similar to std::fstream. The
std::astream/iastream/oastream would represent the default audio device on
the system as determined by some method of polling the system. The user
could either choose to use them as is or manually select a different device?

On Friday, June 3, 2016 at 10:51:12 PM UTC-5, Ron wrote:
>
> Well, it needs to start somewhere.  I think having basic buffers using
> std::array or plain old arrays might do for now and get some basic audio
> recording 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 way 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.
>
>
>
>

--
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 email 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/4cfc7939-1ebf-415f-8ef4-d51e7cdadef5%40isocpp.org.

------=_Part_93_1962716670.1465013324987
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I agree, how do you feel about the concept i proposed in m=
y original about having std audio stream classes similar to std::fstream. T=
he std::astream/iastream/oastream would represent the default audio device =
on the system as determined by some method of polling the system. The user =
could either choose to use them as is or manually select a different device=
?<br><br>On Friday, June 3, 2016 at 10:51:12 PM UTC-5, Ron wrote:<blockquot=
e class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: =
1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">Well, it needs to start=
 somewhere.=C2=A0 I think having basic buffers using std::array or plain ol=
d arrays might do for now and get some basic audio recording and playback i=
nto 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 classes.=C2=A0 This way the=
re 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.<d=
iv><br></div></div><div><br><br></div>
</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/4cfc7939-1ebf-415f-8ef4-d51e7cdadef5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/4cfc7939-1ebf-415f-8ef4-d51e7cdadef5=
%40isocpp.org</a>.<br />

------=_Part_93_1962716670.1465013324987--

------=_Part_92_668365805.1465013324987--

.


Author: Ron <rsn10100@gmail.com>
Date: Fri, 3 Jun 2016 23:28:01 -0700 (PDT)
Raw View
------=_Part_1117_268347005.1465021681318
Content-Type: multipart/alternative;
 boundary="----=_Part_1118_423277400.1465021681318"

------=_Part_1118_423277400.1465021681318
Content-Type: text/plain; charset=UTF-8

Some thoughts...

'N' should be runtime for channels in a frame and for a frame buffer.  The
buffer size might be negotiable with the device.

I like a lot of that code in the original post, but I don't like the
comparison to iostreams.  Its really the '>>' operator that I don't like.
 When you copy into your frame buffer, an '=' operator should be used since
anyone that sees an '=' operator knows its a copy.  But really, you
shouldn't need to move data around so much.  If you stream from input to
'buff', then process and then move from 'buff' to output then you are
moving a lot of data unnecessarily.

I think what should happen is this; The process chain is triggered when the
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
reaches the input where the input device/file/etc copies the data to the
chains 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 data 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, where the input doesn't officially start until the
output is ready.  I know it is opposite of the way audio really flows
through a system but it makes things easier then moving data like a bucket
brigade.  It can also allow easier 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 output, the output calls to many
channels/nodes at once so they can all be processed in parallel and mixed
together after each of the processes end.

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
data in that is in the file format?  Its just confusing, so I think
'container' 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, interleaving, channel routing and other information and a
container class would deal with files.

I personally would rather have all audio with greater than 2 or 3 channels
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
with everyone so we would need a class for channel routing information as
well.

All I can think of at the moment..



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 about
> having std audio stream classes similar to std::fstream. The
> std::astream/iastream/oastream would represent the default audio device on
> the system as determined by some method of polling the system. The user
> could either choose to use them as is or manually select a different device?
>
> On Friday, June 3, 2016 at 10:51:12 PM UTC-5, Ron wrote:
>>
>> Well, it needs to start somewhere.  I think having basic buffers using
>> std::array or plain old arrays might do for now and get some basic audio
>> recording 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 way 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.
>>
>>
>>
>>

--
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 email 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/239cb9ab-c5d5-4ce5-b876-b5220cc1e116%40isocpp.org.

------=_Part_1118_423277400.1465021681318
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Some thoughts...</div><div><br></div><div>&#39;N&#39;=
 should be runtime for channels in a frame and for a frame buffer. =C2=A0Th=
e buffer size might be negotiable with the device.</div><div><br></div><div=
>I like a lot of that code in the original post, but I don&#39;t like the c=
omparison to iostreams. =C2=A0Its really the &#39;&gt;&gt;&#39; operator th=
at I don&#39;t like. =C2=A0When you copy into your frame buffer, an &#39;=
=3D&#39; operator should be used since anyone that sees an &#39;=3D&#39; op=
erator knows its a copy. =C2=A0But really, you shouldn&#39;t need to move d=
ata around so much. =C2=A0If you stream from input to &#39;buff&#39;, then =
process and then move from &#39;buff&#39; to output then you are moving a l=
ot of data unnecessarily.</div><div><br></div><div>I think what should happ=
en is this; The process chain is triggered when the output signals it is re=
ady for data by calling the first linked process. =C2=A0Starting at the out=
put, each process kernel calls the previous until it reaches the input wher=
e the input device/file/etc copies the data to the chains frame buffer. =C2=
=A0Each process then operates on that single buffer in turn until finally r=
eturning to the output, thus altering the buffer instead of moving data fro=
m place to place. =C2=A0I like to think of the processing chain as starting=
 from the output or destination. =C2=A0When the output is ready for data it=
 calls to a linked process for information, it calls to the next link and s=
o on until data begins to get processed. =C2=A0So a bottom up approach, whe=
re the input doesn&#39;t officially start until the output is ready. =C2=A0=
I know it is opposite of the way audio really flows through a system but it=
 makes things easier then moving data like a bucket brigade. =C2=A0It can a=
lso allow easier parallel processing when there are multiple 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 channels/nodes at once so the=
y can all be processed in parallel and mixed together after each of the pro=
cesses end.</div><div><br></div><div><div>Also, I&#39;m not sure the word &=
#39;format&#39; should be used to refer to files. =C2=A0I know people like =
to say &quot;file format&quot; but then, what format is the audio data in t=
hat is in the file format? =C2=A0Its just confusing, so I think &#39;contai=
ner&#39; 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 frame buff=
er. =C2=A0So an audio_format class would contain information on sample rate=
, channels, interleaving, channel routing and other information and a conta=
iner class would deal with files.</div></div><div><br></div><div>I personal=
ly would rather have all audio with greater than 2 or 3 channels processed =
in Ambisonic-B format and then have the audio driver figure out how to extr=
act the channels for each speaker, but I know this won&#39;t fly with every=
one so we would need a class for channel routing information as well.</div>=
<div><br></div><div>All I can think of at the moment..</div><div><br></div>=
<div><div><br></div><div><br>On Friday, June 3, 2016 at 9:08:45 PM UTC-7, a=
lexande...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margi=
n: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><di=
v dir=3D"ltr">I agree, how do you feel about the concept i proposed in my o=
riginal about having std audio stream classes similar to std::fstream. The =
std::astream/iastream/oastream would represent the default audio device on =
the system as determined by some method of polling the system. The user cou=
ld either choose to use them as is or manually select a different device?<b=
r><br>On Friday, June 3, 2016 at 10:51:12 PM UTC-5, Ron wrote:<blockquote c=
lass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #c=
cc solid;padding-left:1ex"><div dir=3D"ltr">Well, it needs to start somewhe=
re.=C2=A0 I think having basic buffers using 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 m=
achine and make them work.=C2=A0 The data processing can build onto it with=
 more complex primitives, templates and classes.=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.<div><br><=
/div></div><div><br><br></div>
</blockquote></div></blockquote></div></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/239cb9ab-c5d5-4ce5-b876-b5220cc1e116%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/239cb9ab-c5d5-4ce5-b876-b5220cc1e116=
%40isocpp.org</a>.<br />

------=_Part_1118_423277400.1465021681318--

------=_Part_1117_268347005.1465021681318--

.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Sat, 04 Jun 2016 11:49:55 +0300
Raw View
This is a multi-part message in MIME format.

--nextPart2864238.F1nnOXfp8K
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8

On Saturday, 4 June 2016 11:43:17 MSK Thiago Macieira wrote:
> On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:
> > What is needed is a standardized interface for these different modules
> > to work with each other. The interface should also allow me, the
> > developer, to work with the media (e.g. create my own audio or image
> > filter or a new codec or a new device driver).
>=20
> That I agree with.
>=20
> But should the standard mandate that there should be at least one? How do=
es
> someone write a plugin to the C++ Standard Library? Will we now mandate t=
his
> kind of ability?
>=20
> If not, then will there be a requirement that the C++ library vendor prov=
ide
> it? If so, please think carefully how Apple should code libc++ to work on
> iOS.

I think there should not be a requirement to provide a single module. But t=
here should=20
be a standard way to enumerate the available devices and codecs. The standa=
rd=20
should allow for implementation to have no hardware audio capability.

--=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/4016799.R5dY8uMgik%40lastique-pc.

--nextPart2864238.F1nnOXfp8K
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-=
html40/strict.dtd">
<html><head><meta name=3D"qrichtext" content=3D"1" /><style type=3D"text/cs=
s">
p, li { white-space: pre-wrap; }
</style></head><body style=3D" font-family:'DejaVu Sans Mono'; font-size:9p=
t; font-weight:400; font-style:normal;">
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Saturday=
, 4 June 2016 11:43:17 MSK Thiago Macieira wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; On s=
=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; W=
hat is needed is a standardized interface for these different modules</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; t=
o work with each other. The interface should also allow me, the</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; d=
eveloper, to work with the media (e.g. create my own audio or image</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; f=
ilter or a new codec or a new device driver).</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; That I=
 agree with.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; But sh=
ould the standard mandate that there should be at least one? How does</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; someon=
e write a plugin to the C++ Standard Library? Will we now mandate this</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; kind o=
f ability?</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; If not=
, then will there be a requirement that the C++ library vendor provide</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; it? If=
 so, please think carefully how Apple should code libc++ to work on</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; iOS.</=
p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">I think the=
re should not be a requirement to provide a single module. But there should=
 be a standard way to enumerate the available devices and codecs. The stand=
ard should allow for implementation to have no hardware audio capability.</=
p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/4016799.R5dY8uMgik%40lastique-pc?utm_=
medium=3Demail&utm_source=3Dfooter">https://groups.google.com/a/isocpp.org/=
d/msgid/std-proposals/4016799.R5dY8uMgik%40lastique-pc</a>.<br />

--nextPart2864238.F1nnOXfp8K--


.


Author: mlal1811@gmail.com
Date: Sat, 4 Jun 2016 07:08:07 -0700 (PDT)
Raw View
------=_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--

.


Author: alexander.zywicki@gmail.com
Date: Sat, 4 Jun 2016 07:12:05 -0700 (PDT)
Raw View
------=_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--

.


Author: alexander.zywicki@gmail.com
Date: Sat, 4 Jun 2016 07:38:53 -0700 (PDT)
Raw View
------=_Part_2907_1713158781.1465051133879
Content-Type: multipart/alternative;
 boundary="----=_Part_2908_1987009820.1465051133880"

------=_Part_2908_1987009820.1465051133880
Content-Type: text/plain; charset=UTF-8

Is this example more agreeable?

//std::audio example 1 "single process"
void example_1(){
    double sample_rate = 44100;
    std::size_t frame_size =2;
    std::size_t buffer_size=128;

    std::audio_context<float> ctx{sample_rate,buffer_size,frame_size};//contruct
from values

    std::astream_process<float> proc(ctx,[](std::frame_buffer<float> const&
input, std::frame_buffer<float>& output){
        for(std::size_t i =0; i <input.size();++i){
            output[i] = input[i] * 1.0;
        }
    });

    proc.start();
    //do other stuff
    proc.stop();
}



On Saturday, June 4, 2016 at 1:28:01 AM UTC-5, Ron wrote:
>
> Some thoughts...
>
> 'N' should be runtime for channels in a frame and for a frame buffer.  The
> buffer size might be negotiable with the device.
>
> I like a lot of that code in the original post, but I don't like the
> comparison to iostreams.  Its really the '>>' operator that I don't like.
>  When you copy into your frame buffer, an '=' operator should be used since
> anyone that sees an '=' operator knows its a copy.  But really, you
> shouldn't need to move data around so much.  If you stream from input to
> 'buff', then process and then move from 'buff' to output then you are
> moving a lot of data unnecessarily.
>
> I think what should happen is this; The process chain is triggered when
> the 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 reaches the input where the input device/file/etc copies the data
> to the chains 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 data 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, where the input doesn't officially start until the
> output is ready.  I know it is opposite of the way audio really flows
> through a system but it makes things easier then moving data like a bucket
> brigade.  It can also allow easier 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 output, the output calls to many
> channels/nodes at once so they can all be processed in parallel and mixed
> together after each of the processes end.
>
> 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
> data in that is in the file format?  Its just confusing, so I think
> 'container' 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, interleaving, channel routing and other information and a
> container class would deal with files.
>
> I personally would rather have all audio with greater than 2 or 3 channels
> 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
> with everyone so we would need a class for channel routing information as
> well.
>
> All I can think of at the moment..
>
>
>
> 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
>> about having std audio stream classes similar to std::fstream. The
>> std::astream/iastream/oastream would represent the default audio device on
>> the system as determined by some method of polling the system. The user
>> could either choose to use them as is or manually select a different device?
>>
>> On Friday, June 3, 2016 at 10:51:12 PM UTC-5, Ron wrote:
>>>
>>> Well, it needs to start somewhere.  I think having basic buffers using
>>> std::array or plain old arrays might do for now and get some basic audio
>>> recording 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 way 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.
>>>
>>>
>>>
>>>

--
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 email 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/134e61f0-6011-47e6-a09f-c03bfecf7303%40isocpp.org.

------=_Part_2908_1987009820.1465051133880
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Is this example more agreeable?<br><br><div class=3D"prett=
yprint" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(18=
7, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word=
;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D=
"color: #800;" class=3D"styled-by-prettify">//std::audio example 1 &quot;si=
ngle process&quot;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> exa=
mple_1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(){<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">dou=
ble</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> sample=
_rate </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #066;" class=3D"styled-by-prettify">44100</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 std</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">size_t frame_size </span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">2</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 std</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">size_t buffer_size</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #06=
6;" class=3D"styled-by-prettify">128</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">audio_context</span><span style=3D"color: #080;" cl=
ass=3D"styled-by-prettify">&lt;float&gt;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> ctx</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">sample_rate</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">buffer_size</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify">f=
rame_size</span><span style=3D"color: #660;" class=3D"styled-by-prettify">}=
;</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//contruc=
t from values</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">astream_process</span><span style=3D"color: #080;" class=3D"style=
d-by-prettify">&lt;float&gt;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> proc</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">ctx</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,[]=
(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">std</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">frame_buffer</span><span=
 style=3D"color: #080;" class=3D"styled-by-prettify">&lt;float&gt;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">const</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> input</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">frame_buffer</span><span style=3D"color: #080;" class=3D"styled-b=
y-prettify">&lt;float&gt;</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> output</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">){</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">for</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">size_t i <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><=
span style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> i </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">input</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">size</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">();++</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>i</span><span style=3D"color: #660;" class=3D"styled-by-prettify">){</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">[</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">i</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">]</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> input</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">i</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">]</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">*</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify=
">1.0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">});</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br><br>=C2=A0 =C2=A0 proc</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">.</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">start</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">();</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-pretti=
fy">//do other stuff</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br>=C2=A0 =C2=A0 proc</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">stop</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">();</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</s=
pan></div></code></div><br><br><br>On Saturday, June 4, 2016 at 1:28:01 AM =
UTC-5, Ron wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"><div>Some thoughts...</div><div><br></div><div>&#39;N&#39; should be ru=
ntime for channels in a frame and for a frame buffer. =C2=A0The buffer size=
 might be negotiable with the device.</div><div><br></div><div>I like a lot=
 of that code in the original post, but I don&#39;t like the comparison to =
iostreams. =C2=A0Its really the &#39;&gt;&gt;&#39; operator that I don&#39;=
t like. =C2=A0When you copy into your frame buffer, an &#39;=3D&#39; operat=
or should be used since anyone that sees an &#39;=3D&#39; operator knows it=
s a copy. =C2=A0But really, you shouldn&#39;t need to move data around so m=
uch. =C2=A0If you stream from input to &#39;buff&#39;, then process and the=
n move from &#39;buff&#39; to output then you are moving a lot of data unne=
cessarily.</div><div><br></div><div>I think what should happen is this; The=
 process chain is triggered when the output signals it is ready for data by=
 calling the first linked process. =C2=A0Starting at the output, each proce=
ss kernel calls the previous until it reaches the input where the input dev=
ice/file/etc copies the data to the chains frame buffer. =C2=A0Each 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 plac=
e. =C2=A0I like to think of the processing chain as starting from the outpu=
t or destination. =C2=A0When the output is ready for data it calls to a lin=
ked process for information, it calls to the next link and so on until data=
 begins to get processed. =C2=A0So a bottom up approach, where the input do=
esn&#39;t officially start until the output is ready. =C2=A0I know it is op=
posite of the way audio really flows through a system but it makes things e=
asier then moving data like a bucket brigade. =C2=A0It can also allow easie=
r parallel processing when there are multiple branches on a node. =C2=A0So =
if you think of an audio mixer, where there are many inputs and a single ou=
tput, the output calls to many channels/nodes at once so they can all be pr=
ocessed in parallel and mixed together after each of the processes end.</di=
v><div><br></div><div><div>Also, I&#39;m not sure the word &#39;format&#39;=
 should be used to refer to files. =C2=A0I know people like to say &quot;fi=
le format&quot; but then, what format is the audio data in that is in the f=
ile format? =C2=A0Its just confusing, so I think &#39;container&#39; is a b=
etter word for files. =C2=A0Then that leaves the word format open for use a=
s a way of describing the data format of an audio frame buffer. =C2=A0So 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.</div></div><div><br></div><div>I personally would rather=
 have all audio with greater than 2 or 3 channels processed in Ambisonic-B =
format and then have the audio driver figure out how to extract the channel=
s for each speaker, but I know this won&#39;t fly with everyone so we would=
 need a class for channel routing information as well.</div><div><br></div>=
<div>All I can think of at the moment..</div><div><br></div><div><div><br><=
/div><div><br>On Friday, June 3, 2016 at 9:08:45 PM UTC-7, <a>alexande...@g=
mail.com</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;marg=
in-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"=
>I agree, how do you feel about the concept i proposed in my original about=
 having std audio stream classes similar to std::fstream. The std::astream/=
iastream/oastream would represent the default audio device on the system as=
 determined by some method of polling the system. The user could either cho=
ose to use them as is or manually select a different device?<br><br>On Frid=
ay, June 3, 2016 at 10:51:12 PM UTC-5, Ron wrote:<blockquote class=3D"gmail=
_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div dir=3D"ltr">Well, it needs to start somewhere.=C2=A0 I t=
hink having basic buffers using std::array or plain old arrays might do for=
 now and get some basic audio recording and playback into C++.=C2=A0 It sho=
uld be as simple as possible to get to the interfaces on the machine and ma=
ke them work.=C2=A0 The data processing can build onto it with more complex=
 primitives, templates and classes.=C2=A0 This way there is at least someth=
ing semi-usable with code we have today while the rest of the building bloc=
ks are being worked on.=C2=A0 Just a thought though.<div><br></div></div><d=
iv><br><br></div>
</blockquote></div></blockquote></div></div></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/134e61f0-6011-47e6-a09f-c03bfecf7303%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/134e61f0-6011-47e6-a09f-c03bfecf7303=
%40isocpp.org</a>.<br />

------=_Part_2908_1987009820.1465051133880--

------=_Part_2907_1713158781.1465051133879--

.


Author: alexander.zywicki@gmail.com
Date: Sat, 4 Jun 2016 07:41:22 -0700 (PDT)
Raw View
------=_Part_2808_997316795.1465051282403
Content-Type: multipart/alternative;
 boundary="----=_Part_2809_1925105233.1465051282404"

------=_Part_2809_1925105233.1465051282404
Content-Type: text/plain; charset=UTF-8

Note that the input must be a const& because in  aparalell context it would
allow multiple processes to read safely, this has the side effect of
disabling the range for syntax unless you do this:

//std::audio example 1 "single process"
void example_1(){
    double sample_rate = 44100;
    std::size_t frame_size =2;
    std::size_t buffer_size=128;

    std::audio_context<float> ctx{sample_rate,buffer_size,frame_size};//contruct
from values

    std::astream_process<float> proc(ctx,[](std::frame_buffer<float> const&
input, std::frame_buffer<float>& output){
        output=intput;//note the copy required
        for(auto&& i: output){
            i*=1.0;
        }
    });

    proc.start();
    //do other stuff
    proc.stop();
}



On Saturday, June 4, 2016 at 9:38:54 AM UTC-5, alexande...@gmail.com wrote:
>
> Is this example more agreeable?
>
> //std::audio example 1 "single process"
> void example_1(){
>     double sample_rate = 44100;
>     std::size_t frame_size =2;
>     std::size_t buffer_size=128;
>
>     std::audio_context<float> ctx{sample_rate,buffer_size,frame_size};//contruct
> from values
>
>     std::astream_process<float> proc(ctx,[](std::frame_buffer<float> const
> & input, std::frame_buffer<float>& output){
>         for(std::size_t i =0; i <input.size();++i){
>             output[i] = input[i] * 1.0;
>         }
>     });
>
>     proc.start();
>     //do other stuff
>     proc.stop();
> }
>
>
>
> On Saturday, June 4, 2016 at 1:28:01 AM UTC-5, Ron wrote:
>>
>> Some thoughts...
>>
>> 'N' should be runtime for channels in a frame and for a frame buffer.
>>  The buffer size might be negotiable with the device.
>>
>> I like a lot of that code in the original post, but I don't like the
>> comparison to iostreams.  Its really the '>>' operator that I don't like.
>>  When you copy into your frame buffer, an '=' operator should be used since
>> anyone that sees an '=' operator knows its a copy.  But really, you
>> shouldn't need to move data around so much.  If you stream from input to
>> 'buff', then process and then move from 'buff' to output then you are
>> moving a lot of data unnecessarily.
>>
>> I think what should happen is this; The process chain is triggered when
>> the 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 reaches the input where the input device/file/etc copies the data
>> to the chains 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 data 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, where the input doesn't officially start until the
>> output is ready.  I know it is opposite of the way audio really flows
>> through a system but it makes things easier then moving data like a bucket
>> brigade.  It can also allow easier 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 output, the output calls to many
>> channels/nodes at once so they can all be processed in parallel and mixed
>> together after each of the processes end.
>>
>> 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
>> data in that is in the file format?  Its just confusing, so I think
>> 'container' 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, interleaving, channel routing and other information and a
>> container class would deal with files.
>>
>> I personally would rather have all audio with greater than 2 or 3
>> channels 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 with everyone so we would need a class for channel routing
>> information as well.
>>
>> All I can think of at the moment..
>>
>>
>>
>> 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
>>> about having std audio stream classes similar to std::fstream. The
>>> std::astream/iastream/oastream would represent the default audio device on
>>> the system as determined by some method of polling the system. The user
>>> could either choose to use them as is or manually select a different device?
>>>
>>> On Friday, June 3, 2016 at 10:51:12 PM UTC-5, Ron wrote:
>>>>
>>>> Well, it needs to start somewhere.  I think having basic buffers using
>>>> std::array or plain old arrays might do for now and get some basic audio
>>>> recording 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 way 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.
>>>>
>>>>
>>>>
>>>>

--
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 email 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/d6c30daa-bab3-454d-899d-2ad906fc55df%40isocpp.org.

------=_Part_2809_1925105233.1465051282404
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Note that the input must be a const&amp; because in=C2=A0 =
aparalell context it would allow multiple processes to read safely, this ha=
s the side effect of disabling the range for syntax unless you do this:<br>=
<br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250=
); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px=
; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #800;" class=3D"styled-by-prettify">//std::a=
udio example 1 &quot;single process&quot;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> example_1</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">(){</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">double</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> sample_rate </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettif=
y">44100</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">size_t f=
rame_size </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #066;" class=3D"styled-by-prettify">2</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 std</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">size_t buffer_size</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><spa=
n style=3D"color: #066;" class=3D"styled-by-prettify">128</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 std</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">audio_context</span><span st=
yle=3D"color: #080;" class=3D"styled-by-prettify">&lt;float&gt;</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> ctx</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">sample_rate</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify">buffer_size</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">frame_size</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">};</span><span style=3D"color: #800;" class=3D"styl=
ed-by-prettify">//contruct from values</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">astream_process</span><span style=3D"col=
or: #080;" class=3D"styled-by-prettify">&lt;float&gt;</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> proc</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify">ctx</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,[](</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">frame_buffer</span><span style=3D"color: #080;" class=3D"styled-by-prett=
ify">&lt;float&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">c=
onst</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> input</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">frame_buffer</span><span style=3D"co=
lor: #080;" class=3D"styled-by-prettify">&lt;float&gt;</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> output</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">){</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">intput</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">//note the copy required</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>for</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> i</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">:</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> output</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">){</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 i<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">*=3D</span>=
<span style=3D"color: #066;" class=3D"styled-by-prettify">1.0</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">});</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=
=A0 proc</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">start</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">();</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </spa=
n><span style=3D"color: #800;" class=3D"styled-by-prettify">//do other stuf=
f</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 proc</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">stop=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">();</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">}</span></div></code></=
div><br><br><br>On Saturday, June 4, 2016 at 9:38:54 AM UTC-5, alexande...@=
gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin=
-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"lt=
r">Is this example more agreeable?<br><br><div style=3D"background-color:rg=
b(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-widt=
h:1px;word-wrap:break-word"><code><div><span style=3D"color:#800">//std::au=
dio example 1 &quot;single process&quot;</span><span style=3D"color:#000"><=
br></span><span style=3D"color:#008">void</span><span style=3D"color:#000">=
 example_1</span><span style=3D"color:#660">(){</span><span style=3D"color:=
#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">double</span><spa=
n style=3D"color:#000"> sample_rate </span><span style=3D"color:#660">=3D</=
span><span style=3D"color:#000"> </span><span style=3D"color:#066">44100</s=
pan><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=3D"col=
or:#000">size_t frame_size </span><span style=3D"color:#660">=3D</span><spa=
n style=3D"color:#066">2</span><span style=3D"color:#660">;</span><span sty=
le=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::=
</span><span style=3D"color:#000">size_t buffer_size</span><span style=3D"c=
olor:#660">=3D</span><span style=3D"color:#066">128</span><span style=3D"co=
lor:#660">;</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</spa=
n><span style=3D"color:#660">::</span><span style=3D"color:#000">audio_cont=
ext</span><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"col=
or:#000"> ctx</span><span style=3D"color:#660">{</span><span style=3D"color=
:#000">sample_rate</span><span style=3D"color:#660">,</span><span style=3D"=
color:#000">buffer_size</span><span style=3D"color:#660">,</span><span styl=
e=3D"color:#000">fr<wbr>ame_size</span><span style=3D"color:#660">};</span>=
<span style=3D"color:#800">//contruct from values</span><span style=3D"colo=
r:#000"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span=
><span style=3D"color:#000">astream_process</span><span style=3D"color:#080=
">&lt;float&gt;</span><span style=3D"color:#000"> proc</span><span style=3D=
"color:#660">(</span><span style=3D"color:#000">ctx</span><span style=3D"co=
lor:#660">,[](</span><span style=3D"color:#000">std</span><span style=3D"co=
lor:#660">::</span><span style=3D"color:#000">frame_buffer</span><span styl=
e=3D"color:#080">&lt;<wbr>float&gt;</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#008">const</span><span style=3D"color:#660">&amp;</=
span><span style=3D"color:#000"> input</span><span style=3D"color:#660">,</=
span><span style=3D"color:#000"> std</span><span style=3D"color:#660">::</s=
pan><span style=3D"color:#000">frame_buffer</span><span style=3D"color:#080=
">&lt;float&gt;</span><span style=3D"color:#660">&amp;</span><span style=3D=
"color:#000"> output</span><span style=3D"color:#660">){</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color=
:#008">for</span><span style=3D"color:#660">(</span><span style=3D"color:#0=
00">std</span><span style=3D"color:#660">::</span><span style=3D"color:#000=
">size_t i </span><span style=3D"color:#660">=3D</span><span style=3D"color=
:#066">0</span><span style=3D"color:#660">;</span><span style=3D"color:#000=
"> i </span><span style=3D"color:#660">&lt;</span><span style=3D"color:#000=
">input</span><span style=3D"color:#660">.</span><span style=3D"color:#000"=
>size</span><span style=3D"color:#660">();++</span><span style=3D"color:#00=
0">i</span><span style=3D"color:#660">){</span><span style=3D"color:#000"><=
br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span style=3D"co=
lor:#660">[</span><span style=3D"color:#000">i</span><span style=3D"color:#=
660">]</span><span style=3D"color:#000"> </span><span style=3D"color:#660">=
=3D</span><span style=3D"color:#000"> input</span><span style=3D"color:#660=
">[</span><span style=3D"color:#000">i</span><span style=3D"color:#660">]</=
span><span style=3D"color:#000"> </span><span style=3D"color:#660">*</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#066">1.0</span><sp=
an style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span style=3D"=
color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">});</span><=
span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 proc</span><span style=3D"c=
olor:#660">.</span><span style=3D"color:#000">start</span><span style=3D"co=
lor:#660">();</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><sp=
an style=3D"color:#800">//do other stuff</span><span style=3D"color:#000"><=
br>=C2=A0 =C2=A0 proc</span><span style=3D"color:#660">.</span><span style=
=3D"color:#000">stop</span><span style=3D"color:#660">();</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#660">}</span></div></code>=
</div><br><br><br>On Saturday, June 4, 2016 at 1:28:01 AM UTC-5, Ron wrote:=
<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Some thoughts=
....</div><div><br></div><div>&#39;N&#39; should be runtime for channels in =
a frame and for a frame buffer. =C2=A0The buffer size might be negotiable w=
ith the device.</div><div><br></div><div>I like a lot of that code in the o=
riginal post, but I don&#39;t like the comparison to iostreams. =C2=A0Its r=
eally the &#39;&gt;&gt;&#39; operator that I don&#39;t like. =C2=A0When you=
 copy into your frame buffer, an &#39;=3D&#39; operator should be used sinc=
e anyone that sees an &#39;=3D&#39; operator knows its a copy. =C2=A0But re=
ally, you shouldn&#39;t need to move data around so much. =C2=A0If you stre=
am from input to &#39;buff&#39;, then process and then move from &#39;buff&=
#39; to output then you are moving a lot of data unnecessarily.</div><div><=
br></div><div>I think what should happen is this; The process chain is trig=
gered when the output signals it is ready for data by calling the first lin=
ked process. =C2=A0Starting at the output, each process kernel calls the pr=
evious until it reaches the input where the input device/file/etc copies th=
e data to the chains frame buffer. =C2=A0Each 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. =C2=A0I like to thi=
nk of the processing chain as starting from the output or destination. =C2=
=A0When the output is ready for data it calls to a linked process for infor=
mation, it calls to the next link and so on until data begins to get proces=
sed. =C2=A0So a bottom up approach, where the input doesn&#39;t officially =
start until the output is ready. =C2=A0I know it is opposite of the way aud=
io really flows through a system but it makes things easier then moving dat=
a like a bucket brigade. =C2=A0It can also allow easier parallel processing=
 when there are multiple branches on a node. =C2=A0So if you think of an au=
dio mixer, where there are many inputs and a single output, the output call=
s to many channels/nodes at once so they can all be processed in parallel a=
nd mixed together after each of the processes end.</div><div><br></div><div=
><div>Also, I&#39;m not sure the word &#39;format&#39; should be used to re=
fer to files. =C2=A0I know people like to say &quot;file format&quot; but t=
hen, what format is the audio data in that is in the file format? =C2=A0Its=
 just confusing, so I think &#39;container&#39; 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 frame buffer. =C2=A0So an audio_format class w=
ould contain information on sample rate, channels, interleaving, channel ro=
uting and other information and a container class would deal with files.</d=
iv></div><div><br></div><div>I personally would rather have all audio with =
greater than 2 or 3 channels processed in Ambisonic-B format and then have =
the audio driver figure out how to extract the channels for each speaker, b=
ut I know this won&#39;t fly with everyone so we would need a class for cha=
nnel routing information as well.</div><div><br></div><div>All I can think =
of at the moment..</div><div><br></div><div><div><br></div><div><br>On Frid=
ay, June 3, 2016 at 9:08:45 PM UTC-7, <a>alexande...@gmail.com</a> wrote:<b=
lockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-=
left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">I agree, how do you =
feel about the concept i proposed in my original about having std audio str=
eam classes similar to std::fstream. The std::astream/iastream/oastream wou=
ld represent the default audio device on the system as determined by some m=
ethod of polling the system. The user could either choose to use them as is=
 or manually select a different device?<br><br>On Friday, June 3, 2016 at 1=
0:51:12 PM UTC-5, Ron wrote:<blockquote class=3D"gmail_quote" style=3D"marg=
in:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div di=
r=3D"ltr">Well, it needs to start somewhere.=C2=A0 I think having basic buf=
fers using std::array or plain old arrays might do for now and get some bas=
ic audio recording and playback into C++.=C2=A0 It should be as simple as p=
ossible to get to the interfaces on the machine and make them work.=C2=A0 T=
he data processing can build onto it with more complex primitives, template=
s and classes.=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 o=
n.=C2=A0 Just a thought though.<div><br></div></div><div><br><br></div>
</blockquote></div></blockquote></div></div></div></blockquote></div></bloc=
kquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d6c30daa-bab3-454d-899d-2ad906fc55df%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d6c30daa-bab3-454d-899d-2ad906fc55df=
%40isocpp.org</a>.<br />

------=_Part_2809_1925105233.1465051282404--

------=_Part_2808_997316795.1465051282403--

.


Author: alexander.zywicki@gmail.com
Date: Sat, 4 Jun 2016 08:00:38 -0700 (PDT)
Raw View
------=_Part_3116_400472017.1465052439035
Content-Type: multipart/alternative;
 boundary="----=_Part_3117_1964918890.1465052439035"

------=_Part_3117_1964918890.1465052439035
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Here is a proposed implementation of the definition of a sample:

#include <type_traits>

//if sample must be signed when integer
template<typename T>
struct is_sample :public std::integral_constant<bool,std::is_floating_point=
<
T>::value || (std::is_integral<T>::value && std::is_signed<T>::value)>{};

//otherwise
template<typename T>
using is_sample =3D std::is_arithmetic<T>;

In order for some type T to be valid as a sample it must pass=20
"is_sample<T>"=20



On Friday, June 3, 2016 at 11:04:21 PM UTC-5, alexande...@gmail.com wrote:
>
> I have drafted up a list of basic definitions about how audio could be=20
> represented based on your comment here. I think if we are to attempt to=
=20
> move forward a consensus must be reached about the fundamental=20
> representation of audio data the library will take.=20
>
> C++ std::audio library
>
> theory and definitions:
>
>     sample:
>     a single sample of audio data.
>     can be represented by a signed integer, float or double.
>     must pass the following test to be a valid sample type:
>         ((std::is_integral<T>::value && std::is_signed<T>::value) ||=20
> std::is_floating_point<T>::value) =3D=3D true
>     or could be constrained by:
>          std::is_arithmetic<T>::value=3D=3Dtrue
>      if unsigned samples are allowed/desired
>
>     frame:
>     a collection of 0-N samples
>     each sample represents an individual channel of audio data
>     indexable as an array
>     (should N be runtime or compile time?)
>
>     buffer:
>     a collection of 0-N frames
>     indexable as an array
>     (should N be runtime or compile time?)
>     ideally maintains a continous piece of memory to house its frames
>
>     device /interface:
>     a device recognized by the system as being capable of reading and=20
> writing audio data
>     can be polled for information regarding the capabilities of the=20
> device/interface
>
>
>     audio callback:
>     a function/lambda/functor registered with the library to be called=20
> once per buffer interval
>
>     sampling rate: the number of samples per second of audio data
>
>     frame interval: the length of a frame in seconds (1.0/sample_rate)
>     buffer interval: the length of a buffer in seconds (frame_interval*=
=20
> buffer_size)
>
> What should be added/removed/edited or clarified?
>
>
> On Friday, June 3, 2016 at 9:11:26 PM UTC-5, Ron wrote:
>>
>> Okay, I've done some thinking here.  The simplest solution should be the=
=20
>> correct one.  I think the standard should stick to something very basic=
=20
>> here, otherwise we get into an area that is too complicated to implement=
.. =20
>> All we should have in terms of a standard audio interface for C++ is:
>>
>> 1) A method for enumerating the interfaces on a machine.
>> 2) A method for getting each interfaces capabilities (supported rates,=
=20
>> bit depths etc.).
>> 3) A method for activating a requested device for sending and receiving=
=20
>> frames in the requested format.
>>
>> Valid types for audio samples should be either a signed integer, a float=
=20
>> or a double.  And that's pretty much it.  Get audio input, put audio=20
>> output.  Anything other than that would be a different proposal all=20
>> together.  Audio, video or DSP processing in general should certainly be=
 a=20
>> different proposal.
>>
>> But I would propose we also add an int24_t class into the standard for=
=20
>> processing 24-bit samples.  Something as simple as this would suffice fo=
r=20
>> now:
>> class int24_t
>> {
>> private:
>>     int8_t val[3];
>> };
>>
>> Something more fully featured would be desirable, like this:=20
>> https://github.com/RonNovy/CppDSP/blob/master/src/int24_t.h
>> But I guess that, would be another proposal.
>>
>> On Fri, Jun 3, 2016 at 6:47 PM, <alexande...@gmail.com> wrote:
>>
>>> On Friday, June 3, 2016 at 8:30:49 PM UTC-5, Jeffrey Yasskin wrote:
>>> > On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira <thi...@macieira.org>=
=20
>>> wrote:
>>> > On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote=
:
>>> >
>>> > > What is needed is a standardized interface for these different=20
>>> modules
>>> >
>>> > > to work with each other. The interface should also allow me, the
>>> >
>>> > > developer, to work with the media (e.g. create my own audio or imag=
e
>>> >
>>> > > filter or a new codec or a new device driver).
>>> >
>>> >
>>> >
>>> > That I agree with.
>>> >
>>> >
>>> >
>>> > But should the standard mandate that there should be at least one? Ho=
w=20
>>> does
>>> >
>>> > someone write a plugin to the C++ Standard Library? Will we now=20
>>> mandate this
>>> >
>>> > kind of ability?
>>> >
>>> >
>>> >
>>> > Yes. We already do this with things like the random engines.
>>> >
>>> >
>>> > If not, then will there be a requirement that the C++ library vendor=
=20
>>> provide
>>> >
>>> > it? If so, please think carefully how Apple should code libc++ to wor=
k=20
>>> on iOS.
>>> >
>>> >
>>> >
>>> > WebCrypto has an example of navigating a legal minefield for=20
>>> implementers.
>>> >
>>> >
>>> >
>>> > Also remember to leave the legal speculation to lawyers. It's good to=
=20
>>> have the heads-up that "hey lawyers should look at this", but anything =
more=20
>>> is unwise.
>>> >
>>> >
>>> > Again, I think this is not material for the C++ Standard Library.
>>> >
>>> >
>>> > I think it's a great area for the C++ library to expand into. I'm=20
>>> definitely worried about the expertise of the people writing the propos=
al=20
>>> (e.g. if I proposed an audio library for C++, I should be laughed off t=
he=20
>>> stage), but we can overcome that by asking well-known audio users for t=
heir=20
>>> opinions before standardizing the proposal.
>>> >
>>> >
>>> > Jeffrey
>>>
>>> I agree about the issue of expertise. By no means would I call myself a=
n=20
>>> expert, but I have a degree in audio engineering and a pretty solid gra=
sp=20
>>> of the c++ language. Are there people out there more skilled than me at=
=20
>>> each topic? Of course, but that's why I am here, to get the opinions of=
=20
>>> those people if I can an figure out what needs to be done to make this=
=20
>>> library a reality.
>>>
>>> --
>>> You received this message because you are subscribed to the Google=20
>>> Groups "ISO C++ Standard - Future Proposals" group.
>>> To unsubscribe from this group and stop receiving emails from it, send=
=20
>>> an email to std-proposal...@isocpp.org.
>>> To post to this group, send email to std-pr...@isocpp.org.
>>> To view this discussion on the web visit=20
>>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/62b7649a-5=
de5-4330-9bac-708375d36e2c%40isocpp.org
>>> .
>>>
>>
>>

--=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/be182e27-7bbe-485c-88e0-4244838005ee%40isocpp.or=
g.

------=_Part_3117_1964918890.1465052439035
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Here is a proposed implementation of the definition of a s=
ample:<br><br><div class=3D"prettyprint" style=3D"background-color: rgb(250=
, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-=
width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #800;" class=3D"styled-by-prettif=
y">#include</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">&lt;type=
_traits&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br><br></span><span style=3D"color: #800;" class=3D"styled-by-prettify">/=
/if sample must be signed when integer</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">template</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">typename</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">stru=
ct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> is_samp=
le </span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">public</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">integral_constant</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">bool</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">std</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">is_floating_point</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify">T</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">&gt;::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
value </span><span style=3D"color: #660;" class=3D"styled-by-prettify">||</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">std</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">is_integral</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">T</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">&gt;::</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify">value </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">is_s=
igned</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">T</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">&gt;::</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">value</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">)&gt;{};</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//otherwise</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">template</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">typename</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">using</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> is_sample </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">is_arithmetic=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">T</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">&gt;;</span></div></code>=
</div><br>In order for some type T to be valid as a sample it must pass &qu=
ot;is_sample&lt;T&gt;&quot; <br><br><br><br>On Friday, June 3, 2016 at 11:0=
4:21 PM UTC-5, alexande...@gmail.com wrote:<blockquote class=3D"gmail_quote=
" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding=
-left: 1ex;"><div dir=3D"ltr">I have drafted up a list of basic definitions=
 about how audio could be represented based on your comment here. I think i=
f we are to attempt to move forward a consensus must be reached about the f=
undamental representation of audio data the library will take. <br><br><div=
 style=3D"text-align:center">C++ std::audio library<br><br>theory and defin=
itions:<br><br>=C2=A0=C2=A0=C2=A0 sample:<br>=C2=A0=C2=A0=C2=A0 a single sa=
mple of audio data.<br>=C2=A0=C2=A0=C2=A0 can be represented by a signed in=
teger, float or double.<br>=C2=A0=C2=A0=C2=A0 must pass the following test =
to be a valid sample type:<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((=
std::is_integral&lt;T&gt;::value &amp;&amp; std::is_signed&lt;T&gt;::value)=
 || std::is_floating_point&lt;T&gt;::<wbr>value) =3D=3D true<br>=C2=A0=C2=
=A0=C2=A0 or could be constrained by:<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 std::is_arithmetic&lt;T&gt;::value=3D=3D<wbr>true<br>=C2=A0=
=C2=A0=C2=A0=C2=A0 if unsigned samples are allowed/desired<br><br>=C2=A0=C2=
=A0=C2=A0 frame:<br>=C2=A0=C2=A0=C2=A0 a collection of 0-N samples<br>=C2=
=A0=C2=A0=C2=A0 each sample represents an individual channel of audio data<=
br>=C2=A0=C2=A0=C2=A0 indexable as an array<br>=C2=A0=C2=A0=C2=A0 (should N=
 be runtime or compile time?)<br><br>=C2=A0=C2=A0=C2=A0 buffer:<br>=C2=A0=
=C2=A0=C2=A0 a collection of 0-N frames<br>=C2=A0=C2=A0=C2=A0 indexable as =
an array<br>=C2=A0=C2=A0=C2=A0 (should N be runtime or compile time?)<br>=
=C2=A0=C2=A0=C2=A0 ideally maintains a continous piece of memory to house i=
ts frames<br><br>=C2=A0=C2=A0=C2=A0 device /interface:<br>=C2=A0=C2=A0=C2=
=A0 a device recognized by the system as being capable of reading and writi=
ng audio data<br>=C2=A0=C2=A0=C2=A0 can be polled for information regarding=
 the capabilities of the device/interface<br><br><br>=C2=A0=C2=A0=C2=A0 aud=
io callback:<br>=C2=A0=C2=A0=C2=A0 a function/lambda/functor registered wit=
h the library to be called once per buffer interval<br><br>=C2=A0=C2=A0=C2=
=A0 sampling rate: the number of samples per second of audio data<br><br>=
=C2=A0=C2=A0=C2=A0 frame interval: the length of a frame in seconds (1.0/sa=
mple_rate)<br>=C2=A0=C2=A0=C2=A0 buffer interval: the length of a buffer in=
 seconds (frame_interval* buffer_size)<br><br><div style=3D"text-align:left=
">What should be added/removed/edited or clarified?<br></div></div><br><br>=
On Friday, June 3, 2016 at 9:11:26 PM UTC-5, Ron wrote:<blockquote class=3D=
"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc soli=
d;padding-left:1ex"><div dir=3D"ltr"><div>Okay, I&#39;ve done some thinking=
 here.=C2=A0 The simplest solution should be the correct one.=C2=A0 I think=
 the standard should stick to something very basic here, otherwise we get i=
nto an area that is too complicated to implement.=C2=A0 All we should have =
in terms of a standard audio interface for C++ is:</div><div><br></div><div=
>1) A method for enumerating the interfaces on a machine.</div><div>2) A me=
thod for getting each interfaces capabilities (supported rates, bit depths =
etc.).</div><div>3) A method for activating a requested device for sending =
and receiving frames in the requested format.</div><div><br></div><div>Vali=
d types for audio samples should be either a signed integer, a float or a d=
ouble.=C2=A0 And that&#39;s pretty much it.=C2=A0 Get audio input, put audi=
o output.=C2=A0 Anything other than that would be a different proposal all =
together.=C2=A0 Audio, video or DSP processing in general should certainly =
be a different proposal.</div><div><br></div><div>But I would propose we al=
so add an int24_t class into the standard for processing 24-bit samples.=C2=
=A0 Something as simple as this would suffice for now:</div><div>class int2=
4_t</div><div>{</div><div>private:</div><div>=C2=A0 =C2=A0 int8_t val[3];</=
div><div>};</div><div><br></div><div>Something more fully featured would be=
 desirable, like this: <a href=3D"https://github.com/RonNovy/CppDSP/blob/ma=
ster/src/int24_t.h" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this.=
href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FRonN=
ovy%2FCppDSP%2Fblob%2Fmaster%2Fsrc%2Fint24_t.h\x26sa\x3dD\x26sntz\x3d1\x26u=
sg\x3dAFQjCNH43AqVQTU-hwL7G8EiOcSTbZPweA&#39;;return true;" onclick=3D"this=
..href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FRon=
Novy%2FCppDSP%2Fblob%2Fmaster%2Fsrc%2Fint24_t.h\x26sa\x3dD\x26sntz\x3d1\x26=
usg\x3dAFQjCNH43AqVQTU-hwL7G8EiOcSTbZPweA&#39;;return true;">https://github=
..com/RonNovy/<wbr>CppDSP/blob/master/src/int24_<wbr>t.h</a></div><div>But I=
 guess that, would be another proposal.</div></div><div><br><div class=3D"g=
mail_quote">On Fri, Jun 3, 2016 at 6:47 PM,  <span dir=3D"ltr">&lt;<a rel=
=3D"nofollow">alexande...@gmail.com</a>&gt;</span> wrote:<br><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;p=
adding-left:1ex">On Friday, June 3, 2016 at 8:30:49 PM UTC-5, Jeffrey Yassk=
in wrote:<br>
<span>&gt; On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira &lt;<a>thi...@ma=
cieira.org</a>&gt; wrote:<br>
&gt; On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:=
<br>
&gt;<br>
&gt; &gt; What is needed is a standardized interface for these different mo=
dules<br>
&gt;<br>
&gt; &gt; to work with each other. The interface should also allow me, the<=
br>
&gt;<br>
&gt; &gt; developer, to work with the media (e.g. create my own audio or im=
age<br>
&gt;<br>
&gt; &gt; filter or a new codec or a new device driver).<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; That I agree with.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; But should the standard mandate that there should be at least one? How=
 does<br>
&gt;<br>
&gt; someone write a plugin to the C++ Standard Library? Will we now mandat=
e this<br>
&gt;<br>
&gt; kind of ability?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Yes. We already do this with things like the random engines.<br>
&gt;<br>
&gt;<br>
&gt; If not, then will there be a requirement that the C++ library vendor p=
rovide<br>
&gt;<br>
&gt; it? If so, please think carefully how Apple should code libc++ to work=
 on iOS.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; WebCrypto has an example of=C2=A0navigating a legal minefield for impl=
ementers.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Also remember to leave the legal speculation to lawyers. It&#39;s good=
 to have the heads-up that &quot;hey lawyers should look at this&quot;, but=
 anything more is unwise.<br>
&gt;<br>
&gt;<br>
&gt; Again, I think this is not material for the C++ Standard Library.<br>
&gt;<br>
&gt;<br>
&gt; I think it&#39;s a great area for the C++ library to expand into. I&#3=
9;m definitely worried about the expertise of the people writing the propos=
al (e.g. if I proposed an audio library for C++, I should be laughed off th=
e stage), but we can overcome that by asking well-known audio users for the=
ir opinions before standardizing the proposal.<br>
&gt;<br>
&gt;<br>
&gt; Jeffrey<br>
<br>
</span>I agree about the issue of expertise. By no means would I call mysel=
f an expert, but I have a degree in audio engineering and a pretty solid gr=
asp of the c++ language. Are there people out there more skilled than me at=
 each topic? Of course, but that&#39;s why I am here, to get the opinions o=
f those people if I can an figure out what needs to be done to make this li=
brary a reality.<br>
<span><br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a rel=3D"nofollow">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow">std-pr...@isocpp.o=
rg</a>.<br>
</span>To view this discussion on the web visit <a href=3D"https://groups.g=
oogle.com/a/isocpp.org/d/msgid/std-proposals/62b7649a-5de5-4330-9bac-708375=
d36e2c%40isocpp.org" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this=
..href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/6=
2b7649a-5de5-4330-9bac-708375d36e2c%40isocpp.org&#39;;return true;" onclick=
=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/std-pro=
posals/62b7649a-5de5-4330-9bac-708375d36e2c%40isocpp.org&#39;;return true;"=
>https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/62b=
7649a-5de5-4330-<wbr>9bac-708375d36e2c%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></div>
</blockquote></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/be182e27-7bbe-485c-88e0-4244838005ee%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/be182e27-7bbe-485c-88e0-4244838005ee=
%40isocpp.org</a>.<br />

------=_Part_3117_1964918890.1465052439035--

------=_Part_3116_400472017.1465052439035--

.


Author: alexander.zywicki@gmail.com
Date: Sat, 4 Jun 2016 08:01:53 -0700 (PDT)
Raw View
------=_Part_337_1705757657.1465052514079
Content-Type: multipart/alternative;
 boundary="----=_Part_338_1396042668.1465052514079"

------=_Part_338_1396042668.1465052514079
Content-Type: text/plain; charset=UTF-8

 Here is a proposed implementation of the definition of a sample:

#include <type_traits>

//if sample must be signed when integer
template<typename T>
struct is_sample :public std::integral_constant<bool,std::is_floating_point<
T>::value || (std::is_integral<T>::value && std::is_signed<T>::value)>{};

//otherwise
template<typename T>
using is_sample = std::is_arithmetic<T>;

In order for some type T to be valid as a sample it must pass
"is_sample<T>"



--
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 email 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/aa7736b2-9a2a-4b52-84ee-790e8548572f%40isocpp.org.

------=_Part_338_1396042668.1465052514079
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span class=3D"IVILX2C-tb-q"><span></span> </span>      <d=
iv class=3D"IVILX2C-tb-P" tabindex=3D"0"><input style=3D"opacity: 0; height=
: 1px; width: 1px; z-index: -1; overflow: hidden; position: absolute;" role=
=3D"presentation" tabindex=3D"-1" type=3D"text"><div><div style=3D"overflow=
: auto"><div style=3D"max-height: 10000px;"><div dir=3D"ltr">Here is a prop=
osed implementation of the definition of a sample:<br><br><div style=3D"bac=
kground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:s=
olid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color=
:#800">#include</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#080">&lt;type_traits&gt;</span><span style=3D"color:#000"><br><br></spa=
n><span style=3D"color:#800">//if sample must be signed when integer</span>=
<span style=3D"color:#000"><br></span><span style=3D"color:#008">template</=
span><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">typen=
ame</span><span style=3D"color:#000"> T</span><span style=3D"color:#660">&g=
t;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">s=
truct</span><span style=3D"color:#000"> is_sample </span><span style=3D"col=
or:#660">:</span><span style=3D"color:#008">public</span><span style=3D"col=
or:#000"> std</span><span style=3D"color:#660">::</span><span style=3D"colo=
r:#000">integral_constant</span><span style=3D"color:#660">&lt;</span><span=
 style=3D"color:#008">bool</span><span style=3D"color:#660">,</span><span s=
tyle=3D"color:#000">st<wbr>d</span><span style=3D"color:#660">::</span><spa=
n style=3D"color:#000">is_floating_point</span><span style=3D"color:#660">&=
lt;</span><span style=3D"color:#000">T</span><span style=3D"color:#660">&gt=
;::</span><span style=3D"color:#000">value </span><span style=3D"color:#660=
">||</span><span style=3D"color:#000"> </span><span style=3D"color:#660">(<=
/span><span style=3D"color:#000">std</span><span style=3D"color:#660">::</s=
pan><span style=3D"color:#000">is_integral</span><span style=3D"color:#660"=
>&lt;</span><span style=3D"color:#000">T</span><span style=3D"color:#660">&=
gt;::</span><span style=3D"color:#000">value </span><span style=3D"color:#6=
60">&amp;&amp;</span><span style=3D"color:#000"> std</span><span style=3D"c=
olor:#660">::</span><span style=3D"color:#000">is_signed</span><span style=
=3D"color:#660">&lt;</span><span style=3D"color:#000">T</span><span style=
=3D"color:#660">&gt;::</span><span style=3D"color:#000">value</span><span s=
tyle=3D"color:#660">)&gt;{};</span><span style=3D"color:#000"><br><br></spa=
n><span style=3D"color:#800">//otherwise</span><span style=3D"color:#000"><=
br></span><span style=3D"color:#008">template</span><span style=3D"color:#6=
60">&lt;</span><span style=3D"color:#008">typename</span><span style=3D"col=
or:#000"> T</span><span style=3D"color:#660">&gt;</span><span style=3D"colo=
r:#000"><br></span><span style=3D"color:#008">using</span><span style=3D"co=
lor:#000"> is_sample </span><span style=3D"color:#660">=3D</span><span styl=
e=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span style=
=3D"color:#000">is_arithmetic</span><span style=3D"color:#660">&lt;</span><=
span style=3D"color:#000">T</span><span style=3D"color:#660">&gt;;</span></=
div></code></div><br>In order for some type T to be valid as a sample it mu=
st pass &quot;is_sample&lt;T&gt;&quot; </div></div></div></div></div><br><b=
r><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/aa7736b2-9a2a-4b52-84ee-790e8548572f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/aa7736b2-9a2a-4b52-84ee-790e8548572f=
%40isocpp.org</a>.<br />

------=_Part_338_1396042668.1465052514079--

------=_Part_337_1705757657.1465052514079--

.


Author: Tony V E <tvaneerd@gmail.com>
Date: Sat, 04 Jun 2016 12:15:27 -0400
Raw View
<html><head></head><body lang=3D"en-US" style=3D"background-color: rgb(255,=
 255, 255); line-height: initial;">                                        =
                                              <div style=3D"width: 100%; fo=
nt-size: initial; font-family: Calibri, 'Slate Pro', sans-serif, sans-serif=
; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, =
255, 255);">But most of the time you don't want to copy the data.&nbsp;</di=
v><div style=3D"width: 100%; font-size: initial; font-family: Calibri, 'Sla=
te Pro', sans-serif, sans-serif; color: rgb(31, 73, 125); text-align: initi=
al; background-color: rgb(255, 255, 255);"><br></div><div style=3D"width: 1=
00%; font-size: initial; font-family: Calibri, 'Slate Pro', sans-serif, san=
s-serif; color: rgb(31, 73, 125); text-align: initial; background-color: rg=
b(255, 255, 255);">Whenever possible you want to process in place. </div>  =
                                                                           =
                                                        <div style=3D"width=
: 100%; font-size: initial; font-family: Calibri, 'Slate Pro', sans-serif, =
sans-serif; color: rgb(31, 73, 125); text-align: initial; background-color:=
 rgb(255, 255, 255);"><br style=3D"display:initial"></div>                 =
                                                                           =
                                                                           =
                            <div style=3D"font-size: initial; font-family: =
Calibri, 'Slate Pro', sans-serif, sans-serif; color: rgb(31, 73, 125); text=
-align: initial; background-color: rgb(255, 255, 255);">Sent&nbsp;from&nbsp=
;my&nbsp;BlackBerry&nbsp;portable&nbsp;Babbage&nbsp;Device</div>           =
                                                                           =
                                                                           =
                 <table width=3D"100%" style=3D"background-color:white;bord=
er-spacing:0px;"> <tbody><tr><td colspan=3D"2" style=3D"font-size: initial;=
 text-align: initial; background-color: rgb(255, 255, 255);">              =
             <div style=3D"border-style: solid none none; border-top-color:=
 rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in; font-fami=
ly: Tahoma, 'BB Alpha Sans', 'Slate Pro'; font-size: 10pt;">  <div><b>From:=
 </b>alexander.zywicki@gmail.com</div><div><b>Sent: </b>Saturday, June 4, 2=
016 10:41 AM</div><div><b>To: </b>ISO C++ Standard - Future Proposals</div>=
<div><b>Reply To: </b>std-proposals@isocpp.org</div><div><b>Cc: </b>alexand=
er.zywicki@gmail.com</div><div><b>Subject: </b>Re: [std-proposals] Any inte=
rest to adding audio support to the std library?</div></div></td></tr></tbo=
dy></table><div style=3D"border-style: solid none none; border-top-color: r=
gb(186, 188, 209); border-top-width: 1pt; font-size: initial; text-align: i=
nitial; background-color: rgb(255, 255, 255);"></div><br><div id=3D"_origin=
alContent" style=3D""><div dir=3D"ltr">Note that the input must be a const&=
amp; because in&nbsp; aparalell context it would allow multiple processes t=
o read safely, this has the side effect of disabling the range for syntax u=
nless you do this:<br><br><div class=3D"prettyprint" style=3D"background-co=
lor: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: so=
lid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"=
><div class=3D"subprettyprint"><span style=3D"color: #800;" class=3D"styled=
-by-prettify">//std::audio example 1 "single process"</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color:=
 #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> example_1</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">(){</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">double</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> sample_rate </span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">44100</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>&nbsp; &nbsp; std</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">size_t frame_size </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">=3D</span><span style=3D"color: #066;" class=3D"styled-by-prett=
ify">2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &n=
bsp; std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">size_t buf=
fer_size</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #066;" class=3D"styled-by-prettify">128</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; s=
td</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">audio_context</s=
pan><span style=3D"color: #080;" class=3D"styled-by-prettify">&lt;float&gt;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ctx</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">sample_rate</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">buffer_size</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">frame_size</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">};</span><span style=3D"color: #800;" cla=
ss=3D"styled-by-prettify">//contruct from values</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; std</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">astream_process</span><span =
style=3D"color: #080;" class=3D"styled-by-prettify">&lt;float&gt;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> proc</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">ctx</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">,[](</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">std</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify">frame_buffer</span><span style=3D"color: #080;" class=3D"style=
d-by-prettify">&lt;float&gt;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">const</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
input</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">frame_buffer</span><span sty=
le=3D"color: #080;" class=3D"styled-by-prettify">&lt;float&gt;</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> output</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">){</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; output<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify">intput</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D=
"color: #800;" class=3D"styled-by-prettify">//note the copy required</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp;=
 &nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">for</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(<=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> i</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">:</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> output</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">){</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
 i</span><span style=3D"color: #660;" class=3D"styled-by-prettify">*=3D</sp=
an><span style=3D"color: #066;" class=3D"styled-by-prettify">1.0</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nb=
sp; </span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbs=
p; </span><span style=3D"color: #660;" class=3D"styled-by-prettify">});</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nbsp;=
 &nbsp; proc</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">start</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">();</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; <=
/span><span style=3D"color: #800;" class=3D"styled-by-prettify">//do other =
stuff</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&=
nbsp; &nbsp; proc</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">st=
op</span><span style=3D"color: #660;" class=3D"styled-by-prettify">();</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">}</span></div></code>=
</div><br><br><br>On Saturday, June 4, 2016 at 9:38:54 AM UTC-5, alexande..=
..@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
ltr">Is this example more agreeable?<br><br><div style=3D"background-color:=
rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-wi=
dth:1px;word-wrap:break-word"><code><div><span style=3D"color:#800">//std::=
audio example 1 "single process"</span><span style=3D"color:#000"><br></spa=
n><span style=3D"color:#008">void</span><span style=3D"color:#000"> example=
_1</span><span style=3D"color:#660">(){</span><span style=3D"color:#000"><b=
r>&nbsp; &nbsp; </span><span style=3D"color:#008">double</span><span style=
=3D"color:#000"> sample_rate </span><span style=3D"color:#660">=3D</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#066">44100</span><sp=
an style=3D"color:#660">;</span><span style=3D"color:#000"><br>&nbsp; &nbsp=
; std</span><span style=3D"color:#660">::</span><span style=3D"color:#000">=
size_t frame_size </span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#066">2</span><span style=3D"color:#660">;</span><span style=3D"c=
olor:#000"><br>&nbsp; &nbsp; std</span><span style=3D"color:#660">::</span>=
<span style=3D"color:#000">size_t buffer_size</span><span style=3D"color:#6=
60">=3D</span><span style=3D"color:#066">128</span><span style=3D"color:#66=
0">;</span><span style=3D"color:#000"><br><br>&nbsp; &nbsp; std</span><span=
 style=3D"color:#660">::</span><span style=3D"color:#000">audio_context</sp=
an><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#000=
"> ctx</span><span style=3D"color:#660">{</span><span style=3D"color:#000">=
sample_rate</span><span style=3D"color:#660">,</span><span style=3D"color:#=
000">buffer_size</span><span style=3D"color:#660">,</span><span style=3D"co=
lor:#000">fr<wbr>ame_size</span><span style=3D"color:#660">};</span><span s=
tyle=3D"color:#800">//contruct from values</span><span style=3D"color:#000"=
><br><br>&nbsp; &nbsp; std</span><span style=3D"color:#660">::</span><span =
style=3D"color:#000">astream_process</span><span style=3D"color:#080">&lt;f=
loat&gt;</span><span style=3D"color:#000"> proc</span><span style=3D"color:=
#660">(</span><span style=3D"color:#000">ctx</span><span style=3D"color:#66=
0">,[](</span><span style=3D"color:#000">std</span><span style=3D"color:#66=
0">::</span><span style=3D"color:#000">frame_buffer</span><span style=3D"co=
lor:#080">&lt;<wbr>float&gt;</span><span style=3D"color:#000"> </span><span=
 style=3D"color:#008">const</span><span style=3D"color:#660">&amp;</span><s=
pan style=3D"color:#000"> input</span><span style=3D"color:#660">,</span><s=
pan style=3D"color:#000"> std</span><span style=3D"color:#660">::</span><sp=
an style=3D"color:#000">frame_buffer</span><span style=3D"color:#080">&lt;f=
loat&gt;</span><span style=3D"color:#660">&amp;</span><span style=3D"color:=
#000"> output</span><span style=3D"color:#660">){</span><span style=3D"colo=
r:#000"><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"color:#008">f=
or</span><span style=3D"color:#660">(</span><span style=3D"color:#000">std<=
/span><span style=3D"color:#660">::</span><span style=3D"color:#000">size_t=
 i </span><span style=3D"color:#660">=3D</span><span style=3D"color:#066">0=
</span><span style=3D"color:#660">;</span><span style=3D"color:#000"> i </s=
pan><span style=3D"color:#660">&lt;</span><span style=3D"color:#000">input<=
/span><span style=3D"color:#660">.</span><span style=3D"color:#000">size</s=
pan><span style=3D"color:#660">();++</span><span style=3D"color:#000">i</sp=
an><span style=3D"color:#660">){</span><span style=3D"color:#000"><br>&nbsp=
; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output</span><span style=3D"color:#660=
">[</span><span style=3D"color:#000">i</span><span style=3D"color:#660">]</=
span><span style=3D"color:#000"> </span><span style=3D"color:#660">=3D</spa=
n><span style=3D"color:#000"> input</span><span style=3D"color:#660">[</spa=
n><span style=3D"color:#000">i</span><span style=3D"color:#660">]</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#660">*</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#066">1.0</span><span style=
=3D"color:#660">;</span><span style=3D"color:#000"><br>&nbsp; &nbsp; &nbsp;=
 &nbsp; </span><span style=3D"color:#660">}</span><span style=3D"color:#000=
"><br>&nbsp; &nbsp; </span><span style=3D"color:#660">});</span><span style=
=3D"color:#000"><br><br>&nbsp; &nbsp; proc</span><span style=3D"color:#660"=
>.</span><span style=3D"color:#000">start</span><span style=3D"color:#660">=
();</span><span style=3D"color:#000"><br>&nbsp; &nbsp; </span><span style=
=3D"color:#800">//do other stuff</span><span style=3D"color:#000"><br>&nbsp=
; &nbsp; proc</span><span style=3D"color:#660">.</span><span style=3D"color=
:#000">stop</span><span style=3D"color:#660">();</span><span style=3D"color=
:#000"><br></span><span style=3D"color:#660">}</span></div></code></div><br=
><br><br>On Saturday, June 4, 2016 at 1:28:01 AM UTC-5, Ron wrote:<blockquo=
te class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Some thoughts...</div>=
<div><br></div><div>'N' should be runtime for channels in a frame and for a=
 frame buffer. &nbsp;The buffer size might be negotiable with the device.</=
div><div><br></div><div>I like a lot of that code in the original post, but=
 I don't like the comparison to iostreams. &nbsp;Its really the '&gt;&gt;' =
operator that I don't like. &nbsp;When you copy into your frame buffer, an =
'=3D' operator should be used since anyone that sees an '=3D' operator know=
s its a copy. &nbsp;But really, you shouldn't need to move data around so m=
uch. &nbsp;If you stream from input to 'buff', then process and then move f=
rom 'buff' to output then you are moving a lot of data unnecessarily.</div>=
<div><br></div><div>I think what should happen is this; The process chain i=
s triggered when the output signals it is ready for data by calling the fir=
st linked process. &nbsp;Starting at the output, each process kernel calls =
the previous until it reaches the input where the input device/file/etc cop=
ies the data to the chains frame buffer. &nbsp;Each process then operates o=
n that single buffer in turn until finally returning to the output, thus al=
tering the buffer instead of moving data from place to place. &nbsp;I like =
to think of the processing chain as starting from the output or destination=
.. &nbsp;When the output is ready for data it calls to a linked process for =
information, it calls to the next link and so on until data begins to get p=
rocessed. &nbsp;So a bottom up approach, where the input doesn't officially=
 start until the output is ready. &nbsp;I know it is opposite of the way au=
dio really flows through a system but it makes things easier then moving da=
ta like a bucket brigade. &nbsp;It can also allow easier parallel processin=
g when there are multiple branches on a node. &nbsp;So if you think of an a=
udio mixer, where there are many inputs and a single output, the output cal=
ls to many channels/nodes at once so they can all be processed in parallel =
and mixed together after each of the processes end.</div><div><br></div><di=
v><div>Also, I'm not sure the word 'format' should be used to refer to file=
s. &nbsp;I know people like to say "file format" but then, what format is t=
he audio data in that is in the file format? &nbsp;Its just confusing, so I=
 think 'container' is a better word for files. &nbsp;Then that leaves the w=
ord format open for use as a way of describing the data format of an audio =
frame buffer. &nbsp;So an audio_format class would contain information on s=
ample rate, channels, interleaving, channel routing and other information a=
nd a container class would deal with files.</div></div><div><br></div><div>=
I personally would rather have all audio with greater than 2 or 3 channels =
processed in Ambisonic-B format and then have the audio driver figure out h=
ow to extract the channels for each speaker, but I know this won't fly with=
 everyone so we would need a class for channel routing information as well.=
</div><div><br></div><div>All I can think of at the moment..</div><div><br>=
</div><div><div><br></div><div><br>On Friday, June 3, 2016 at 9:08:45 PM UT=
C-7, <a>alexande...@gmail.com</a> wrote:<blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:=
1ex"><div dir=3D"ltr">I agree, how do you feel about the concept i proposed=
 in my original about having std audio stream classes similar to std::fstre=
am. The std::astream/iastream/oastream would represent the default audio de=
vice on the system as determined by some method of polling the system. The =
user could either choose to use them as is or manually select a different d=
evice?<br><br>On Friday, June 3, 2016 at 10:51:12 PM UTC-5, Ron wrote:<bloc=
kquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Well, it needs to start=
 somewhere.&nbsp; I think having basic buffers using std::array or plain ol=
d arrays might do for now and get some basic audio recording and playback i=
nto C++.&nbsp; It should be as simple as possible to get to the interfaces =
on the machine and make them work.&nbsp; The data processing can build onto=
 it with more complex primitives, templates and classes.&nbsp; This way the=
re is at least something semi-usable with code we have today while the rest=
 of the building blocks are being worked on.&nbsp; Just a thought though.<d=
iv><br></div></div><div><br><br></div>
</blockquote></div></blockquote></div></div></div></blockquote></div></bloc=
kquote></div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d6c30daa-bab3-454d-899d-2ad906fc55df%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter">https://groups.goo=
gle.com/a/isocpp.org/d/msgid/std-proposals/d6c30daa-bab3-454d-899d-2ad906fc=
55df%40isocpp.org</a>.<br>
<br><!--end of _originalContent --></div></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/20160604161527.4915281.1654.11659%40g=
mail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/20160604161527.4915281.1654.11659%40gmai=
l.com</a>.<br />

.


Author: alexander.zywicki@gmail.com
Date: Sat, 4 Jun 2016 09:39:49 -0700 (PDT)
Raw View
------=_Part_3103_99253408.1465058390095
Content-Type: multipart/alternative;
 boundary="----=_Part_3104_990868243.1465058390095"

------=_Part_3104_990868243.1465058390095
Content-Type: text/plain; charset=UTF-8

I agree that in place processing is desired, but an issue comes up when you
need to preserve that data for some other process to use as well, you would
either have to copy before hand and pass a copy to each process or make the
buffer a const& and force you to copy it and work in place on the output
buffer

On Saturday, June 4, 2016 at 11:15:31 AM UTC-5, Tony V E wrote:
>
> But most of the time you don't want to copy the data.
>
> Whenever possible you want to process in place.
>
> Sent from my BlackBerry portable Babbage Device
> *From: *alexande...@gmail.com <javascript:>
> *Sent: *Saturday, June 4, 2016 10:41 AM
> *To: *ISO C++ Standard - Future Proposals
> *Reply To: *std-pr...@isocpp.org <javascript:>
> *Cc: *alexande...@gmail.com <javascript:>
> *Subject: *Re: [std-proposals] Any interest to adding audio support to
> the std library?
>
> Note that the input must be a const& because in  aparalell context it
> would allow multiple processes to read safely, this has the side effect of
> disabling the range for syntax unless you do this:
>
> //std::audio example 1 "single process"
> void example_1(){
>     double sample_rate = 44100;
>     std::size_t frame_size =2;
>     std::size_t buffer_size=128;
>
>     std::audio_context<float> ctx{sample_rate,buffer_size,frame_size};//contruct
> from values
>
>     std::astream_process<float> proc(ctx,[](std::frame_buffer<float> const
> & input, std::frame_buffer<float>& output){
>         output=intput;//note the copy required
>         for(auto&& i: output){
>             i*=1.0;
>         }
>     });
>
>     proc.start();
>     //do other stuff
>     proc.stop();
> }
>
>
>
> On Saturday, June 4, 2016 at 9:38:54 AM UTC-5, alexande...@gmail.com
> wrote:
>>
>> Is this example more agreeable?
>>
>> //std::audio example 1 "single process"
>> void example_1(){
>>     double sample_rate = 44100;
>>     std::size_t frame_size =2;
>>     std::size_t buffer_size=128;
>>
>>     std::audio_context<float> ctx{sample_rate,buffer_size,frame_size};//contruct
>> from values
>>
>>     std::astream_process<float> proc(ctx,[](std::frame_buffer<float>
>> const& input, std::frame_buffer<float>& output){
>>         for(std::size_t i =0; i <input.size();++i){
>>             output[i] = input[i] * 1.0;
>>         }
>>     });
>>
>>     proc.start();
>>     //do other stuff
>>     proc.stop();
>> }
>>
>>
>>
>> On Saturday, June 4, 2016 at 1:28:01 AM UTC-5, Ron wrote:
>>>
>>> Some thoughts...
>>>
>>> 'N' should be runtime for channels in a frame and for a frame buffer.
>>>  The buffer size might be negotiable with the device.
>>>
>>> I like a lot of that code in the original post, but I don't like the
>>> comparison to iostreams.  Its really the '>>' operator that I don't like.
>>>  When you copy into your frame buffer, an '=' operator should be used since
>>> anyone that sees an '=' operator knows its a copy.  But really, you
>>> shouldn't need to move data around so much.  If you stream from input to
>>> 'buff', then process and then move from 'buff' to output then you are
>>> moving a lot of data unnecessarily.
>>>
>>> I think what should happen is this; The process chain is triggered when
>>> the 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 reaches the input where the input device/file/etc copies the data
>>> to the chains 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 data 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, where the input doesn't officially start until the
>>> output is ready.  I know it is opposite of the way audio really flows
>>> through a system but it makes things easier then moving data like a bucket
>>> brigade.  It can also allow easier 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 output, the output calls to many
>>> channels/nodes at once so they can all be processed in parallel and mixed
>>> together after each of the processes end.
>>>
>>> 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
>>> data in that is in the file format?  Its just confusing, so I think
>>> 'container' 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, interleaving, channel routing and other information and a
>>> container class would deal with files.
>>>
>>> I personally would rather have all audio with greater than 2 or 3
>>> channels 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 with everyone so we would need a class for channel routing
>>> information as well.
>>>
>>> All I can think of at the moment..
>>>
>>>
>>>
>>> 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
>>>> about having std audio stream classes similar to std::fstream. The
>>>> std::astream/iastream/oastream would represent the default audio device on
>>>> the system as determined by some method of polling the system. The user
>>>> could either choose to use them as is or manually select a different device?
>>>>
>>>> On Friday, June 3, 2016 at 10:51:12 PM UTC-5, Ron wrote:
>>>>>
>>>>> Well, it needs to start somewhere.  I think having basic buffers using
>>>>> std::array or plain old arrays might do for now and get some basic audio
>>>>> recording 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 way 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.
>>>>>
>>>>>
>>>>>
>>>>> --
> 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
> email to std-proposal...@isocpp.org <javascript:>.
> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
> To view this discussion on the web visit
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/d6c30daa-bab3-454d-899d-2ad906fc55df%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/d6c30daa-bab3-454d-899d-2ad906fc55df%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>
>

--
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 email 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/23998f11-3bb2-41cf-a8fa-e0be2d80dfd2%40isocpp.org.

------=_Part_3104_990868243.1465058390095
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I agree that in place processing is desired, but an issue =
comes up when you need to preserve that data for some other process to use =
as well, you would either have to copy before hand and pass a copy to each =
process or make the buffer a const&amp; and force you to copy it and work i=
n place on the output buffer<br><br>On Saturday, June 4, 2016 at 11:15:31 A=
M UTC-5, Tony V E wrote:<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div s=
tyle=3D"background-color:rgb(255,255,255);line-height:initial" lang=3D"en-U=
S">                                                                        =
              <div style=3D"width:100%;font-size:initial;font-family:Calibr=
i,&#39;Slate Pro&#39;,sans-serif,sans-serif;color:rgb(31,73,125);text-align=
:initial;background-color:rgb(255,255,255)">But most of the time you don&#3=
9;t want to copy the data.=C2=A0</div><div style=3D"width:100%;font-size:in=
itial;font-family:Calibri,&#39;Slate Pro&#39;,sans-serif,sans-serif;color:r=
gb(31,73,125);text-align:initial;background-color:rgb(255,255,255)"><br></d=
iv><div style=3D"width:100%;font-size:initial;font-family:Calibri,&#39;Slat=
e Pro&#39;,sans-serif,sans-serif;color:rgb(31,73,125);text-align:initial;ba=
ckground-color:rgb(255,255,255)">Whenever possible you want to process in p=
lace. </div>                                                               =
                                                                      <div =
style=3D"width:100%;font-size:initial;font-family:Calibri,&#39;Slate Pro&#3=
9;,sans-serif,sans-serif;color:rgb(31,73,125);text-align:initial;background=
-color:rgb(255,255,255)"><br style=3D"display:initial"></div>              =
                                                                           =
                                                                           =
                               <div style=3D"font-size:initial;font-family:=
Calibri,&#39;Slate Pro&#39;,sans-serif,sans-serif;color:rgb(31,73,125);text=
-align:initial;background-color:rgb(255,255,255)">Sent=C2=A0from=C2=A0my=C2=
=A0BlackBerry=C2=A0<wbr>portable=C2=A0Babbage=C2=A0Device</div>            =
                                                                           =
                                                                           =
                <table style=3D"background-color:white;border-spacing:0px" =
width=3D"100%"> <tbody><tr><td colspan=3D"2" style=3D"font-size:initial;tex=
t-align:initial;background-color:rgb(255,255,255)">                        =
   <div style=3D"border-style:solid none none;border-top-color:rgb(181,196,=
223);border-top-width:1pt;padding:3pt 0in 0in;font-family:Tahoma,&#39;BB Al=
pha Sans&#39;,&#39;Slate Pro&#39;;font-size:10pt">  <div><b>From: </b><a hr=
ef=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"upHqK-6kAQAJ"=
 rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;return t=
rue;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;">alexande..=
..@gmail.com</a></div><div><b>Sent: </b>Saturday, June 4, 2016 10:41 AM</div=
><div><b>To: </b>ISO C++ Standard - Future Proposals</div><div><b>Reply To:=
 </b><a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"upH=
qK-6kAQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#39=
;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;">=
std-pr...@isocpp.org</a></div><div><b>Cc: </b><a href=3D"javascript:" targe=
t=3D"_blank" gdf-obfuscated-mailto=3D"upHqK-6kAQAJ" rel=3D"nofollow" onmous=
edown=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.hr=
ef=3D&#39;javascript:&#39;;return true;">alexande...@gmail.com</a></div><di=
v><b>Subject: </b>Re: [std-proposals] Any interest to adding audio support =
to the std library?</div></div></td></tr></tbody></table><div style=3D"bord=
er-style:solid none none;border-top-color:rgb(186,188,209);border-top-width=
:1pt;font-size:initial;text-align:initial;background-color:rgb(255,255,255)=
"></div><br><div><div dir=3D"ltr">Note that the input must be a const&amp; =
because in=C2=A0 aparalell context it would allow multiple processes to rea=
d safely, this has the side effect of disabling the range for syntax unless=
 you do this:<br><br><div style=3D"background-color:rgb(250,250,250);border=
-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break=
-word"><code><div><span style=3D"color:#800">//std::audio example 1 &quot;s=
ingle process&quot;</span><span style=3D"color:#000"><br></span><span style=
=3D"color:#008">void</span><span style=3D"color:#000"> example_1</span><spa=
n style=3D"color:#660">(){</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color:#008">double</span><span style=3D"color:#00=
0"> sample_rate </span><span style=3D"color:#660">=3D</span><span style=3D"=
color:#000"> </span><span style=3D"color:#066">44100</span><span style=3D"c=
olor:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><=
span style=3D"color:#660">::</span><span style=3D"color:#000">size_t frame_=
size </span><span style=3D"color:#660">=3D</span><span style=3D"color:#066"=
>2</span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=3D"=
color:#000">size_t buffer_size</span><span style=3D"color:#660">=3D</span><=
span style=3D"color:#066">128</span><span style=3D"color:#660">;</span><spa=
n style=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color=
:#660">::</span><span style=3D"color:#000">audio_context</span><span style=
=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#000"> ctx</span><=
span style=3D"color:#660">{</span><span style=3D"color:#000">sample_rate</s=
pan><span style=3D"color:#660">,</span><span style=3D"color:#000">buffer_si=
ze</span><span style=3D"color:#660">,</span><span style=3D"color:#000">fr<w=
br>ame_size</span><span style=3D"color:#660">};</span><span style=3D"color:=
#800">//contruct from values</span><span style=3D"color:#000"><br><br>=C2=
=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=3D"col=
or:#000">astream_process</span><span style=3D"color:#080">&lt;float&gt;</sp=
an><span style=3D"color:#000"> proc</span><span style=3D"color:#660">(</spa=
n><span style=3D"color:#000">ctx</span><span style=3D"color:#660">,[](</spa=
n><span style=3D"color:#000">std</span><span style=3D"color:#660">::</span>=
<span style=3D"color:#000">frame_buffer</span><span style=3D"color:#080">&l=
t;<wbr>float&gt;</span><span style=3D"color:#000"> </span><span style=3D"co=
lor:#008">const</span><span style=3D"color:#660">&amp;</span><span style=3D=
"color:#000"> input</span><span style=3D"color:#660">,</span><span style=3D=
"color:#000"> std</span><span style=3D"color:#660">::</span><span style=3D"=
color:#000">frame_buffer</span><span style=3D"color:#080">&lt;float&gt;</sp=
an><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"> outpu=
t</span><span style=3D"color:#660">){</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span style=3D"color:#660">=3D</sp=
an><span style=3D"color:#000">intput</span><span style=3D"color:#660">;</sp=
an><span style=3D"color:#800">//note the copy required</span><span style=3D=
"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#0=
08">for</span><span style=3D"color:#660">(</span><span style=3D"color:#008"=
>auto</span><span style=3D"color:#660">&amp;&amp;</span><span style=3D"colo=
r:#000"> i</span><span style=3D"color:#660">:</span><span style=3D"color:#0=
00"> output</span><span style=3D"color:#660">){</span><span style=3D"color:=
#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 i</span><span style=3D"=
color:#660">*=3D</span><span style=3D"color:#066">1.0</span><span style=3D"=
color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:#660">}</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 </span><span style=3D"color:#660">});</span><span style=3D"=
color:#000"><br><br>=C2=A0 =C2=A0 proc</span><span style=3D"color:#660">.</=
span><span style=3D"color:#000">start</span><span style=3D"color:#660">();<=
/span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"co=
lor:#800">//do other stuff</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 proc</span><span style=3D"color:#660">.</span><span style=3D"color:#000=
">stop</span><span style=3D"color:#660">();</span><span style=3D"color:#000=
"><br></span><span style=3D"color:#660">}</span></div></code></div><br><br>=
<br>On Saturday, June 4, 2016 at 9:38:54 AM UTC-5, <a>alexande...@gmail.com=
</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:=
0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Is this=
 example more agreeable?<br><br><div style=3D"background-color:rgb(250,250,=
250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word=
-wrap:break-word"><code><div><span style=3D"color:#800">//std::audio exampl=
e 1 &quot;single process&quot;</span><span style=3D"color:#000"><br></span>=
<span style=3D"color:#008">void</span><span style=3D"color:#000"> example_1=
</span><span style=3D"color:#660">(){</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#008">double</span><span style=3D=
"color:#000"> sample_rate </span><span style=3D"color:#660">=3D</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#066">44100</span><span =
style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 s=
td</span><span style=3D"color:#660">::</span><span style=3D"color:#000">siz=
e_t frame_size </span><span style=3D"color:#660">=3D</span><span style=3D"c=
olor:#066">2</span><span style=3D"color:#660">;</span><span style=3D"color:=
#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span=
 style=3D"color:#000">size_t buffer_size</span><span style=3D"color:#660">=
=3D</span><span style=3D"color:#066">128</span><span style=3D"color:#660">;=
</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span><span sty=
le=3D"color:#660">::</span><span style=3D"color:#000">audio_context</span><=
span style=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#000"> c=
tx</span><span style=3D"color:#660">{</span><span style=3D"color:#000">samp=
le_rate</span><span style=3D"color:#660">,</span><span style=3D"color:#000"=
>buffer_size</span><span style=3D"color:#660">,</span><span style=3D"color:=
#000">fr<wbr>ame_size</span><span style=3D"color:#660">};</span><span style=
=3D"color:#800">//contruct from values</span><span style=3D"color:#000"><br=
><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span styl=
e=3D"color:#000">astream_process</span><span style=3D"color:#080">&lt;float=
&gt;</span><span style=3D"color:#000"> proc</span><span style=3D"color:#660=
">(</span><span style=3D"color:#000">ctx</span><span style=3D"color:#660">,=
[](</span><span style=3D"color:#000">std</span><span style=3D"color:#660">:=
:</span><span style=3D"color:#000">frame_buffer</span><span style=3D"color:=
#080">&lt;<wbr>float&gt;</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#008">const</span><span style=3D"color:#660">&amp;</span><span =
style=3D"color:#000"> input</span><span style=3D"color:#660">,</span><span =
style=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span s=
tyle=3D"color:#000">frame_buffer</span><span style=3D"color:#080">&lt;float=
&gt;</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000=
"> output</span><span style=3D"color:#660">){</span><span style=3D"color:#0=
00"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">for</=
span><span style=3D"color:#660">(</span><span style=3D"color:#000">std</spa=
n><span style=3D"color:#660">::</span><span style=3D"color:#000">size_t i <=
/span><span style=3D"color:#660">=3D</span><span style=3D"color:#066">0</sp=
an><span style=3D"color:#660">;</span><span style=3D"color:#000"> i </span>=
<span style=3D"color:#660">&lt;</span><span style=3D"color:#000">input</spa=
n><span style=3D"color:#660">.</span><span style=3D"color:#000">size</span>=
<span style=3D"color:#660">();++</span><span style=3D"color:#000">i</span><=
span style=3D"color:#660">){</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span style=3D"color:#660">=
[</span><span style=3D"color:#000">i</span><span style=3D"color:#660">]</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#660">=3D</span>=
<span style=3D"color:#000"> input</span><span style=3D"color:#660">[</span>=
<span style=3D"color:#000">i</span><span style=3D"color:#660">]</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#660">*</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#066">1.0</span><span style=
=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 </span><span style=3D"color:#660">}</span><span style=3D"color:#000=
"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">});</span><span style=
=3D"color:#000"><br><br>=C2=A0 =C2=A0 proc</span><span style=3D"color:#660"=
>.</span><span style=3D"color:#000">start</span><span style=3D"color:#660">=
();</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color:#800">//do other stuff</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 proc</span><span style=3D"color:#660">.</span><span style=3D"col=
or:#000">stop</span><span style=3D"color:#660">();</span><span style=3D"col=
or:#000"><br></span><span style=3D"color:#660">}</span></div></code></div><=
br><br><br>On Saturday, June 4, 2016 at 1:28:01 AM UTC-5, Ron wrote:<blockq=
uote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:=
1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Some thoughts...</di=
v><div><br></div><div>&#39;N&#39; should be runtime for channels in a frame=
 and for a frame buffer. =C2=A0The buffer size might be negotiable with the=
 device.</div><div><br></div><div>I like a lot of that code in the original=
 post, but I don&#39;t like the comparison to iostreams. =C2=A0Its really t=
he &#39;&gt;&gt;&#39; operator that I don&#39;t like. =C2=A0When you copy i=
nto your frame buffer, an &#39;=3D&#39; operator should be used since anyon=
e that sees an &#39;=3D&#39; operator knows its a copy. =C2=A0But really, y=
ou shouldn&#39;t need to move data around so much. =C2=A0If you stream from=
 input to &#39;buff&#39;, then process and then move from &#39;buff&#39; to=
 output then you are moving a lot of data unnecessarily.</div><div><br></di=
v><div>I think what should happen is this; The process chain is triggered w=
hen the output signals it is ready for data by calling the first linked pro=
cess. =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 the chains frame buffer. =C2=A0Each process then operates on that single=
 buffer in turn until finally returning to the output, thus altering the bu=
ffer instead of moving data from place to place. =C2=A0I like to think of t=
he processing chain as starting from the output or destination. =C2=A0When =
the output is ready for data it calls to a linked process for information, =
it calls to the next link and so on until data begins to get processed. =C2=
=A0So a bottom up approach, where the input doesn&#39;t officially start un=
til the output is ready. =C2=A0I know it is opposite of the way audio reall=
y flows through a system but it makes things easier then moving data like a=
 bucket brigade. =C2=A0It can also allow easier parallel processing when th=
ere are multiple branches on a node. =C2=A0So if you think of an audio mixe=
r, where there are many inputs and a single output, the output calls to man=
y channels/nodes at once so they can all be processed in parallel and mixed=
 together after each of the processes end.</div><div><br></div><div><div>Al=
so, I&#39;m not sure the word &#39;format&#39; should be used to refer to f=
iles. =C2=A0I know people like to say &quot;file format&quot; but then, wha=
t format is the audio data in that is in the file format? =C2=A0Its just co=
nfusing, so I think &#39;container&#39; is a better word for files. =C2=A0T=
hen that leaves the word format open for use as a way of describing the dat=
a format of an audio frame buffer. =C2=A0So an audio_format class would con=
tain information on sample rate, channels, interleaving, channel routing an=
d other information and a container class would deal with files.</div></div=
><div><br></div><div>I personally would rather have all audio with greater =
than 2 or 3 channels processed in Ambisonic-B format and then have the audi=
o driver figure out how to extract the channels for each speaker, but I kno=
w this won&#39;t fly with everyone so we would need a class for channel rou=
ting information as well.</div><div><br></div><div>All I can think of at th=
e moment..</div><div><br></div><div><div><br></div><div><br>On Friday, June=
 3, 2016 at 9:08:45 PM UTC-7, <a>alexande...@gmail.com</a> wrote:<blockquot=
e class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px=
 #ccc solid;padding-left:1ex"><div dir=3D"ltr">I agree, how do you feel abo=
ut the concept i proposed in my original about having std audio stream clas=
ses similar to std::fstream. The std::astream/iastream/oastream would repre=
sent the default audio device on the system as determined by some method of=
 polling the system. The user could either choose to use them as is or manu=
ally select a different device?<br><br>On Friday, June 3, 2016 at 10:51:12 =
PM UTC-5, Ron wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;mar=
gin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr=
">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.<div><br></div></div><div><br><br></div>
</blockquote></div></blockquote></div></div></div></blockquote></div></bloc=
kquote></div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
upHqK-6kAQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&=
#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"upHqK-6kAQAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">std-pr...@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d6c30daa-bab3-454d-899d-2ad906fc55df%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/d6c30daa-bab3-454d-899d-2ad906fc55df%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" on=
click=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/d6c30daa-bab3-454d-899d-2ad906fc55df%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/d6c30daa-bab3-454d-<wbr>899d-=
2ad906fc55df%40isocpp.org</a><wbr>.<br>
<br></div></div>
</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/23998f11-3bb2-41cf-a8fa-e0be2d80dfd2%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/23998f11-3bb2-41cf-a8fa-e0be2d80dfd2=
%40isocpp.org</a>.<br />

------=_Part_3104_990868243.1465058390095--

------=_Part_3103_99253408.1465058390095--

.


Author: Jim <sdjimmysmith@gmail.com>
Date: Sat, 4 Jun 2016 15:24:16 -0700 (PDT)
Raw View
------=_Part_3419_1679322864.1465079056460
Content-Type: multipart/alternative;
 boundary="----=_Part_3420_2002602399.1465079056460"

------=_Part_3420_2002602399.1465079056460
Content-Type: text/plain; charset=UTF-8

Hi,

I think it would be more feasible and elegant to use a standard or *more*
standard C++ media interface. Building on existing design used for the C++
boost networking APIs, and std::basic_ostream, std::basic_streambuf
features, something like std::char_traits<sample>. Using an existing audio
framework or creating a less common C++ approach to handling media, might
break an architectual flow of the C++ standard.

The same backend ideas used for a networking API interface hold true for an
audio interface. What we read and write to/from an audio interface are
samples and the structure is the format settings. The same idea is used in
networking, we can read and write raw protocol or more structured one like
TCP packets. The audio format is like a protocol you setup between the
hardware and software. The i/o features async, sync etc. will be to some
extent picked up automatically from the existing backend interface.
Capturing concepts this way in a low level implementation should make
acceptance easier.


--Jim Smith

On Friday, June 3, 2016 at 11:43:42 AM UTC-4, Jeffrey Yasskin wrote:
>
> Is this based on an existing library? We're much more likely to adopt
> a proposal that's been used widely than one that was invented for the
> standard.
>
> On Fri, Jun 3, 2016 at 2:37 AM,  <alexande...@gmail.com <javascript:>>
> wrote:
> > I have drafted some ideas on how I think the c++ std library could
> support
> > audio functionality.
> >
> > I know that audio functionality is a very operating specific problem,
> but
> > with the recent trend towards implementing a file-system library and
> > possibly a graphics library I believe that audio would not be too much
> of a
> > reach anymore.
> >
> > Here are some of the ideas I have so far. I have both some code examples
> of
> > the intended usage as well as a list of the types needed to implement
> the
> > given examples.
> >
> > Please keep in mind my drafts are still very rough.
> >
> >
> > CODE EXAMPLES
> >
> > //std::audio example 1 "single process"
> > void example_1(){
> >     double sample_rate = 44100;
> >     std::size_t frame_size =2;
> >     std::size_t buffer_size=128;
> >
> >     std::audio_context<float>
> > ctx{sample_rate,buffer_size,frame_size};//contruct from values
> >
> >     std::astream_process<float> proc(ctx,[](std::iastream const& input,
> > std::oastream& output){
> >         std::frame_buffer<float>& buff = ctx.borrow_buffer();//borrow a
> > buffer from the context for usage
> >         //prevents the need for dynamic allocation of a temporary buffer
> >         input>>buff;//stream data into buffer for manipulation
> >         for(auto&& frame: buff){
> >             frame=0.0;//do something with audio
> >         }
> >         output<<buff;//stream to output
> >     });//dsp object
> >     //uses implied routing equivilent to
> >     //std::aout<<proc<<std::ain;
> >     //
> >
> >     proc.start();
> >     //do other stuff
> >     proc.stop();
> > }
> >
> > //std::audio example 2 "process group"
> > void example_2(){
> >
> >     std::audio_context<float> ctx;//default context created with
> > std::default_* values
> >
> >     //version 1: capture context via lambda
> >     std::astream_process<float> proc1(ctx,[&ctx](std::iastream const&
> input,
> > std::oastream& output){
> >         std::frame_buffer<float>& buff = ctx.borrow_buffer();
> >         input>>buff;
> >         for(auto&& frame: buff){
> >             frame*=0.5;
> >         }
> >         output<<buff;
> >     });//dsp object
> >
> >     //version 2: have context passed as argument
> >     std::astream_process<float> proc2(ctx,[](std::iastream const& input,
> > std::oastream& output,std::audio_context<float> const& context){
> >         std::frame_buffer<float>& buff = ctx.borrow_buffer();
> >         input>>buff;
> >         for(auto&& frame: buff){
> >             frame*=2.0;
> >         }
> >         output<<buff;
> >     });
> >
> >     std::process_group<float> pgroup;//a group of processes that will
> happen
> > consecutivley
> >     pgroup.push(proc1);//add to group
> >     pgroup.push(proc2);//add to group
> >
> >     //configure stream relationships in terms of std::ain / std:aout
> > manually
> >     //std::ain/std::aout are std::astream globals that refer to the
> default
> > audio inputs and outputs supplied by the context in use
> >     //std::ain/std::aout will route the audio to the enpoint specified
> by
> > the context reference held by the process that is streaming the data
> >     std::aout<<proc1<<proc2<<std::ain;//method 1
> >     //std::ain>>proc2>>proc1>>std::aout;//method 2
> >
> >     pgroup.start();
> >     //do other stuff
> >     pgroup.stop();
> >
> > }
> >
> >
> > //std::audio example 3 "audio files"
> > void example_3(){
> >
> >     std::audio_context<float> ctx;
> >
> >     std::astream_process<float> proc(ctx,[](std::iafstream const& input,
> > std::oafstream& output){
> >         std::frame_buffer<float>& buff = ctx.borrow_buffer();
> >         input>>buff;
> >         for(auto&& frame: buff){
> >             frame=0.0;
> >         }
> >         output<<buff;
> >     });//dsp object
> >
> >     std::iafstream audio_file1(ctx,"filename1.extension");//an audio
> file
> > handle
> >     std::oafstream audio_file2(ctx,"filename2.extension");//an audio
> file
> > handle
> >
> >     //routing
> >     audio_file2<<proc<<audio_file1;//take input from file nad write to
> file
> >     //audio_file1>>proc>>audio_file2;//equivilent syntax
> >     proc.start();
> >     //do other stuff
> >     proc.stop();
> > }
> >
> >
> > //std::audio example 4 "combination routing"
> > void example_3(){
> >
> >     std::audio_context<float> ctx;
> >     //manually select hardware endpoints
> >     std::size_t device_id = ctx.default_device_id();
> >     std::iastream input_device =
> > ctx.get_device<std::input_device>(device_id);
> >     std::oastream output_device =
> > ctx.get_device<std::output_device>(device_id);
> >
> >     std::astream_process<float> proc(ctx,[](std::iastream const& input,
> >                                             std::oastream& output,
> >                                             std::iafstream const&
> > input_file,
> >                                              std::oafstream&
> output_file){
> >         std::frame_buffer<float>& buff = ctx.borrow_buffer();
> >         (input + input_file)>>buff;//add streams to perform sum before
> > writing to buffer
> >         //or you could use seperate buffers
> >         //like this
> >         /*
> >             std::frame_buffer<float> buff1;
> >             std::frame_buffer<float> buff2;
> >
> >             input>>buff1;
> >             input_file>>buff2;
> >             buff1+=buff2;//buffer arithmatic
> >         */
> >         output<<buff;//send the contents of buff to the hardware out and
> the
> > file out
> >         output_file<<buff;
> >     });
> >
> >     std::iafstream audio_file1(ctx,"filename1.extension");//the actual
> files
> > to be used above
> >     std::oafstream audio_file2(ctx,"filename2.extension");
> >
> >     //connect the files to the process
> >     //connect the hardware device to the process
> >     audio_file2<<proc<<audio_file1;//take input from file
> >     output_device<<proc<<input_device;//also take from hardware
> >     proc.start();
> >     //do other stuff
> >     proc.stop();
> > }
> >
> >
> >
> > REQUIRED LIBRARY MEMBERS
> >
> >
> > namespace std{
> >     inline namespace audio{
> >         //working context for audio flow
> >         template<typename>
> >         class audio_context;
> >         /*
> >         *The context in which all audio data is centered.
> >         *Contains: sampling rate, buffer size, frame size, etc...
> >         *The values of ain,aout,afin,afout refer to the endpoints
> defined by
> > the context, when applied to routing on a porocess tied to the context
> >         *think of a context as the program level driver object
> >         */
> >
> >         //audio streams (think like std::fstream and its friends)
> >         class astream;//audio stream
> >         class oastream;//output audio stream
> >         class iastream;//input audio stream
> >         class oafstream;//output audio file stream
> >         class iafstream;//input audio file stream
> >
> >
> >         //stream endpoints
> >         class ain;//audio input endpoint
> >         class aout;//audio output endpoint
> >         class afin;//audio file input endpoint
> >         class afout//audio file output endpoint
> >
> >         //stream processing
> >         template<typename>
> >         class astream_process;//a dsp process applied to a stream
> >
> >         template<typename>
> >         class process_group;//a group of processes that will act as one
> >
> >         //containers
> >         template<typename>
> >         class frame_buffer;//a sequence container that is resizeable at
> > runtime, but only with explicit resize calls. contains frames(see below)
> >         /*Implementation note on frame_buffer
> >          *frame_buffer is intended to hold N number of frames which
> > themselves can hold M number of samples
> >          *meaning that the total size in samples if frame_buffer = N * M
> >          *ideally frame_buffers representation of its sample data will
> be
> > continuous in memory
> >         */
> >
> >         template<typename>
> >         class frame;//a container that holds samples, thin array wrapper
> >
> >
> >         //hardware representation
> >         class device;//an audio device as recognized by the OS
> >         class input_device;//an input device
> >         class output_device;//an output device
> >
> >         // audio file formats
> >         enum class afformat{
> >             raw,//raw headerless audio bytes, interpreted only by the
> > settings of the context.
> >             //best used for temporary storage within the life of a
> context
> >             wav,
> >             flac//etc...
> >         }
> >     }
> > }
> >
> >
> >
> > --
> > 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
> > email to std-proposal...@isocpp.org <javascript:>.
> > To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>
> > To view this discussion on the web visit
> >
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f490fd21-cf07-4d7b-8936-c71c97a1ab9d%40isocpp.org.
>
>

--
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 email 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/01f6b6a7-2b1e-491a-a676-5fc8ad816aab%40isocpp.org.

------=_Part_3420_2002602399.1465079056460
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<br><br>I think it would be more feasible and elegant t=
o use a standard or *more* standard C++ media interface. Building on existi=
ng design used for the C++ boost networking APIs, and std::basic_ostream, s=
td::basic_streambuf features, something like std::char_traits&lt;sample&gt;=
.. Using an existing audio framework or creating a less common C++ approach =
to handling media, might break an architectual flow of the C++ standard.<br=
><br>The same backend ideas used for a networking API interface hold true f=
or an audio interface. What we read and write to/from an audio interface ar=
e samples and the structure is the format settings. The same idea is used i=
n networking, we can read and write raw protocol or more structured one lik=
e TCP packets. The audio format is like a protocol you setup between the ha=
rdware and software. The i/o features async, sync etc. will be to some exte=
nt picked up automatically from the existing backend interface. Capturing c=
oncepts this way in a low level implementation should make acceptance easie=
r.<br><br><br>--Jim Smith<br><br>On Friday, June 3, 2016 at 11:43:42 AM UTC=
-4, Jeffrey Yasskin wrote:<blockquote class=3D"gmail_quote" style=3D"margin=
: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Is t=
his based on an existing library? We&#39;re much more likely to adopt
<br>a proposal that&#39;s been used widely than one that was invented for t=
he
<br>standard.
<br>
<br>On Fri, Jun 3, 2016 at 2:37 AM, =C2=A0&lt;<a href=3D"javascript:" targe=
t=3D"_blank" gdf-obfuscated-mailto=3D"xwvxNJ1UAQAJ" rel=3D"nofollow" onmous=
edown=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.hr=
ef=3D&#39;javascript:&#39;;return true;">alexande...@gmail.com</a>&gt; wrot=
e:
<br>&gt; I have drafted some ideas on how I think the c++ std library could=
 support
<br>&gt; audio functionality.
<br>&gt;
<br>&gt; I know that audio functionality is a very operating specific probl=
em, but
<br>&gt; with the recent trend towards implementing a file-system library a=
nd
<br>&gt; possibly a graphics library I believe that audio would not be too =
much of a
<br>&gt; reach anymore.
<br>&gt;
<br>&gt; Here are some of the ideas I have so far. I have both some code ex=
amples of
<br>&gt; the intended usage as well as a list of the types needed to implem=
ent the
<br>&gt; given examples.
<br>&gt;
<br>&gt; Please keep in mind my drafts are still very rough.
<br>&gt;
<br>&gt;
<br>&gt; CODE EXAMPLES
<br>&gt;
<br>&gt; //std::audio example 1 &quot;single process&quot;
<br>&gt; void example_1(){
<br>&gt; =C2=A0 =C2=A0 double sample_rate =3D 44100;
<br>&gt; =C2=A0 =C2=A0 std::size_t frame_size =3D2;
<br>&gt; =C2=A0 =C2=A0 std::size_t buffer_size=3D128;
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 std::audio_context&lt;float&gt;
<br>&gt; ctx{sample_rate,buffer_size,<wbr>frame_size};//contruct from value=
s
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 std::astream_process&lt;float&gt; proc(ctx,[](std::i=
astream const&amp; input,
<br>&gt; std::oastream&amp; output){
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::frame_buffer&lt;float&gt;&amp; bu=
ff =3D ctx.borrow_buffer();//borrow a
<br>&gt; buffer from the context for usage
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 //prevents the need for dynamic alloca=
tion of a temporary buffer
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 input&gt;&gt;buff;//stream data into b=
uffer for manipulation
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 for(auto&amp;&amp; frame: buff){
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame=3D0.0;//do somethi=
ng with audio
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 output&lt;&lt;buff;//stream to output
<br>&gt; =C2=A0 =C2=A0 });//dsp object
<br>&gt; =C2=A0 =C2=A0 //uses implied routing equivilent to
<br>&gt; =C2=A0 =C2=A0 //std::aout&lt;&lt;proc&lt;&lt;std::ain;
<br>&gt; =C2=A0 =C2=A0 //
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 proc.start();
<br>&gt; =C2=A0 =C2=A0 //do other stuff
<br>&gt; =C2=A0 =C2=A0 proc.stop();
<br>&gt; }
<br>&gt;
<br>&gt; //std::audio example 2 &quot;process group&quot;
<br>&gt; void example_2(){
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 std::audio_context&lt;float&gt; ctx;//default contex=
t created with
<br>&gt; std::default_* values
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 //version 1: capture context via lambda
<br>&gt; =C2=A0 =C2=A0 std::astream_process&lt;float&gt; proc1(ctx,[&amp;ct=
x](std::iastream const&amp; input,
<br>&gt; std::oastream&amp; output){
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::frame_buffer&lt;float&gt;&amp; bu=
ff =3D ctx.borrow_buffer();
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 input&gt;&gt;buff;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 for(auto&amp;&amp; frame: buff){
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame*=3D0.5;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 output&lt;&lt;buff;
<br>&gt; =C2=A0 =C2=A0 });//dsp object
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 //version 2: have context passed as argument
<br>&gt; =C2=A0 =C2=A0 std::astream_process&lt;float&gt; proc2(ctx,[](std::=
iastream const&amp; input,
<br>&gt; std::oastream&amp; output,std::audio_context&lt;<wbr>float&gt; con=
st&amp; context){
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::frame_buffer&lt;float&gt;&amp; bu=
ff =3D ctx.borrow_buffer();
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 input&gt;&gt;buff;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 for(auto&amp;&amp; frame: buff){
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame*=3D2.0;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 output&lt;&lt;buff;
<br>&gt; =C2=A0 =C2=A0 });
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 std::process_group&lt;float&gt; pgroup;//a group of =
processes that will happen
<br>&gt; consecutivley
<br>&gt; =C2=A0 =C2=A0 pgroup.push(proc1);//add to group
<br>&gt; =C2=A0 =C2=A0 pgroup.push(proc2);//add to group
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 //configure stream relationships in terms of std::ai=
n / std:aout
<br>&gt; manually
<br>&gt; =C2=A0 =C2=A0 //std::ain/std::aout are std::astream globals that r=
efer to the default
<br>&gt; audio inputs and outputs supplied by the context in use
<br>&gt; =C2=A0 =C2=A0 //std::ain/std::aout will route the audio to the enp=
oint specified by
<br>&gt; the context reference held by the process that is streaming the da=
ta
<br>&gt; =C2=A0 =C2=A0 std::aout&lt;&lt;proc1&lt;&lt;proc2&lt;&lt;std::<wbr=
>ain;//method 1
<br>&gt; =C2=A0 =C2=A0 //std::ain&gt;&gt;proc2&gt;&gt;proc1&gt;&gt;std:<wbr=
>:aout;//method 2
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 pgroup.start();
<br>&gt; =C2=A0 =C2=A0 //do other stuff
<br>&gt; =C2=A0 =C2=A0 pgroup.stop();
<br>&gt;
<br>&gt; }
<br>&gt;
<br>&gt;
<br>&gt; //std::audio example 3 &quot;audio files&quot;
<br>&gt; void example_3(){
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 std::audio_context&lt;float&gt; ctx;
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 std::astream_process&lt;float&gt; proc(ctx,[](std::i=
afstream const&amp; input,
<br>&gt; std::oafstream&amp; output){
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::frame_buffer&lt;float&gt;&amp; bu=
ff =3D ctx.borrow_buffer();
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 input&gt;&gt;buff;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 for(auto&amp;&amp; frame: buff){
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame=3D0.0;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 output&lt;&lt;buff;
<br>&gt; =C2=A0 =C2=A0 });//dsp object
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 std::iafstream audio_file1(ctx,&quot;filename1.<wbr>=
extension&quot;);//an audio file
<br>&gt; handle
<br>&gt; =C2=A0 =C2=A0 std::oafstream audio_file2(ctx,&quot;filename2.<wbr>=
extension&quot;);//an audio file
<br>&gt; handle
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 //routing
<br>&gt; =C2=A0 =C2=A0 audio_file2&lt;&lt;proc&lt;&lt;audio_<wbr>file1;//ta=
ke input from file nad write to file
<br>&gt; =C2=A0 =C2=A0 //audio_file1&gt;&gt;proc&gt;&gt;audio_<wbr>file2;//=
equivilent syntax
<br>&gt; =C2=A0 =C2=A0 proc.start();
<br>&gt; =C2=A0 =C2=A0 //do other stuff
<br>&gt; =C2=A0 =C2=A0 proc.stop();
<br>&gt; }
<br>&gt;
<br>&gt;
<br>&gt; //std::audio example 4 &quot;combination routing&quot;
<br>&gt; void example_3(){
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 std::audio_context&lt;float&gt; ctx;
<br>&gt; =C2=A0 =C2=A0 //manually select hardware endpoints
<br>&gt; =C2=A0 =C2=A0 std::size_t device_id =3D ctx.default_device_id();
<br>&gt; =C2=A0 =C2=A0 std::iastream input_device =3D
<br>&gt; ctx.get_device&lt;std::input_<wbr>device&gt;(device_id);
<br>&gt; =C2=A0 =C2=A0 std::oastream output_device =3D
<br>&gt; ctx.get_device&lt;std::output_<wbr>device&gt;(device_id);
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 std::astream_process&lt;float&gt; proc(ctx,[](std::i=
astream const&amp; input,
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 std::oastream&amp; output,
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 std::iafstream const&amp;
<br>&gt; input_file,
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0std::oafstream&amp; output_file){
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::frame_buffer&lt;float&gt;&amp; bu=
ff =3D ctx.borrow_buffer();
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 (input + input_file)&gt;&gt;buff;//add=
 streams to perform sum before
<br>&gt; writing to buffer
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 //or you could use seperate buffers
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 //like this
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::frame_buffer&lt;flo=
at&gt; buff1;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::frame_buffer&lt;flo=
at&gt; buff2;
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 input&gt;&gt;buff1;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 input_file&gt;&gt;buff2;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 buff1+=3Dbuff2;//buffer =
arithmatic
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 */
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 output&lt;&lt;buff;//send the contents=
 of buff to the hardware out and the
<br>&gt; file out
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 output_file&lt;&lt;buff;
<br>&gt; =C2=A0 =C2=A0 });
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 std::iafstream audio_file1(ctx,&quot;filename1.<wbr>=
extension&quot;);//the actual files
<br>&gt; to be used above
<br>&gt; =C2=A0 =C2=A0 std::oafstream audio_file2(ctx,&quot;filename2.<wbr>=
extension&quot;);
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 //connect the files to the process
<br>&gt; =C2=A0 =C2=A0 //connect the hardware device to the process
<br>&gt; =C2=A0 =C2=A0 audio_file2&lt;&lt;proc&lt;&lt;audio_<wbr>file1;//ta=
ke input from file
<br>&gt; =C2=A0 =C2=A0 output_device&lt;&lt;proc&lt;&lt;input_<wbr>device;/=
/also take from hardware
<br>&gt; =C2=A0 =C2=A0 proc.start();
<br>&gt; =C2=A0 =C2=A0 //do other stuff
<br>&gt; =C2=A0 =C2=A0 proc.stop();
<br>&gt; }
<br>&gt;
<br>&gt;
<br>&gt;
<br>&gt; REQUIRED LIBRARY MEMBERS
<br>&gt;
<br>&gt;
<br>&gt; namespace std{
<br>&gt; =C2=A0 =C2=A0 inline namespace audio{
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 //working context for audio flow
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 template&lt;typename&gt;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class audio_context;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 *The context in which all audio data i=
s centered.
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 *Contains: sampling rate, buffer size,=
 frame size, etc...
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 *The values of ain,aout,afin,afout ref=
er to the endpoints defined by
<br>&gt; the context, when applied to routing on a porocess tied to the con=
text
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 *think of a context as the program lev=
el driver object
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 */
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 //audio streams (think like std::fstre=
am and its friends)
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class astream;//audio stream
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class oastream;//output audio stream
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class iastream;//input audio stream
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class oafstream;//output audio file st=
ream
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class iafstream;//input audio file str=
eam
<br>&gt;
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 //stream endpoints
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class ain;//audio input endpoint
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class aout;//audio output endpoint
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class afin;//audio file input endpoint
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class afout//audio file output endpoin=
t
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 //stream processing
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 template&lt;typename&gt;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class astream_process;//a dsp process =
applied to a stream
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 template&lt;typename&gt;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class process_group;//a group of proce=
sses that will act as one
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 //containers
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 template&lt;typename&gt;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class frame_buffer;//a sequence contai=
ner that is resizeable at
<br>&gt; runtime, but only with explicit resize calls. contains frames(see =
below)
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*Implementation note on frame_buffer
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*frame_buffer is intended to hol=
d N number of frames which
<br>&gt; themselves can hold M number of samples
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*meaning that the total size in =
samples if frame_buffer =3D N * M
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*ideally frame_buffers represent=
ation of its sample data will be
<br>&gt; continuous in memory
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 */
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 template&lt;typename&gt;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class frame;//a container that holds s=
amples, thin array wrapper
<br>&gt;
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 //hardware representation
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class device;//an audio device as reco=
gnized by the OS
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class input_device;//an input device
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 class output_device;//an output device
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 // audio file formats
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 enum class afformat{
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 raw,//raw headerless aud=
io bytes, interpreted only by the
<br>&gt; settings of the context.
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 //best used for temporar=
y storage within the life of a context
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 wav,
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 flac//etc...
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
<br>&gt; =C2=A0 =C2=A0 }
<br>&gt; }
<br>&gt;
<br>&gt;
<br>&gt;
<br>&gt; --
<br>&gt; You received this message because you are subscribed to the Google=
 Groups
<br>&gt; &quot;ISO C++ Standard - Future Proposals&quot; group.
<br>&gt; To unsubscribe from this group and stop receiving emails from it, =
send an
<br>&gt; email to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-=
mailto=3D"xwvxNJ1UAQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;ja=
vascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;r=
eturn true;">std-proposal...@<wbr>isocpp.org</a>.
<br>&gt; To post to this group, send email to <a href=3D"javascript:" targe=
t=3D"_blank" gdf-obfuscated-mailto=3D"xwvxNJ1UAQAJ" rel=3D"nofollow" onmous=
edown=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.hr=
ef=3D&#39;javascript:&#39;;return true;">std-pr...@isocpp.org</a>.
<br>&gt; To view this discussion on the web visit
<br>&gt; <a href=3D"https://groups.google.com/a/isocpp.org/d/msgid/std-prop=
osals/f490fd21-cf07-4d7b-8936-c71c97a1ab9d%40isocpp.org" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/f490fd21-cf07-4d7b-8936-c71c97a1ab9d%40i=
socpp.org&#39;;return true;" onclick=3D"this.href=3D&#39;https://groups.goo=
gle.com/a/isocpp.org/d/msgid/std-proposals/f490fd21-cf07-4d7b-8936-c71c97a1=
ab9d%40isocpp.org&#39;;return true;">https://groups.google.com/a/<wbr>isocp=
p.org/d/msgid/std-<wbr>proposals/f490fd21-cf07-4d7b-<wbr>8936-c71c97a1ab9d%=
40isocpp.org</a><wbr>.
<br></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/01f6b6a7-2b1e-491a-a676-5fc8ad816aab%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/01f6b6a7-2b1e-491a-a676-5fc8ad816aab=
%40isocpp.org</a>.<br />

------=_Part_3420_2002602399.1465079056460--

------=_Part_3419_1679322864.1465079056460--

.


Author: Robert Bielik <robert.bielik@gmail.com>
Date: Tue, 7 Jun 2016 01:59:49 -0700 (PDT)
Raw View
------=_Part_3785_1957277192.1465289989791
Content-Type: multipart/alternative;
 boundary="----=_Part_3786_342866607.1465289989791"

------=_Part_3786_342866607.1465289989791
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Dear all,

I've been programming audio for almost 20 years now, and just the other day=
=20
started thinking of doing a C++ based basic audio API meeting my needs. So=
=20
this is a very interesting topic indeed to me. I've done parts of Portaudio=
=20
library (WDM/KS WaveRT) and the WASAPI Exclusive mode port of JUCE,=20
hopefully I can be of some use :)

Some additional features I'd like to see, not sure if they've been=20
addressed:
- "Hotplugging", i.e. the possibility to receive notifications when devices=
=20
are inserted/removed, and handle this gracefully.
- Timestamp for callbacks, flags for input overflow and output underflow.

Regards
/Robert

Den l=C3=B6rdag 4 juni 2016 kl. 03:47:29 UTC+2 skrev alexande...@gmail.com:
>
> On Friday, June 3, 2016 at 8:30:49 PM UTC-5, Jeffrey Yasskin wrote:=20
> > On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira <thi...@macieira.org>=
=20
> wrote:=20
> > On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:=
=20
> >=20
> > > What is needed is a standardized interface for these different module=
s=20
> >=20
> > > to work with each other. The interface should also allow me, the=20
> >=20
> > > developer, to work with the media (e.g. create my own audio or image=
=20
> >=20
> > > filter or a new codec or a new device driver).=20
> >=20
> >=20
> >=20
> > That I agree with.=20
> >=20
> >=20
> >=20
> > But should the standard mandate that there should be at least one? How=
=20
> does=20
> >=20
> > someone write a plugin to the C++ Standard Library? Will we now mandate=
=20
> this=20
> >=20
> > kind of ability?=20
> >=20
> >=20
> >=20
> > Yes. We already do this with things like the random engines.=20
> >=20
> >=20
> > If not, then will there be a requirement that the C++ library vendor=20
> provide=20
> >=20
> > it? If so, please think carefully how Apple should code libc++ to work=
=20
> on iOS.=20
> >=20
> >=20
> >=20
> > WebCrypto has an example of navigating a legal minefield for=20
> implementers.=20
> >=20
> >=20
> >=20
> > Also remember to leave the legal speculation to lawyers. It's good to=
=20
> have the heads-up that "hey lawyers should look at this", but anything mo=
re=20
> is unwise.=20
> >=20
> >=20
> > Again, I think this is not material for the C++ Standard Library.=20
> >=20
> >=20
> > I think it's a great area for the C++ library to expand into. I'm=20
> definitely worried about the expertise of the people writing the proposal=
=20
> (e.g. if I proposed an audio library for C++, I should be laughed off the=
=20
> stage), but we can overcome that by asking well-known audio users for the=
ir=20
> opinions before standardizing the proposal.=20
> >=20
> >=20
> > Jeffrey=20
>
> I agree about the issue of expertise. By no means would I call myself an=
=20
> expert, but I have a degree in audio engineering and a pretty solid grasp=
=20
> of the c++ language. Are there people out there more skilled than me at=
=20
> each topic? Of course, but that's why I am here, to get the opinions of=
=20
> those people if I can an figure out what needs to be done to make this=20
> library a reality.=20
>
>

--=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/35a031e6-c62b-4fdc-9206-2c213567e097%40isocpp.or=
g.

------=_Part_3786_342866607.1465289989791
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Dear all,<div><br></div><div>I&#39;ve been programming aud=
io for almost 20 years now, and just the other day started thinking of doin=
g a C++ based basic audio API meeting my needs. So this is a very interesti=
ng topic indeed to me. I&#39;ve done parts of Portaudio library (WDM/KS Wav=
eRT) and the WASAPI Exclusive mode port of JUCE, hopefully I can be of some=
 use :)</div><div><br></div><div>Some additional features I&#39;d like to s=
ee, not sure if they&#39;ve been addressed:</div><div>- &quot;Hotplugging&q=
uot;, i.e. the possibility to receive notifications when devices are insert=
ed/removed, and handle this gracefully.</div><div>- Timestamp for callbacks=
, flags for input overflow and output underflow.</div><div><br></div><div>R=
egards</div><div>/Robert</div><div><br>Den l=C3=B6rdag 4 juni 2016 kl. 03:4=
7:29 UTC+2 skrev alexande...@gmail.com:<blockquote class=3D"gmail_quote" st=
yle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-lef=
t: 1ex;">On Friday, June 3, 2016 at 8:30:49 PM UTC-5, Jeffrey Yasskin wrote=
:
<br>&gt; On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira &lt;<a>thi...@maci=
eira.org</a>&gt; wrote:
<br>&gt; On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wr=
ote:
<br>&gt;=20
<br>&gt; &gt; What is needed is a standardized interface for these differen=
t modules
<br>&gt;=20
<br>&gt; &gt; to work with each other. The interface should also allow me, =
the
<br>&gt;=20
<br>&gt; &gt; developer, to work with the media (e.g. create my own audio o=
r image
<br>&gt;=20
<br>&gt; &gt; filter or a new codec or a new device driver).
<br>&gt;=20
<br>&gt;=20
<br>&gt;=20
<br>&gt; That I agree with.
<br>&gt;=20
<br>&gt;=20
<br>&gt;=20
<br>&gt; But should the standard mandate that there should be at least one?=
 How does
<br>&gt;=20
<br>&gt; someone write a plugin to the C++ Standard Library? Will we now ma=
ndate this
<br>&gt;=20
<br>&gt; kind of ability?
<br>&gt;=20
<br>&gt;=20
<br>&gt;=20
<br>&gt; Yes. We already do this with things like the random engines.
<br>&gt;=20
<br>&gt;=20
<br>&gt; If not, then will there be a requirement that the C++ library vend=
or provide
<br>&gt;=20
<br>&gt; it? If so, please think carefully how Apple should code libc++ to =
work on iOS.
<br>&gt;=20
<br>&gt;=20
<br>&gt;=20
<br>&gt; WebCrypto has an example of=C2=A0navigating a legal minefield for =
implementers.
<br>&gt;=20
<br>&gt;=20
<br>&gt;=20
<br>&gt; Also remember to leave the legal speculation to lawyers. It&#39;s =
good to have the heads-up that &quot;hey lawyers should look at this&quot;,=
 but anything more is unwise.
<br>&gt;=20
<br>&gt;=20
<br>&gt; Again, I think this is not material for the C++ Standard Library.
<br>&gt;=20
<br>&gt;=20
<br>&gt; I think it&#39;s a great area for the C++ library to expand into. =
I&#39;m definitely worried about the expertise of the people writing the pr=
oposal (e.g. if I proposed an audio library for C++, I should be laughed of=
f the stage), but we can overcome that by asking well-known audio users for=
 their opinions before standardizing the proposal.
<br>&gt;=20
<br>&gt;=20
<br>&gt; Jeffrey
<br>
<br>I agree about the issue of expertise. By no means would I call myself a=
n expert, but I have a degree in audio engineering and a pretty solid grasp=
 of the c++ language. Are there people out there more skilled than me at ea=
ch topic? Of course, but that&#39;s why I am here, to get the opinions of t=
hose people if I can an figure out what needs to be done to make this libra=
ry a reality.=20
<br>
<br></blockquote></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/35a031e6-c62b-4fdc-9206-2c213567e097%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/35a031e6-c62b-4fdc-9206-2c213567e097=
%40isocpp.org</a>.<br />

------=_Part_3786_342866607.1465289989791--

------=_Part_3785_1957277192.1465289989791--

.


Author: Ross Bencina <ross.bencina@gmail.com>
Date: Thu, 9 Jun 2016 09:07:29 -0700 (PDT)
Raw View
------=_Part_133_45814346.1465488449899
Content-Type: multipart/alternative;
 boundary="----=_Part_134_1923840484.1465488449900"

------=_Part_134_1923840484.1465488449900
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hello Everyone,

I've been involved with PortAudio since the beginning. PortAudio supports=
=20
10+ audio APIs. I didn't write all the implementations myself, but I've=20
worked with the people who did. I use C++ almost daily and have been=20
lurking in [sg14] recently. Although I'm not a modern C++ guru, I can offer=
=20
some insights about the API and requirements. In particular things that=20
PortAudio doesn't do (or doesn't do very well).

Here's a bit of a braindump:

- The streams (read(), write()) model is problematic if you want to do=20
synchronous input/output (i.e. audio processing, or some forms of echo=20
cancellation). The problem is that there is no explicit notion of time that=
=20
can be used to synchronize input and output buffers. In PortAudio we offer=
=20
both streams and callback. Most modern native APIs use callbacks or=20
something equivalent. There are arguments for streams too, I'm don't=20
remember them.

- Enumerating capabilities is a can of worms. There is a wide variety of=20
capability managment systems out there. Some of the challenges include:=20
slow speed of accessing native device information, non-orthogonal formats=
=20
of device information, non-observable constraints between device=20
capabilities (e.g. this device supports 96k, but only in stereo, 44k 8=20
channel is ok though!).

- You may want to clarify who this API is targeted at. (Will it support Pro=
=20
Audio?)

- A model of time seems to be lacking from the current proposal. There=20
should be a way to correlate input/output samples with a system monotonic=
=20
clock. This means you also need to be able to provide latency information.

- Periodicity of callbacks (or not) and fraction of total callback period=
=20
that can be consumed should be documented.

- Concurrency issues need to be clearly documented. For example, it should=
=20
be expressly prohibited from using blocking synchronisation primitives in=
=20
an audio callback. See=20
e.g. http://www.rossbencina.com/code/real-time-audio-programming-101-time-w=
aits-for-nothing

- There needs to be some mechanism to signal asynchronous failures (common=
=20
for example on OS X where the audio subsystem can reconfigure itself while=
=20
audio is playing back).

- Latency control (most APIs provide support for adjusting buffer sizes,=20
and many also have different modes for low/high latency applications, e.g.=
=20
bypass high-latency mixing).

- Robert already mentioned hot-plug. This is a must-have feature these days=
=20
(although PortAudio doesn't yet support it)

At a minimum I recommend reviewing the documentation for PortAudio,=20
CoreAudio, WASAPI, ALSA and JACK to make sure that you have all of the=20
domain elements.

A while ago I compiled some notes on buffering models in different audio=20
APIs, it might be useful:
https://www.assembla.com/wiki/show/portaudio/BufferingLatencyAndTimingImple=
mentationGuidelines

Unfortunately, right now I don't have time to participate much in this=20
discussion due to deadlines. But if this proposal is serious, if someone=20
would like to send me drafts for review (to rossb@audiomulch.com), I'm=20
happy to give feedback.

As an idea: you could consider building a demonstration implementation on=
=20
top of PortAudio (either starting from our existing C++ binding, or from=20
scratch).

Kind Regards,

Ross.



On Saturday, June 4, 2016 at 2:04:21 PM UTC+10, alexande...@gmail.com wrote=
:
>
> I have drafted up a list of basic definitions about how audio could be=20
> represented based on your comment here. I think if we are to attempt to=
=20
> move forward a consensus must be reached about the fundamental=20
> representation of audio data the library will take.=20
>
> C++ std::audio library
>
> theory and definitions:
>
>     sample:
>     a single sample of audio data.
>     can be represented by a signed integer, float or double.
>     must pass the following test to be a valid sample type:
>         ((std::is_integral<T>::value && std::is_signed<T>::value) ||=20
> std::is_floating_point<T>::value) =3D=3D true
>     or could be constrained by:
>          std::is_arithmetic<T>::value=3D=3Dtrue
>      if unsigned samples are allowed/desired
>
>     frame:
>     a collection of 0-N samples
>     each sample represents an individual channel of audio data
>     indexable as an array
>     (should N be runtime or compile time?)
>
>     buffer:
>     a collection of 0-N frames
>     indexable as an array
>     (should N be runtime or compile time?)
>     ideally maintains a continous piece of memory to house its frames
>
>     device /interface:
>     a device recognized by the system as being capable of reading and=20
> writing audio data
>     can be polled for information regarding the capabilities of the=20
> device/interface
>
>
>     audio callback:
>     a function/lambda/functor registered with the library to be called=20
> once per buffer interval
>
>     sampling rate: the number of samples per second of audio data
>
>     frame interval: the length of a frame in seconds (1.0/sample_rate)
>     buffer interval: the length of a buffer in seconds (frame_interval*=
=20
> buffer_size)
>
> What should be added/removed/edited or clarified?
>
>
> On Friday, June 3, 2016 at 9:11:26 PM UTC-5, Ron wrote:
>>
>> Okay, I've done some thinking here.  The simplest solution should be the=
=20
>> correct one.  I think the standard should stick to something very basic=
=20
>> here, otherwise we get into an area that is too complicated to implement=
.. =20
>> All we should have in terms of a standard audio interface for C++ is:
>>
>> 1) A method for enumerating the interfaces on a machine.
>> 2) A method for getting each interfaces capabilities (supported rates,=
=20
>> bit depths etc.).
>> 3) A method for activating a requested device for sending and receiving=
=20
>> frames in the requested format.
>>
>> Valid types for audio samples should be either a signed integer, a float=
=20
>> or a double.  And that's pretty much it.  Get audio input, put audio=20
>> output.  Anything other than that would be a different proposal all=20
>> together.  Audio, video or DSP processing in general should certainly be=
 a=20
>> different proposal.
>>
>> But I would propose we also add an int24_t class into the standard for=
=20
>> processing 24-bit samples.  Something as simple as this would suffice fo=
r=20
>> now:
>> class int24_t
>> {
>> private:
>>     int8_t val[3];
>> };
>>
>> Something more fully featured would be desirable, like this:=20
>> https://github.com/RonNovy/CppDSP/blob/master/src/int24_t.h
>> But I guess that, would be another proposal.
>>
>> On Fri, Jun 3, 2016 at 6:47 PM, <alexande...@gmail.com> wrote:
>>
>>> On Friday, June 3, 2016 at 8:30:49 PM UTC-5, Jeffrey Yasskin wrote:
>>> > On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira <thi...@macieira.org>=
=20
>>> wrote:
>>> > On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote=
:
>>> >
>>> > > What is needed is a standardized interface for these different=20
>>> modules
>>> >
>>> > > to work with each other. The interface should also allow me, the
>>> >
>>> > > developer, to work with the media (e.g. create my own audio or imag=
e
>>> >
>>> > > filter or a new codec or a new device driver).
>>> >
>>> >
>>> >
>>> > That I agree with.
>>> >
>>> >
>>> >
>>> > But should the standard mandate that there should be at least one? Ho=
w=20
>>> does
>>> >
>>> > someone write a plugin to the C++ Standard Library? Will we now=20
>>> mandate this
>>> >
>>> > kind of ability?
>>> >
>>> >
>>> >
>>> > Yes. We already do this with things like the random engines.
>>> >
>>> >
>>> > If not, then will there be a requirement that the C++ library vendor=
=20
>>> provide
>>> >
>>> > it? If so, please think carefully how Apple should code libc++ to wor=
k=20
>>> on iOS.
>>> >
>>> >
>>> >
>>> > WebCrypto has an example of navigating a legal minefield for=20
>>> implementers.
>>> >
>>> >
>>> >
>>> > Also remember to leave the legal speculation to lawyers. It's good to=
=20
>>> have the heads-up that "hey lawyers should look at this", but anything =
more=20
>>> is unwise.
>>> >
>>> >
>>> > Again, I think this is not material for the C++ Standard Library.
>>> >
>>> >
>>> > I think it's a great area for the C++ library to expand into. I'm=20
>>> definitely worried about the expertise of the people writing the propos=
al=20
>>> (e.g. if I proposed an audio library for C++, I should be laughed off t=
he=20
>>> stage), but we can overcome that by asking well-known audio users for t=
heir=20
>>> opinions before standardizing the proposal.
>>> >
>>> >
>>> > Jeffrey
>>>
>>> I agree about the issue of expertise. By no means would I call myself a=
n=20
>>> expert, but I have a degree in audio engineering and a pretty solid gra=
sp=20
>>> of the c++ language. Are there people out there more skilled than me at=
=20
>>> each topic? Of course, but that's why I am here, to get the opinions of=
=20
>>> those people if I can an figure out what needs to be done to make this=
=20
>>> library a reality.
>>>
>>> --
>>> You received this message because you are subscribed to the Google=20
>>> Groups "ISO C++ Standard - Future Proposals" group.
>>> To unsubscribe from this group and stop receiving emails from it, send=
=20
>>> an email to std-proposal...@isocpp.org.
>>> To post to this group, send email to std-pr...@isocpp.org.
>>> To view this discussion on the web visit=20
>>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/62b7649a-5=
de5-4330-9bac-708375d36e2c%40isocpp.org
>>> .
>>>
>>
>>

--=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/4922d8b8-7909-44a2-a24f-8dcf4090911f%40isocpp.or=
g.

------=_Part_134_1923840484.1465488449900
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello Everyone,<div><br></div><div>I&#39;ve been involved =
with PortAudio since the beginning. PortAudio supports 10+ audio APIs. I di=
dn&#39;t write all the implementations myself, but I&#39;ve worked with the=
 people who did. I use C++ almost daily and have been lurking in [sg14] rec=
ently. Although I&#39;m not a modern C++ guru, I can offer some insights ab=
out the API and requirements. In particular things that PortAudio doesn&#39=
;t do (or doesn&#39;t do very well).</div><div><br></div><div>Here&#39;s a =
bit of a braindump:</div><div><br></div><div>- The streams (read(), write()=
) model is problematic if you want to do synchronous input/output (i.e. aud=
io processing, or some forms of echo cancellation). The problem is that the=
re is no explicit notion of time that can be used to synchronize input and =
output buffers. In PortAudio we offer both streams and callback. Most moder=
n native APIs use callbacks or something equivalent. There are arguments fo=
r streams too, I&#39;m don&#39;t remember them.</div><div><br></div><div>- =
Enumerating capabilities is a can of worms. There is a wide variety of capa=
bility managment systems out there. Some of the challenges include: slow sp=
eed of accessing native device information, non-orthogonal formats of devic=
e information, non-observable constraints between device capabilities (e.g.=
 this device supports 96k, but only in stereo, 44k 8 channel is ok though!)=
..</div><div><br></div><div>- You may want to clarify who this API is target=
ed at. (Will it support Pro Audio?)</div><div><br></div><div>- A model of t=
ime seems to be lacking from the current proposal. There should be a way to=
 correlate input/output samples with a system monotonic clock. This means y=
ou also need to be able to provide latency information.</div><div><br></div=
><div>- Periodicity of callbacks (or not) and fraction of total callback pe=
riod that can be consumed should be documented.</div><div><br></div><div>- =
Concurrency issues need to be clearly documented. For example, it should be=
 expressly prohibited from using blocking synchronisation primitives in an =
audio callback. See e.g.=C2=A0http://www.rossbencina.com/code/real-time-aud=
io-programming-101-time-waits-for-nothing</div><div><br></div><div>- There =
needs to be some mechanism to signal asynchronous failures (common for exam=
ple on OS X where the audio subsystem can reconfigure itself while audio is=
 playing back).</div><div><br></div><div>- Latency control (most APIs provi=
de support for adjusting buffer sizes, and many also have different modes f=
or low/high latency applications, e.g. bypass high-latency mixing).</div><d=
iv><br></div><div>- Robert already mentioned hot-plug. This is a must-have =
feature these days (although PortAudio doesn&#39;t yet support it)</div><di=
v><br></div><div>At a minimum I recommend reviewing the documentation for P=
ortAudio, CoreAudio, WASAPI, ALSA and JACK to make sure that you have all o=
f the domain elements.</div><div><br></div><div>A while ago I compiled some=
 notes on buffering models in different audio APIs, it might be useful:</di=
v><div>https://www.assembla.com/wiki/show/portaudio/BufferingLatencyAndTimi=
ngImplementationGuidelines<br></div><div><br></div><div>Unfortunately, righ=
t now I don&#39;t have time to participate much in this discussion due to d=
eadlines. But if this proposal is serious, if someone would like to send me=
 drafts for review (to rossb@audiomulch.com), I&#39;m happy to give feedbac=
k.</div><div><br></div><div>As an idea: you could consider building a demon=
stration implementation on top of PortAudio (either starting from our exist=
ing C++ binding, or from scratch).</div><div><br></div><div>Kind Regards,</=
div><div><br></div><div>Ross.</div><div><br></div><div><br><br>On Saturday,=
 June 4, 2016 at 2:04:21 PM UTC+10, alexande...@gmail.com wrote:<blockquote=
 class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1=
px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">I have drafted up a list=
 of basic definitions about how audio could be represented based on your co=
mment here. I think if we are to attempt to move forward a consensus must b=
e reached about the fundamental representation of audio data the library wi=
ll take. <br><br><div style=3D"text-align:center">C++ std::audio library<br=
><br>theory and definitions:<br><br>=C2=A0=C2=A0=C2=A0 sample:<br>=C2=A0=C2=
=A0=C2=A0 a single sample of audio data.<br>=C2=A0=C2=A0=C2=A0 can be repre=
sented by a signed integer, float or double.<br>=C2=A0=C2=A0=C2=A0 must pas=
s the following test to be a valid sample type:<br>=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 ((std::is_integral&lt;T&gt;::value &amp;&amp; std::is_si=
gned&lt;T&gt;::value) || std::is_floating_point&lt;T&gt;::<wbr>value) =3D=
=3D true<br>=C2=A0=C2=A0=C2=A0 or could be constrained by:<br>=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 std::is_arithmetic&lt;T&gt;::value=3D=
=3D<wbr>true<br>=C2=A0=C2=A0=C2=A0=C2=A0 if unsigned samples are allowed/de=
sired<br><br>=C2=A0=C2=A0=C2=A0 frame:<br>=C2=A0=C2=A0=C2=A0 a collection o=
f 0-N samples<br>=C2=A0=C2=A0=C2=A0 each sample represents an individual ch=
annel of audio data<br>=C2=A0=C2=A0=C2=A0 indexable as an array<br>=C2=A0=
=C2=A0=C2=A0 (should N be runtime or compile time?)<br><br>=C2=A0=C2=A0=C2=
=A0 buffer:<br>=C2=A0=C2=A0=C2=A0 a collection of 0-N frames<br>=C2=A0=C2=
=A0=C2=A0 indexable as an array<br>=C2=A0=C2=A0=C2=A0 (should N be runtime =
or compile time?)<br>=C2=A0=C2=A0=C2=A0 ideally maintains a continous piece=
 of memory to house its frames<br><br>=C2=A0=C2=A0=C2=A0 device /interface:=
<br>=C2=A0=C2=A0=C2=A0 a device recognized by the system as being capable o=
f reading and writing audio data<br>=C2=A0=C2=A0=C2=A0 can be polled for in=
formation regarding the capabilities of the device/interface<br><br><br>=C2=
=A0=C2=A0=C2=A0 audio callback:<br>=C2=A0=C2=A0=C2=A0 a function/lambda/fun=
ctor registered with the library to be called once per buffer interval<br><=
br>=C2=A0=C2=A0=C2=A0 sampling rate: the number of samples per second of au=
dio data<br><br>=C2=A0=C2=A0=C2=A0 frame interval: the length of a frame in=
 seconds (1.0/sample_rate)<br>=C2=A0=C2=A0=C2=A0 buffer interval: the lengt=
h of a buffer in seconds (frame_interval* buffer_size)<br><br><div style=3D=
"text-align:left">What should be added/removed/edited or clarified?<br></di=
v></div><br><br>On Friday, June 3, 2016 at 9:11:26 PM UTC-5, Ron wrote:<blo=
ckquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-le=
ft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Okay, I&#39;ve do=
ne some thinking here.=C2=A0 The simplest solution should be the correct on=
e.=C2=A0 I think the standard should stick to something very basic here, ot=
herwise we get into an area that is too complicated to implement.=C2=A0 All=
 we should have in terms of a standard audio interface for C++ is:</div><di=
v><br></div><div>1) A method for enumerating the interfaces on a machine.</=
div><div>2) A method for getting each interfaces capabilities (supported ra=
tes, bit depths etc.).</div><div>3) A method for activating a requested dev=
ice for sending and receiving frames in the requested format.</div><div><br=
></div><div>Valid types for audio samples should be either a signed integer=
, a float or a double.=C2=A0 And that&#39;s pretty much it.=C2=A0 Get audio=
 input, put audio output.=C2=A0 Anything other than that would be a differe=
nt proposal all together.=C2=A0 Audio, video or DSP processing in general s=
hould certainly be a different proposal.</div><div><br></div><div>But I wou=
ld propose we also add an int24_t class into the standard for processing 24=
-bit samples.=C2=A0 Something as simple as this would suffice for now:</div=
><div>class int24_t</div><div>{</div><div>private:</div><div>=C2=A0 =C2=A0 =
int8_t val[3];</div><div>};</div><div><br></div><div>Something more fully f=
eatured would be desirable, like this: <a href=3D"https://github.com/RonNov=
y/CppDSP/blob/master/src/int24_t.h" rel=3D"nofollow" target=3D"_blank" onmo=
usedown=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fg=
ithub.com%2FRonNovy%2FCppDSP%2Fblob%2Fmaster%2Fsrc%2Fint24_t.h\x26sa\x3dD\x=
26sntz\x3d1\x26usg\x3dAFQjCNH43AqVQTU-hwL7G8EiOcSTbZPweA&#39;;return true;"=
 onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2F=
github.com%2FRonNovy%2FCppDSP%2Fblob%2Fmaster%2Fsrc%2Fint24_t.h\x26sa\x3dD\=
x26sntz\x3d1\x26usg\x3dAFQjCNH43AqVQTU-hwL7G8EiOcSTbZPweA&#39;;return true;=
">https://github.com/RonNovy/<wbr>CppDSP/blob/master/src/int24_<wbr>t.h</a>=
</div><div>But I guess that, would be another proposal.</div></div><div><br=
><div class=3D"gmail_quote">On Fri, Jun 3, 2016 at 6:47 PM,  <span dir=3D"l=
tr">&lt;<a rel=3D"nofollow">alexande...@gmail.com</a>&gt;</span> wrote:<br>=
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">On Friday, June 3, 2016 at 8:30:49 PM UTC-5,=
 Jeffrey Yasskin wrote:<br>
<span>&gt; On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira &lt;<a>thi...@ma=
cieira.org</a>&gt; wrote:<br>
&gt; On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:=
<br>
&gt;<br>
&gt; &gt; What is needed is a standardized interface for these different mo=
dules<br>
&gt;<br>
&gt; &gt; to work with each other. The interface should also allow me, the<=
br>
&gt;<br>
&gt; &gt; developer, to work with the media (e.g. create my own audio or im=
age<br>
&gt;<br>
&gt; &gt; filter or a new codec or a new device driver).<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; That I agree with.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; But should the standard mandate that there should be at least one? How=
 does<br>
&gt;<br>
&gt; someone write a plugin to the C++ Standard Library? Will we now mandat=
e this<br>
&gt;<br>
&gt; kind of ability?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Yes. We already do this with things like the random engines.<br>
&gt;<br>
&gt;<br>
&gt; If not, then will there be a requirement that the C++ library vendor p=
rovide<br>
&gt;<br>
&gt; it? If so, please think carefully how Apple should code libc++ to work=
 on iOS.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; WebCrypto has an example of=C2=A0navigating a legal minefield for impl=
ementers.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Also remember to leave the legal speculation to lawyers. It&#39;s good=
 to have the heads-up that &quot;hey lawyers should look at this&quot;, but=
 anything more is unwise.<br>
&gt;<br>
&gt;<br>
&gt; Again, I think this is not material for the C++ Standard Library.<br>
&gt;<br>
&gt;<br>
&gt; I think it&#39;s a great area for the C++ library to expand into. I&#3=
9;m definitely worried about the expertise of the people writing the propos=
al (e.g. if I proposed an audio library for C++, I should be laughed off th=
e stage), but we can overcome that by asking well-known audio users for the=
ir opinions before standardizing the proposal.<br>
&gt;<br>
&gt;<br>
&gt; Jeffrey<br>
<br>
</span>I agree about the issue of expertise. By no means would I call mysel=
f an expert, but I have a degree in audio engineering and a pretty solid gr=
asp of the c++ language. Are there people out there more skilled than me at=
 each topic? Of course, but that&#39;s why I am here, to get the opinions o=
f those people if I can an figure out what needs to be done to make this li=
brary a reality.<br>
<span><br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a rel=3D"nofollow">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow">std-pr...@isocpp.o=
rg</a>.<br>
</span>To view this discussion on the web visit <a href=3D"https://groups.g=
oogle.com/a/isocpp.org/d/msgid/std-proposals/62b7649a-5de5-4330-9bac-708375=
d36e2c%40isocpp.org" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this=
..href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/6=
2b7649a-5de5-4330-9bac-708375d36e2c%40isocpp.org&#39;;return true;" onclick=
=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/std-pro=
posals/62b7649a-5de5-4330-9bac-708375d36e2c%40isocpp.org&#39;;return true;"=
>https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/62b=
7649a-5de5-4330-<wbr>9bac-708375d36e2c%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></div>
</blockquote></div></blockquote></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/4922d8b8-7909-44a2-a24f-8dcf4090911f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/4922d8b8-7909-44a2-a24f-8dcf4090911f=
%40isocpp.org</a>.<br />

------=_Part_134_1923840484.1465488449900--

------=_Part_133_45814346.1465488449899--

.


Author: alexander.zywicki@gmail.com
Date: Thu, 9 Jun 2016 19:26:36 -0700 (PDT)
Raw View
------=_Part_1517_1134889615.1465525596934
Content-Type: multipart/alternative;
 boundary="----=_Part_1518_1894493109.1465525596935"

------=_Part_1518_1894493109.1465525596935
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Do you have any suggestions as far as an explicit notion of time should be=
=20
in this context?

On Thursday, June 9, 2016 at 11:07:29 AM UTC-5, Ross Bencina wrote:
>
> Hello Everyone,
>
> I've been involved with PortAudio since the beginning. PortAudio supports=
=20
> 10+ audio APIs. I didn't write all the implementations myself, but I've=
=20
> worked with the people who did. I use C++ almost daily and have been=20
> lurking in [sg14] recently. Although I'm not a modern C++ guru, I can off=
er=20
> some insights about the API and requirements. In particular things that=
=20
> PortAudio doesn't do (or doesn't do very well).
>
> Here's a bit of a braindump:
>
> - The streams (read(), write()) model is problematic if you want to do=20
> synchronous input/output (i.e. audio processing, or some forms of echo=20
> cancellation). The problem is that there is no explicit notion of time th=
at=20
> can be used to synchronize input and output buffers. In PortAudio we offe=
r=20
> both streams and callback. Most modern native APIs use callbacks or=20
> something equivalent. There are arguments for streams too, I'm don't=20
> remember them.
>
> - Enumerating capabilities is a can of worms. There is a wide variety of=
=20
> capability managment systems out there. Some of the challenges include:=
=20
> slow speed of accessing native device information, non-orthogonal formats=
=20
> of device information, non-observable constraints between device=20
> capabilities (e.g. this device supports 96k, but only in stereo, 44k 8=20
> channel is ok though!).
>
> - You may want to clarify who this API is targeted at. (Will it support=
=20
> Pro Audio?)
>
> - A model of time seems to be lacking from the current proposal. There=20
> should be a way to correlate input/output samples with a system monotonic=
=20
> clock. This means you also need to be able to provide latency information=
..
>
> - Periodicity of callbacks (or not) and fraction of total callback period=
=20
> that can be consumed should be documented.
>
> - Concurrency issues need to be clearly documented. For example, it shoul=
d=20
> be expressly prohibited from using blocking synchronisation primitives in=
=20
> an audio callback. See e.g.=20
> http://www.rossbencina.com/code/real-time-audio-programming-101-time-wait=
s-for-nothing
>
> - There needs to be some mechanism to signal asynchronous failures (commo=
n=20
> for example on OS X where the audio subsystem can reconfigure itself whil=
e=20
> audio is playing back).
>
> - Latency control (most APIs provide support for adjusting buffer sizes,=
=20
> and many also have different modes for low/high latency applications, e.g=
..=20
> bypass high-latency mixing).
>
> - Robert already mentioned hot-plug. This is a must-have feature these=20
> days (although PortAudio doesn't yet support it)
>
> At a minimum I recommend reviewing the documentation for PortAudio,=20
> CoreAudio, WASAPI, ALSA and JACK to make sure that you have all of the=20
> domain elements.
>
> A while ago I compiled some notes on buffering models in different audio=
=20
> APIs, it might be useful:
>
> https://www.assembla.com/wiki/show/portaudio/BufferingLatencyAndTimingImp=
lementationGuidelines
>
> Unfortunately, right now I don't have time to participate much in this=20
> discussion due to deadlines. But if this proposal is serious, if someone=
=20
> would like to send me drafts for review (to ro...@audiomulch.com=20
> <javascript:>), I'm happy to give feedback.
>
> As an idea: you could consider building a demonstration implementation on=
=20
> top of PortAudio (either starting from our existing C++ binding, or from=
=20
> scratch).
>
> Kind Regards,
>
> Ross.
>
>
>
> On Saturday, June 4, 2016 at 2:04:21 PM UTC+10, alexande...@gmail.com=20
> wrote:
>>
>> I have drafted up a list of basic definitions about how audio could be=
=20
>> represented based on your comment here. I think if we are to attempt to=
=20
>> move forward a consensus must be reached about the fundamental=20
>> representation of audio data the library will take.=20
>>
>> C++ std::audio library
>>
>> theory and definitions:
>>
>>     sample:
>>     a single sample of audio data.
>>     can be represented by a signed integer, float or double.
>>     must pass the following test to be a valid sample type:
>>         ((std::is_integral<T>::value && std::is_signed<T>::value) ||=20
>> std::is_floating_point<T>::value) =3D=3D true
>>     or could be constrained by:
>>          std::is_arithmetic<T>::value=3D=3Dtrue
>>      if unsigned samples are allowed/desired
>>
>>     frame:
>>     a collection of 0-N samples
>>     each sample represents an individual channel of audio data
>>     indexable as an array
>>     (should N be runtime or compile time?)
>>
>>     buffer:
>>     a collection of 0-N frames
>>     indexable as an array
>>     (should N be runtime or compile time?)
>>     ideally maintains a continous piece of memory to house its frames
>>
>>     device /interface:
>>     a device recognized by the system as being capable of reading and=20
>> writing audio data
>>     can be polled for information regarding the capabilities of the=20
>> device/interface
>>
>>
>>     audio callback:
>>     a function/lambda/functor registered with the library to be called=
=20
>> once per buffer interval
>>
>>     sampling rate: the number of samples per second of audio data
>>
>>     frame interval: the length of a frame in seconds (1.0/sample_rate)
>>     buffer interval: the length of a buffer in seconds (frame_interval*=
=20
>> buffer_size)
>>
>> What should be added/removed/edited or clarified?
>>
>>
>> On Friday, June 3, 2016 at 9:11:26 PM UTC-5, Ron wrote:
>>>
>>> Okay, I've done some thinking here.  The simplest solution should be th=
e=20
>>> correct one.  I think the standard should stick to something very basic=
=20
>>> here, otherwise we get into an area that is too complicated to implemen=
t. =20
>>> All we should have in terms of a standard audio interface for C++ is:
>>>
>>> 1) A method for enumerating the interfaces on a machine.
>>> 2) A method for getting each interfaces capabilities (supported rates,=
=20
>>> bit depths etc.).
>>> 3) A method for activating a requested device for sending and receiving=
=20
>>> frames in the requested format.
>>>
>>> Valid types for audio samples should be either a signed integer, a floa=
t=20
>>> or a double.  And that's pretty much it.  Get audio input, put audio=20
>>> output.  Anything other than that would be a different proposal all=20
>>> together.  Audio, video or DSP processing in general should certainly b=
e a=20
>>> different proposal.
>>>
>>> But I would propose we also add an int24_t class into the standard for=
=20
>>> processing 24-bit samples.  Something as simple as this would suffice f=
or=20
>>> now:
>>> class int24_t
>>> {
>>> private:
>>>     int8_t val[3];
>>> };
>>>
>>> Something more fully featured would be desirable, like this:=20
>>> https://github.com/RonNovy/CppDSP/blob/master/src/int24_t.h
>>> But I guess that, would be another proposal.
>>>
>>> On Fri, Jun 3, 2016 at 6:47 PM, <alexande...@gmail.com> wrote:
>>>
>>>> On Friday, June 3, 2016 at 8:30:49 PM UTC-5, Jeffrey Yasskin wrote:
>>>> > On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira <thi...@macieira.org=
>=20
>>>> wrote:
>>>> > On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrot=
e:
>>>> >
>>>> > > What is needed is a standardized interface for these different=20
>>>> modules
>>>> >
>>>> > > to work with each other. The interface should also allow me, the
>>>> >
>>>> > > developer, to work with the media (e.g. create my own audio or ima=
ge
>>>> >
>>>> > > filter or a new codec or a new device driver).
>>>> >
>>>> >
>>>> >
>>>> > That I agree with.
>>>> >
>>>> >
>>>> >
>>>> > But should the standard mandate that there should be at least one?=
=20
>>>> How does
>>>> >
>>>> > someone write a plugin to the C++ Standard Library? Will we now=20
>>>> mandate this
>>>> >
>>>> > kind of ability?
>>>> >
>>>> >
>>>> >
>>>> > Yes. We already do this with things like the random engines.
>>>> >
>>>> >
>>>> > If not, then will there be a requirement that the C++ library vendor=
=20
>>>> provide
>>>> >
>>>> > it? If so, please think carefully how Apple should code libc++ to=20
>>>> work on iOS.
>>>> >
>>>> >
>>>> >
>>>> > WebCrypto has an example of navigating a legal minefield for=20
>>>> implementers.
>>>> >
>>>> >
>>>> >
>>>> > Also remember to leave the legal speculation to lawyers. It's good t=
o=20
>>>> have the heads-up that "hey lawyers should look at this", but anything=
 more=20
>>>> is unwise.
>>>> >
>>>> >
>>>> > Again, I think this is not material for the C++ Standard Library.
>>>> >
>>>> >
>>>> > I think it's a great area for the C++ library to expand into. I'm=20
>>>> definitely worried about the expertise of the people writing the propo=
sal=20
>>>> (e.g. if I proposed an audio library for C++, I should be laughed off =
the=20
>>>> stage), but we can overcome that by asking well-known audio users for =
their=20
>>>> opinions before standardizing the proposal.
>>>> >
>>>> >
>>>> > Jeffrey
>>>>
>>>> I agree about the issue of expertise. By no means would I call myself=
=20
>>>> an expert, but I have a degree in audio engineering and a pretty solid=
=20
>>>> grasp of the c++ language. Are there people out there more skilled tha=
n me=20
>>>> at each topic? Of course, but that's why I am here, to get the opinion=
s of=20
>>>> those people if I can an figure out what needs to be done to make this=
=20
>>>> library a reality.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google=20
>>>> Groups "ISO C++ Standard - Future Proposals" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send=
=20
>>>> an email to std-proposal...@isocpp.org.
>>>> To post to this group, send email to std-pr...@isocpp.org.
>>>> To view this discussion on the web visit=20
>>>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/62b7649a-=
5de5-4330-9bac-708375d36e2c%40isocpp.org
>>>> .
>>>>
>>>
>>>

--=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/fa20d105-71df-445b-a773-6de77ece5c09%40isocpp.or=
g.

------=_Part_1518_1894493109.1465525596935
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Do you have any suggestions as far as an explicit notion o=
f time should be in this context?<br><br>On Thursday, June 9, 2016 at 11:07=
:29 AM UTC-5, Ross Bencina wrote:<blockquote class=3D"gmail_quote" style=3D=
"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex=
;"><div dir=3D"ltr">Hello Everyone,<div><br></div><div>I&#39;ve been involv=
ed with PortAudio since the beginning. PortAudio supports 10+ audio APIs. I=
 didn&#39;t write all the implementations myself, but I&#39;ve worked with =
the people who did. I use C++ almost daily and have been lurking in [sg14] =
recently. Although I&#39;m not a modern C++ guru, I can offer some insights=
 about the API and requirements. In particular things that PortAudio doesn&=
#39;t do (or doesn&#39;t do very well).</div><div><br></div><div>Here&#39;s=
 a bit of a braindump:</div><div><br></div><div>- The streams (read(), writ=
e()) model is problematic if you want to do synchronous input/output (i.e. =
audio processing, or some forms of echo cancellation). The problem is that =
there is no explicit notion of time that can be used to synchronize input a=
nd output buffers. In PortAudio we offer both streams and callback. Most mo=
dern native APIs use callbacks or something equivalent. There are arguments=
 for streams too, I&#39;m don&#39;t remember them.</div><div><br></div><div=
>- Enumerating capabilities is a can of worms. There is a wide variety of c=
apability managment systems out there. Some of the challenges include: slow=
 speed of accessing native device information, non-orthogonal formats of de=
vice information, non-observable constraints between device capabilities (e=
..g. this device supports 96k, but only in stereo, 44k 8 channel is ok thoug=
h!).</div><div><br></div><div>- You may want to clarify who this API is tar=
geted at. (Will it support Pro Audio?)</div><div><br></div><div>- A model o=
f time seems to be lacking from the current proposal. There should be a way=
 to correlate input/output samples with a system monotonic clock. This mean=
s you also need to be able to provide latency information.</div><div><br></=
div><div>- Periodicity of callbacks (or not) and fraction of total callback=
 period that can be consumed should be documented.</div><div><br></div><div=
>- Concurrency issues need to be clearly documented. For example, it should=
 be expressly prohibited from using blocking synchronisation primitives in =
an audio callback. See e.g.=C2=A0<a href=3D"http://www.rossbencina.com/code=
/real-time-audio-programming-101-time-waits-for-nothing" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.google.com/url?=
q\x3dhttp%3A%2F%2Fwww.rossbencina.com%2Fcode%2Freal-time-audio-programming-=
101-time-waits-for-nothing\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEiQTtjJZ=
m1QlF2tcadXvNc5ajkwA&#39;;return true;" onclick=3D"this.href=3D&#39;http://=
www.google.com/url?q\x3dhttp%3A%2F%2Fwww.rossbencina.com%2Fcode%2Freal-time=
-audio-programming-101-time-waits-for-nothing\x26sa\x3dD\x26sntz\x3d1\x26us=
g\x3dAFQjCNEiQTtjJZm1QlF2tcadXvNc5ajkwA&#39;;return true;">http://www.rossb=
encina.<wbr>com/code/real-time-audio-<wbr>programming-101-time-waits-<wbr>f=
or-nothing</a></div><div><br></div><div>- There needs to be some mechanism =
to signal asynchronous failures (common for example on OS X where the audio=
 subsystem can reconfigure itself while audio is playing back).</div><div><=
br></div><div>- Latency control (most APIs provide support for adjusting bu=
ffer sizes, and many also have different modes for low/high latency applica=
tions, e.g. bypass high-latency mixing).</div><div><br></div><div>- Robert =
already mentioned hot-plug. This is a must-have feature these days (althoug=
h PortAudio doesn&#39;t yet support it)</div><div><br></div><div>At a minim=
um I recommend reviewing the documentation for PortAudio, CoreAudio, WASAPI=
, ALSA and JACK to make sure that you have all of the domain elements.</div=
><div><br></div><div>A while ago I compiled some notes on buffering models =
in different audio APIs, it might be useful:</div><div><a href=3D"https://w=
ww.assembla.com/wiki/show/portaudio/BufferingLatencyAndTimingImplementation=
Guidelines" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&=
#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.assembla.com%2Fwiki%2=
Fshow%2Fportaudio%2FBufferingLatencyAndTimingImplementationGuidelines\x26sa=
\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGLrqR0QGubBfC6cNMrwS-UPbzMjw&#39;;return=
 true;" onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3=
A%2F%2Fwww.assembla.com%2Fwiki%2Fshow%2Fportaudio%2FBufferingLatencyAndTimi=
ngImplementationGuidelines\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGLrqR0QG=
ubBfC6cNMrwS-UPbzMjw&#39;;return true;">https://www.assembla.com/wiki/<wbr>=
show/portaudio/<wbr>BufferingLatencyAndTimingImple<wbr>mentationGuidelines<=
/a><br></div><div><br></div><div>Unfortunately, right now I don&#39;t have =
time to participate much in this discussion due to deadlines. But if this p=
roposal is serious, if someone would like to send me drafts for review (to =
<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"cUvO891L=
BgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;ret=
urn true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;">ro...=
@audiomulch.com</a>), I&#39;m happy to give feedback.</div><div><br></div><=
div>As an idea: you could consider building a demonstration implementation =
on top of PortAudio (either starting from our existing C++ binding, or from=
 scratch).</div><div><br></div><div>Kind Regards,</div><div><br></div><div>=
Ross.</div><div><br></div><div><br><br>On Saturday, June 4, 2016 at 2:04:21=
 PM UTC+10, <a>alexande...@gmail.com</a> wrote:<blockquote class=3D"gmail_q=
uote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;paddin=
g-left:1ex"><div dir=3D"ltr">I have drafted up a list of basic definitions =
about how audio could be represented based on your comment here. I think if=
 we are to attempt to move forward a consensus must be reached about the fu=
ndamental representation of audio data the library will take. <br><br><div =
style=3D"text-align:center">C++ std::audio library<br><br>theory and defini=
tions:<br><br>=C2=A0=C2=A0=C2=A0 sample:<br>=C2=A0=C2=A0=C2=A0 a single sam=
ple of audio data.<br>=C2=A0=C2=A0=C2=A0 can be represented by a signed int=
eger, float or double.<br>=C2=A0=C2=A0=C2=A0 must pass the following test t=
o be a valid sample type:<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((s=
td::is_integral&lt;T&gt;::value &amp;&amp; std::is_signed&lt;T&gt;::value) =
|| std::is_floating_point&lt;T&gt;::<wbr>value) =3D=3D true<br>=C2=A0=C2=A0=
=C2=A0 or could be constrained by:<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 std::is_arithmetic&lt;T&gt;::value=3D=3D<wbr>true<br>=C2=A0=C2=
=A0=C2=A0=C2=A0 if unsigned samples are allowed/desired<br><br>=C2=A0=C2=A0=
=C2=A0 frame:<br>=C2=A0=C2=A0=C2=A0 a collection of 0-N samples<br>=C2=A0=
=C2=A0=C2=A0 each sample represents an individual channel of audio data<br>=
=C2=A0=C2=A0=C2=A0 indexable as an array<br>=C2=A0=C2=A0=C2=A0 (should N be=
 runtime or compile time?)<br><br>=C2=A0=C2=A0=C2=A0 buffer:<br>=C2=A0=C2=
=A0=C2=A0 a collection of 0-N frames<br>=C2=A0=C2=A0=C2=A0 indexable as an =
array<br>=C2=A0=C2=A0=C2=A0 (should N be runtime or compile time?)<br>=C2=
=A0=C2=A0=C2=A0 ideally maintains a continous piece of memory to house its =
frames<br><br>=C2=A0=C2=A0=C2=A0 device /interface:<br>=C2=A0=C2=A0=C2=A0 a=
 device recognized by the system as being capable of reading and writing au=
dio data<br>=C2=A0=C2=A0=C2=A0 can be polled for information regarding the =
capabilities of the device/interface<br><br><br>=C2=A0=C2=A0=C2=A0 audio ca=
llback:<br>=C2=A0=C2=A0=C2=A0 a function/lambda/functor registered with the=
 library to be called once per buffer interval<br><br>=C2=A0=C2=A0=C2=A0 sa=
mpling rate: the number of samples per second of audio data<br><br>=C2=A0=
=C2=A0=C2=A0 frame interval: the length of a frame in seconds (1.0/sample_r=
ate)<br>=C2=A0=C2=A0=C2=A0 buffer interval: the length of a buffer in secon=
ds (frame_interval* buffer_size)<br><br><div style=3D"text-align:left">What=
 should be added/removed/edited or clarified?<br></div></div><br><br>On Fri=
day, June 3, 2016 at 9:11:26 PM UTC-5, Ron wrote:<blockquote class=3D"gmail=
_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div dir=3D"ltr"><div>Okay, I&#39;ve done some thinking here.=
=C2=A0 The simplest solution should be the correct one.=C2=A0 I think the s=
tandard should stick to something very basic here, otherwise we get into an=
 area that is too complicated to implement.=C2=A0 All we should have in ter=
ms of a standard audio interface for C++ is:</div><div><br></div><div>1) A =
method for enumerating the interfaces on a machine.</div><div>2) A method f=
or getting each interfaces capabilities (supported rates, bit depths etc.).=
</div><div>3) A method for activating a requested device for sending and re=
ceiving frames in the requested format.</div><div><br></div><div>Valid type=
s for audio samples should be either a signed integer, a float or a double.=
=C2=A0 And that&#39;s pretty much it.=C2=A0 Get audio input, put audio outp=
ut.=C2=A0 Anything other than that would be a different proposal all togeth=
er.=C2=A0 Audio, video or DSP processing in general should certainly be a d=
ifferent proposal.</div><div><br></div><div>But I would propose we also add=
 an int24_t class into the standard for processing 24-bit samples.=C2=A0 So=
mething as simple as this would suffice for now:</div><div>class int24_t</d=
iv><div>{</div><div>private:</div><div>=C2=A0 =C2=A0 int8_t val[3];</div><d=
iv>};</div><div><br></div><div>Something more fully featured would be desir=
able, like this: <a href=3D"https://github.com/RonNovy/CppDSP/blob/master/s=
rc/int24_t.h" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=
=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FRonNovy%=
2FCppDSP%2Fblob%2Fmaster%2Fsrc%2Fint24_t.h\x26sa\x3dD\x26sntz\x3d1\x26usg\x=
3dAFQjCNH43AqVQTU-hwL7G8EiOcSTbZPweA&#39;;return true;" onclick=3D"this.hre=
f=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FRonNovy=
%2FCppDSP%2Fblob%2Fmaster%2Fsrc%2Fint24_t.h\x26sa\x3dD\x26sntz\x3d1\x26usg\=
x3dAFQjCNH43AqVQTU-hwL7G8EiOcSTbZPweA&#39;;return true;">https://github.com=
/RonNovy/<wbr>CppDSP/blob/master/src/int24_<wbr>t.h</a></div><div>But I gue=
ss that, would be another proposal.</div></div><div><br><div class=3D"gmail=
_quote">On Fri, Jun 3, 2016 at 6:47 PM,  <span dir=3D"ltr">&lt;<a rel=3D"no=
follow">alexande...@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D=
"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding=
-left:1ex">On Friday, June 3, 2016 at 8:30:49 PM UTC-5, Jeffrey Yasskin wro=
te:<br>
<span>&gt; On Fri, Jun 3, 2016 at 6:09 PM, Thiago Macieira &lt;<a>thi...@ma=
cieira.org</a>&gt; wrote:<br>
&gt; On s=C3=A1bado, 4 de junho de 2016 02:20:15 BRT Andrey Semashev wrote:=
<br>
&gt;<br>
&gt; &gt; What is needed is a standardized interface for these different mo=
dules<br>
&gt;<br>
&gt; &gt; to work with each other. The interface should also allow me, the<=
br>
&gt;<br>
&gt; &gt; developer, to work with the media (e.g. create my own audio or im=
age<br>
&gt;<br>
&gt; &gt; filter or a new codec or a new device driver).<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; That I agree with.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; But should the standard mandate that there should be at least one? How=
 does<br>
&gt;<br>
&gt; someone write a plugin to the C++ Standard Library? Will we now mandat=
e this<br>
&gt;<br>
&gt; kind of ability?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Yes. We already do this with things like the random engines.<br>
&gt;<br>
&gt;<br>
&gt; If not, then will there be a requirement that the C++ library vendor p=
rovide<br>
&gt;<br>
&gt; it? If so, please think carefully how Apple should code libc++ to work=
 on iOS.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; WebCrypto has an example of=C2=A0navigating a legal minefield for impl=
ementers.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Also remember to leave the legal speculation to lawyers. It&#39;s good=
 to have the heads-up that &quot;hey lawyers should look at this&quot;, but=
 anything more is unwise.<br>
&gt;<br>
&gt;<br>
&gt; Again, I think this is not material for the C++ Standard Library.<br>
&gt;<br>
&gt;<br>
&gt; I think it&#39;s a great area for the C++ library to expand into. I&#3=
9;m definitely worried about the expertise of the people writing the propos=
al (e.g. if I proposed an audio library for C++, I should be laughed off th=
e stage), but we can overcome that by asking well-known audio users for the=
ir opinions before standardizing the proposal.<br>
&gt;<br>
&gt;<br>
&gt; Jeffrey<br>
<br>
</span>I agree about the issue of expertise. By no means would I call mysel=
f an expert, but I have a degree in audio engineering and a pretty solid gr=
asp of the c++ language. Are there people out there more skilled than me at=
 each topic? Of course, but that&#39;s why I am here, to get the opinions o=
f those people if I can an figure out what needs to be done to make this li=
brary a reality.<br>
<span><br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a rel=3D"nofollow">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow">std-pr...@isocpp.o=
rg</a>.<br>
</span>To view this discussion on the web visit <a href=3D"https://groups.g=
oogle.com/a/isocpp.org/d/msgid/std-proposals/62b7649a-5de5-4330-9bac-708375=
d36e2c%40isocpp.org" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this=
..href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/6=
2b7649a-5de5-4330-9bac-708375d36e2c%40isocpp.org&#39;;return true;" onclick=
=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/std-pro=
posals/62b7649a-5de5-4330-9bac-708375d36e2c%40isocpp.org&#39;;return true;"=
>https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/62b=
7649a-5de5-4330-<wbr>9bac-708375d36e2c%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></div>
</blockquote></div></blockquote></div></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/fa20d105-71df-445b-a773-6de77ece5c09%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/fa20d105-71df-445b-a773-6de77ece5c09=
%40isocpp.org</a>.<br />

------=_Part_1518_1894493109.1465525596935--

------=_Part_1517_1134889615.1465525596934--

.


Author: Ron <rsn10100@gmail.com>
Date: Thu, 9 Jun 2016 20:05:08 -0700 (PDT)
Raw View
------=_Part_164_1362698527.1465527908885
Content-Type: multipart/alternative;
 boundary="----=_Part_165_936678792.1465527908885"

------=_Part_165_936678792.1465527908885
Content-Type: text/plain; charset=UTF-8


On Thursday, June 9, 2016 at 7:26:37 PM UTC-7, alexande...@gmail.com wrote:
>
> Do you have any suggestions as far as an explicit notion of time should be
> in this context?
>

As a suggestion, something I usually use is a start and end to the buffer
and the rate of the buffer.  Basically a class that has a value equal to
the start frame of the given buffer, a value equal to the end frame of the
buffer (or start of next frame) and a value equal to the frame rate.  So
you can derive a real for each, like start frames over frame rate and end
frame over frame rate.  From that you can get the seconds as a double or
long double.

class frame_ticks  // or some name that better describes this...
{
    uint64_t fstart;
    uint64_t fend;
    uint64_t frate;
    // ...
};

Allowing the start value to be set or reset on starting or stopping
record/playback is another feature that some might need here.  And I don't
recommend eliminating the rate portion from this class since it could lead
to trouble where people are making assumptions they shouldn't, best to have
them together.

Also, I would not add other data to this class since it could be re-used
elsewhere as is.  Other properties of a buffer can be defined in another
class/structure, but again this is just a suggestion...

--
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 email 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/f5465abe-f7e5-45c5-aa0b-92d5727bbfa6%40isocpp.org.

------=_Part_165_936678792.1465527908885
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br>On Thursday, June 9, 2016 at 7:26:37 PM UTC-7, alexand=
e...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;m=
argin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">Do you have any suggestions as far as an explicit notion of time s=
hould be in this context?</div></blockquote><div><br></div><span style=3D"f=
ont-family: arial, sans-serif; font-size: small;">As a suggestion, somethin=
g I usually use is a start and end to the buffer and the rate of the buffer=
.. =C2=A0Basically a class that has a value equal to the start frame of the =
given buffer, a value equal to the end frame of the buffer (or start of nex=
t frame) and a value equal to the frame rate. =C2=A0So you can derive a rea=
l for each, like start frames over frame rate and end frame over frame rate=
.. =C2=A0From that you can get the seconds as a double or long double.</span=
><div style=3D"font-family: arial, sans-serif; font-size: small;"><br></div=
><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); =
word-wrap: break-word; background-color: rgb(250, 250, 250);"><code class=
=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">class</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> frame_ticks =C2=A0</span><span style=3D"color: #8=
00;" class=3D"styled-by-prettify">// or some name that better describes thi=
s...</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 uin=
t64_t fstart</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 uint64_t fend</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br>=C2=A0 =C2=A0 uint64_t frate</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" cla=
ss=3D"styled-by-prettify">// ...</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">};</span></div></code></div><div><span style=3D"font-fami=
ly: arial, sans-serif; font-size: small;"><br></span></div><div><span style=
=3D"font-family: arial, sans-serif; font-size: small;">Allowing the start v=
alue to be set or reset on starting or stopping record/playback is another =
feature that some might need here. =C2=A0And </span><span style=3D"font-fam=
ily: arial, sans-serif; font-size: small;">I don&#39;t recommend eliminatin=
g the rate portion from this class since it could lead to trouble where peo=
ple are making assumptions they shouldn&#39;t, best to have them together.<=
/span></div><div><span style=3D"font-family: arial, sans-serif; font-size: =
small;"><br></span></div><div><span style=3D"font-family: arial, sans-serif=
; font-size: small;">Also, I would not add other data to this class since i=
t could be re-used elsewhere as is. =C2=A0Other properties of a buffer can =
be defined in another class/structure, but again this is just a suggestion.=
...</span></div><div><span style=3D"font-family: arial, sans-serif; font-siz=
e: small;"><br></span></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f5465abe-f7e5-45c5-aa0b-92d5727bbfa6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f5465abe-f7e5-45c5-aa0b-92d5727bbfa6=
%40isocpp.org</a>.<br />

------=_Part_165_936678792.1465527908885--

------=_Part_164_1362698527.1465527908885--

.


Author: alexander.zywicki@gmail.com
Date: Thu, 9 Jun 2016 21:17:17 -0700 (PDT)
Raw View
------=_Part_1592_2055356127.1465532237846
Content-Type: multipart/alternative;
 boundary="----=_Part_1593_382233223.1465532237846"

------=_Part_1593_382233223.1465532237846
Content-Type: text/plain; charset=UTF-8

So essentially it is a class that provides the needed data to calculate the
time in seconds a number of frames should take at a specified rate?

So:
int number_of_frames = fend - fstart;
double seconds_elapsed = number_of_frames/frate;

Am i understanding that correctly?


On Thursday, June 9, 2016 at 10:05:08 PM UTC-5, Ron wrote:
>
>
> On Thursday, June 9, 2016 at 7:26:37 PM UTC-7, alexande...@gmail.com
> wrote:
>>
>> Do you have any suggestions as far as an explicit notion of time should
>> be in this context?
>>
>
> As a suggestion, something I usually use is a start and end to the buffer
> and the rate of the buffer.  Basically a class that has a value equal to
> the start frame of the given buffer, a value equal to the end frame of the
> buffer (or start of next frame) and a value equal to the frame rate.  So
> you can derive a real for each, like start frames over frame rate and end
> frame over frame rate.  From that you can get the seconds as a double or
> long double.
>
> class frame_ticks  // or some name that better describes this...
> {
>     uint64_t fstart;
>     uint64_t fend;
>     uint64_t frate;
>     // ...
> };
>
> Allowing the start value to be set or reset on starting or stopping
> record/playback is another feature that some might need here.  And I
> don't recommend eliminating the rate portion from this class since it could
> lead to trouble where people are making assumptions they shouldn't, best to
> have them together.
>
> Also, I would not add other data to this class since it could be re-used
> elsewhere as is.  Other properties of a buffer can be defined in another
> class/structure, but again this is just a suggestion...
>
>

--
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 email 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/8e15e56a-73e1-452b-a564-b36aead468b8%40isocpp.org.

------=_Part_1593_382233223.1465532237846
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">So essentially it is a class that provides the needed data=
 to calculate the time in seconds a number of frames should take at a speci=
fied rate?<br><br>So:<br><div class=3D"prettyprint" style=3D"background-col=
or: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: sol=
id; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint">=
<div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-=
by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> number_of_frames </span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> fend </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">-</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> fstar=
t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">double</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> seconds_elapsed </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> number_of_frames</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">/</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">frate</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">;</span></div></code></div><br>Am=
 i understanding that correctly? <br><br><br>On Thursday, June 9, 2016 at 1=
0:05:08 PM UTC-5, Ron wrote:<blockquote class=3D"gmail_quote" style=3D"marg=
in: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><d=
iv dir=3D"ltr"><br>On Thursday, June 9, 2016 at 7:26:37 PM UTC-7, <a>alexan=
de...@gmail.com</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin=
:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr">Do you have any suggestions as far as an explicit notion of time s=
hould be in this context?</div></blockquote><div><br></div><span style=3D"f=
ont-family:arial,sans-serif;font-size:small">As a suggestion, something I u=
sually use is a start and end to the buffer and the rate of the buffer. =C2=
=A0Basically a class that has a value equal to the start frame of the given=
 buffer, a value equal to the end frame of the buffer (or start of next fra=
me) and a value equal to the frame rate. =C2=A0So you can derive a real for=
 each, like start frames over frame rate and end frame over frame rate. =C2=
=A0From that you can get the seconds as a double or long double.</span><div=
 style=3D"font-family:arial,sans-serif;font-size:small"><br></div><div styl=
e=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;background-colo=
r:rgb(250,250,250)"><code><div><span style=3D"color:#008">class</span><span=
 style=3D"color:#000"> frame_ticks =C2=A0</span><span style=3D"color:#800">=
// or some name that better describes this...</span><span style=3D"color:#0=
00"><br></span><span style=3D"color:#660">{</span><span style=3D"color:#000=
"><br>=C2=A0 =C2=A0 uint64_t fstart</span><span style=3D"color:#660">;</spa=
n><span style=3D"color:#000"><br>=C2=A0 =C2=A0 uint64_t fend</span><span st=
yle=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 uin=
t64_t frate</span><span style=3D"color:#660">;</span><span style=3D"color:#=
000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">// ...</span><span=
 style=3D"color:#000"><br></span><span style=3D"color:#660">};</span></div>=
</code></div><div><span style=3D"font-family:arial,sans-serif;font-size:sma=
ll"><br></span></div><div><span style=3D"font-family:arial,sans-serif;font-=
size:small">Allowing the start value to be set or reset on starting or stop=
ping record/playback is another feature that some might need here. =C2=A0An=
d </span><span style=3D"font-family:arial,sans-serif;font-size:small">I don=
&#39;t recommend eliminating the rate portion from this class since it coul=
d lead to trouble where people are making assumptions they shouldn&#39;t, b=
est to have them together.</span></div><div><span style=3D"font-family:aria=
l,sans-serif;font-size:small"><br></span></div><div><span style=3D"font-fam=
ily:arial,sans-serif;font-size:small">Also, I would not add other data to t=
his class since it could be re-used elsewhere as is. =C2=A0Other properties=
 of a buffer can be defined in another class/structure, but again this is j=
ust a suggestion...</span></div><div><span style=3D"font-family:arial,sans-=
serif;font-size:small"><br></span></div></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8e15e56a-73e1-452b-a564-b36aead468b8%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/8e15e56a-73e1-452b-a564-b36aead468b8=
%40isocpp.org</a>.<br />

------=_Part_1593_382233223.1465532237846--

------=_Part_1592_2055356127.1465532237846--

.


Author: alexander.zywicki@gmail.com
Date: Thu, 9 Jun 2016 21:21:25 -0700 (PDT)
Raw View
------=_Part_1452_1924015333.1465532485188
Content-Type: multipart/alternative;
 boundary="----=_Part_1453_1086333339.1465532485188"

------=_Part_1453_1086333339.1465532485188
Content-Type: text/plain; charset=UTF-8

Or are we trying to define how to determine a specific timepoint that a
specific frame corresponds to?

double start = fstart/frate;//timepoint that corresponds to the start of
the frame
double end = fend/frate;

double elapsed = end-start;//duration of frame?






On Thursday, June 9, 2016 at 11:17:17 PM UTC-5, alexande...@gmail.com wrote:
>
> So essentially it is a class that provides the needed data to calculate
> the time in seconds a number of frames should take at a specified rate?
>
> So:
> int number_of_frames = fend - fstart;
> double seconds_elapsed = number_of_frames/frate;
>
> Am i understanding that correctly?
>
>
> On Thursday, June 9, 2016 at 10:05:08 PM UTC-5, Ron wrote:
>>
>>
>> On Thursday, June 9, 2016 at 7:26:37 PM UTC-7, alexande...@gmail.com
>> wrote:
>>>
>>> Do you have any suggestions as far as an explicit notion of time should
>>> be in this context?
>>>
>>
>> As a suggestion, something I usually use is a start and end to the buffer
>> and the rate of the buffer.  Basically a class that has a value equal to
>> the start frame of the given buffer, a value equal to the end frame of the
>> buffer (or start of next frame) and a value equal to the frame rate.  So
>> you can derive a real for each, like start frames over frame rate and end
>> frame over frame rate.  From that you can get the seconds as a double or
>> long double.
>>
>> class frame_ticks  // or some name that better describes this...
>> {
>>     uint64_t fstart;
>>     uint64_t fend;
>>     uint64_t frate;
>>     // ...
>> };
>>
>> Allowing the start value to be set or reset on starting or stopping
>> record/playback is another feature that some might need here.  And I
>> don't recommend eliminating the rate portion from this class since it could
>> lead to trouble where people are making assumptions they shouldn't, best to
>> have them together.
>>
>> Also, I would not add other data to this class since it could be re-used
>> elsewhere as is.  Other properties of a buffer can be defined in another
>> class/structure, but again this is just a suggestion...
>>
>>

--
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 email 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/bf9d23d9-657a-4c5d-8985-d3cd504f59f3%40isocpp.org.

------=_Part_1453_1086333339.1465532485188
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Or are we trying to define how to determine a specific tim=
epoint that a specific frame corresponds to?<br><br><div class=3D"prettypri=
nt" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 1=
87, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><=
code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">double</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> start </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> fstart</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">/</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">frate</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span><span style=3D"color: #800;" class=3D"styled-by-prettify"=
>//timepoint that corresponds to the start of the frame</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">double</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">end</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> fend</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
/</span><span style=3D"color: #000;" class=3D"styled-by-prettify">frate</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">double</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> elapsed </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">end</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">-</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">start</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span><span style=3D"color: #800;" class=3D"styled-by-prettify"=
>//duration of frame?</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br><br></span></div></code></div><br><br><br><br><br>On Thursda=
y, June 9, 2016 at 11:17:17 PM UTC-5, alexande...@gmail.com wrote:<blockquo=
te class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left:=
 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">So essentially it is a=
 class that provides the needed data to calculate the time in seconds a num=
ber of frames should take at a specified rate?<br><br>So:<br><div style=3D"=
background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-styl=
e:solid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"co=
lor:#008">int</span><span style=3D"color:#000"> number_of_frames </span><sp=
an style=3D"color:#660">=3D</span><span style=3D"color:#000"> fend </span><=
span style=3D"color:#660">-</span><span style=3D"color:#000"> fstart</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#000"><br></span><s=
pan style=3D"color:#008">double</span><span style=3D"color:#000"> seconds_e=
lapsed </span><span style=3D"color:#660">=3D</span><span style=3D"color:#00=
0"> number_of_frames</span><span style=3D"color:#660">/</span><span style=
=3D"color:#000">frate</span><span style=3D"color:#660">;</span></div></code=
></div><br>Am i understanding that correctly? <br><br><br>On Thursday, June=
 9, 2016 at 10:05:08 PM UTC-5, Ron wrote:<blockquote class=3D"gmail_quote" =
style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left=
:1ex"><div dir=3D"ltr"><br>On Thursday, June 9, 2016 at 7:26:37 PM UTC-7, <=
a>alexande...@gmail.com</a> wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"=
><div dir=3D"ltr">Do you have any suggestions as far as an explicit notion =
of time should be in this context?</div></blockquote><div><br></div><span s=
tyle=3D"font-family:arial,sans-serif;font-size:small">As a suggestion, some=
thing I usually use is a start and end to the buffer and the rate of the bu=
ffer. =C2=A0Basically a class that has a value equal to the start frame of =
the given buffer, a value equal to the end frame of the buffer (or start of=
 next frame) and a value equal to the frame rate. =C2=A0So you can derive a=
 real for each, like start frames over frame rate and end frame over frame =
rate. =C2=A0From that you can get the seconds as a double or long double.</=
span><div style=3D"font-family:arial,sans-serif;font-size:small"><br></div>=
<div style=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;backgr=
ound-color:rgb(250,250,250)"><code><div><span style=3D"color:#008">class</s=
pan><span style=3D"color:#000"> frame_ticks =C2=A0</span><span style=3D"col=
or:#800">// or some name that better describes this...</span><span style=3D=
"color:#000"><br></span><span style=3D"color:#660">{</span><span style=3D"c=
olor:#000"><br>=C2=A0 =C2=A0 uint64_t fstart</span><span style=3D"color:#66=
0">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 uint64_t fend</span=
><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 uint64_t frate</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">// ...<=
/span><span style=3D"color:#000"><br></span><span style=3D"color:#660">};</=
span></div></code></div><div><span style=3D"font-family:arial,sans-serif;fo=
nt-size:small"><br></span></div><div><span style=3D"font-family:arial,sans-=
serif;font-size:small">Allowing the start value to be set or reset on start=
ing or stopping record/playback is another feature that some might need her=
e. =C2=A0And </span><span style=3D"font-family:arial,sans-serif;font-size:s=
mall">I don&#39;t recommend eliminating the rate portion from this class si=
nce it could lead to trouble where people are making assumptions they shoul=
dn&#39;t, best to have them together.</span></div><div><span style=3D"font-=
family:arial,sans-serif;font-size:small"><br></span></div><div><span style=
=3D"font-family:arial,sans-serif;font-size:small">Also, I would not add oth=
er data to this class since it could be re-used elsewhere as is. =C2=A0Othe=
r properties of a buffer can be defined in another class/structure, but aga=
in this is just a suggestion...</span></div><div><span style=3D"font-family=
:arial,sans-serif;font-size:small"><br></span></div></div></blockquote></di=
v></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/bf9d23d9-657a-4c5d-8985-d3cd504f59f3%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/bf9d23d9-657a-4c5d-8985-d3cd504f59f3=
%40isocpp.org</a>.<br />

------=_Part_1453_1086333339.1465532485188--

------=_Part_1452_1924015333.1465532485188--

.


Author: alexander.zywicki@gmail.com
Date: Thu, 9 Jun 2016 21:30:01 -0700 (PDT)
Raw View
------=_Part_614_821088863.1465533001769
Content-Type: multipart/alternative;
 boundary="----=_Part_615_1940005619.1465533001770"

------=_Part_615_1940005619.1465533001770
Content-Type: text/plain; charset=UTF-8

I suppose we could use the std::chrono library as a basis, and define a
clock type that has a dynamically set epoch. This would allow a time-point
to have a value relative to when the stream was started?

So maybe the introduction of:

std::audio::sample_clock;//a clock type that counts in frames(or samples)
/*
-has internal member of "rate" that is used for conversion
-keeps track of number of frames(or samples) elapsed
-can produce a time_point that is a real number of seconds from epoch.
-epoch can be reset
-clock will be synced with hardware??? if possible?? or good idea??

*/
std::chrono::time_point<std::audio::sample_clock> foo;//the current time
since epoch in seconds





On Thursday, June 9, 2016 at 10:05:08 PM UTC-5, Ron wrote:
>
>
> On Thursday, June 9, 2016 at 7:26:37 PM UTC-7, alexande...@gmail.com
> wrote:
>>
>> Do you have any suggestions as far as an explicit notion of time should
>> be in this context?
>>
>
> As a suggestion, something I usually use is a start and end to the buffer
> and the rate of the buffer.  Basically a class that has a value equal to
> the start frame of the given buffer, a value equal to the end frame of the
> buffer (or start of next frame) and a value equal to the frame rate.  So
> you can derive a real for each, like start frames over frame rate and end
> frame over frame rate.  From that you can get the seconds as a double or
> long double.
>
> class frame_ticks  // or some name that better describes this...
> {
>     uint64_t fstart;
>     uint64_t fend;
>     uint64_t frate;
>     // ...
> };
>
> Allowing the start value to be set or reset on starting or stopping
> record/playback is another feature that some might need here.  And I
> don't recommend eliminating the rate portion from this class since it could
> lead to trouble where people are making assumptions they shouldn't, best to
> have them together.
>
> Also, I would not add other data to this class since it could be re-used
> elsewhere as is.  Other properties of a buffer can be defined in another
> class/structure, but again this is just a suggestion...
>
>

--
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 email 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/83016a47-e902-4292-b109-652e811d17fb%40isocpp.org.

------=_Part_615_1940005619.1465533001770
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I suppose we could use the std::chrono library as a basis,=
 and define a clock type that has a dynamically set epoch. This would allow=
 a time-point to have a value relative to when the stream was started? <br>=
<br>So maybe the introduction of:<br><span style=3D"color: #000;" class=3D"=
styled-by-prettify"></span><br><span style=3D"color: #000;" class=3D"styled=
-by-prettify"></span><div class=3D"prettyprint" style=3D"background-color: =
rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; =
border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div=
 class=3D"subprettyprint"><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">std</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">audio<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">sample_clock</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span sty=
le=3D"color: #800;" class=3D"styled-by-prettify">//a clock type that counts=
 in frames(or samples)</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br></span><span style=3D"color: #800;" class=3D"styled-by-pret=
tify">/*<br>-has internal member of &quot;rate&quot; that is used for conve=
rsion<br>-keeps track of number of frames(or samples) elapsed<br>-can produ=
ce a time_point that is a real number of seconds from epoch.<br>-epoch can =
be reset<br>-clock will be synced with hardware??? if possible?? or good id=
ea??</span><span style=3D"color: #800;" class=3D"styled-by-prettify"><br><b=
r>*/</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>st=
d</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">chrono</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">time_point</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">std</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">audio</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify">sample_clock</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> foo</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">;</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//the =
current time since epoch in seconds</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br><br><br></span></div></code></div><br><br><br>=
On Thursday, June 9, 2016 at 10:05:08 PM UTC-5, Ron wrote:<blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;"><div dir=3D"ltr"><br>On Thursday, June 9, 2016 =
at 7:26:37 PM UTC-7, <a>alexande...@gmail.com</a> wrote:<blockquote class=
=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc s=
olid;padding-left:1ex"><div dir=3D"ltr">Do you have any suggestions as far =
as an explicit notion of time should be in this context?</div></blockquote>=
<div><br></div><span style=3D"font-family:arial,sans-serif;font-size:small"=
>As a suggestion, something I usually use is a start and end to the buffer =
and the rate of the buffer. =C2=A0Basically a class that has a value equal =
to the start frame of the given buffer, a value equal to the end frame of t=
he buffer (or start of next frame) and a value equal to the frame rate. =C2=
=A0So you can derive a real for each, like start frames over frame rate and=
 end frame over frame rate. =C2=A0From that you can get the seconds as a do=
uble or long double.</span><div style=3D"font-family:arial,sans-serif;font-=
size:small"><br></div><div style=3D"border:1px solid rgb(187,187,187);word-=
wrap:break-word;background-color:rgb(250,250,250)"><code><div><span style=
=3D"color:#008">class</span><span style=3D"color:#000"> frame_ticks =C2=A0<=
/span><span style=3D"color:#800">// or some name that better describes this=
....</span><span style=3D"color:#000"><br></span><span style=3D"color:#660">=
{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 uint64_t fstart</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 uint64_t fend</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 uint64_t frate</span><span style=3D"color=
:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span st=
yle=3D"color:#800">// ...</span><span style=3D"color:#000"><br></span><span=
 style=3D"color:#660">};</span></div></code></div><div><span style=3D"font-=
family:arial,sans-serif;font-size:small"><br></span></div><div><span style=
=3D"font-family:arial,sans-serif;font-size:small">Allowing the start value =
to be set or reset on starting or stopping record/playback is another featu=
re that some might need here. =C2=A0And </span><span style=3D"font-family:a=
rial,sans-serif;font-size:small">I don&#39;t recommend eliminating the rate=
 portion from this class since it could lead to trouble where people are ma=
king assumptions they shouldn&#39;t, best to have them together.</span></di=
v><div><span style=3D"font-family:arial,sans-serif;font-size:small"><br></s=
pan></div><div><span style=3D"font-family:arial,sans-serif;font-size:small"=
>Also, I would not add other data to this class since it could be re-used e=
lsewhere as is. =C2=A0Other properties of a buffer can be defined in anothe=
r class/structure, but again this is just a suggestion...</span></div><div>=
<span style=3D"font-family:arial,sans-serif;font-size:small"><br></span></d=
iv></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/83016a47-e902-4292-b109-652e811d17fb%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/83016a47-e902-4292-b109-652e811d17fb=
%40isocpp.org</a>.<br />

------=_Part_615_1940005619.1465533001770--

------=_Part_614_821088863.1465533001769--

.


Author: ron novy <rsn10100@gmail.com>
Date: Thu, 9 Jun 2016 22:51:36 -0700
Raw View
--001a11404722ccd1210534e6216c
Content-Type: text/plain; charset=UTF-8

Yes, I believe that would work. ;)

On Thu, Jun 9, 2016 at 9:30 PM, <alexander.zywicki@gmail.com> wrote:

> I suppose we could use the std::chrono library as a basis, and define a
> clock type that has a dynamically set epoch. This would allow a time-point
> to have a value relative to when the stream was started?
>
> So maybe the introduction of:
>
> std::audio::sample_clock;//a clock type that counts in frames(or samples)
> /*
> -has internal member of "rate" that is used for conversion
> -keeps track of number of frames(or samples) elapsed
> -can produce a time_point that is a real number of seconds from epoch.
> -epoch can be reset
> -clock will be synced with hardware??? if possible?? or good idea??
>
> */
> std::chrono::time_point<std::audio::sample_clock> foo;//the current time
> since epoch in seconds
>
>
>
>
>
> On Thursday, June 9, 2016 at 10:05:08 PM UTC-5, Ron wrote:
>>
>>
>> On Thursday, June 9, 2016 at 7:26:37 PM UTC-7, alexande...@gmail.com
>> wrote:
>>>
>>> Do you have any suggestions as far as an explicit notion of time should
>>> be in this context?
>>>
>>
>> As a suggestion, something I usually use is a start and end to the buffer
>> and the rate of the buffer.  Basically a class that has a value equal to
>> the start frame of the given buffer, a value equal to the end frame of the
>> buffer (or start of next frame) and a value equal to the frame rate.  So
>> you can derive a real for each, like start frames over frame rate and end
>> frame over frame rate.  From that you can get the seconds as a double or
>> long double.
>>
>> class frame_ticks  // or some name that better describes this...
>> {
>>     uint64_t fstart;
>>     uint64_t fend;
>>     uint64_t frate;
>>     // ...
>> };
>>
>> Allowing the start value to be set or reset on starting or stopping
>> record/playback is another feature that some might need here.  And I
>> don't recommend eliminating the rate portion from this class since it could
>> lead to trouble where people are making assumptions they shouldn't, best to
>> have them together.
>>
>> Also, I would not add other data to this class since it could be re-used
>> elsewhere as is.  Other properties of a buffer can be defined in another
>> class/structure, but again this is just a suggestion...
>>
>> --
> 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
> email 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/83016a47-e902-4292-b109-652e811d17fb%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/83016a47-e902-4292-b109-652e811d17fb%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>

--
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 email 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/CAOcFa%3DcUNbJ7qB8hqU8jnX18S%3D_CdapSAMHsnFur8thE-8PVHw%40mail.gmail.com.

--001a11404722ccd1210534e6216c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Yes, I believe that would work. ;)</div><div class=3D"gmai=
l_extra"><br><div class=3D"gmail_quote">On Thu, Jun 9, 2016 at 9:30 PM,  <s=
pan dir=3D"ltr">&lt;<a href=3D"mailto:alexander.zywicki@gmail.com" target=
=3D"_blank">alexander.zywicki@gmail.com</a>&gt;</span> wrote:<br><blockquot=
e class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc sol=
id;padding-left:1ex"><div dir=3D"ltr">I suppose we could use the std::chron=
o library as a basis, and define a clock type that has a dynamically set ep=
och. This would allow a time-point to have a value relative to when the str=
eam was started? <br><br>So maybe the introduction of:<br><span style=3D"co=
lor:#000"></span><br><span style=3D"color:#000"></span><div style=3D"backgr=
ound-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:soli=
d;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#0=
00">std</span><span style=3D"color:#660">::</span><span style=3D"color:#000=
">audio</span><span style=3D"color:#660">::</span><span style=3D"color:#000=
">sample_clock</span><span style=3D"color:#660">;</span><span style=3D"colo=
r:#800">//a clock type that counts in frames(or samples)</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#800">/*<br>-has internal m=
ember of &quot;rate&quot; that is used for conversion<br>-keeps track of nu=
mber of frames(or samples) elapsed<br>-can produce a time_point that is a r=
eal number of seconds from epoch.<br>-epoch can be reset<br>-clock will be =
synced with hardware??? if possible?? or good idea??</span><span style=3D"c=
olor:#800"><br><br>*/</span><span style=3D"color:#000"><br>std</span><span =
style=3D"color:#660">::</span><span style=3D"color:#000">chrono</span><span=
 style=3D"color:#660">::</span><span style=3D"color:#000">time_point</span>=
<span style=3D"color:#660">&lt;</span><span style=3D"color:#000">std</span>=
<span style=3D"color:#660">::</span><span style=3D"color:#000">audio</span>=
<span style=3D"color:#660">::</span><span style=3D"color:#000">sample_clock=
</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"> fo=
o</span><span style=3D"color:#660">;</span><span style=3D"color:#800">//the=
 current time since epoch in seconds</span><span style=3D"color:#000"><br><=
br><br></span></div></code></div><span class=3D""><br><br><br>On Thursday, =
June 9, 2016 at 10:05:08 PM UTC-5, Ron wrote:</span><span class=3D""><block=
quote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left=
:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br>On Thursday, June 9,=
 2016 at 7:26:37 PM UTC-7, <a>alexande...@gmail.com</a> wrote:<blockquote c=
lass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #c=
cc solid;padding-left:1ex"><div dir=3D"ltr">Do you have any suggestions as =
far as an explicit notion of time should be in this context?</div></blockqu=
ote><div><br></div><span style=3D"font-family:arial,sans-serif;font-size:sm=
all">As a suggestion, something I usually use is a start and end to the buf=
fer and the rate of the buffer.=C2=A0 Basically a class that has a value eq=
ual to the start frame of the given buffer, a value equal to the end frame =
of the buffer (or start of next frame) and a value equal to the frame rate.=
=C2=A0 So you can derive a real for each, like start frames over frame rate=
 and end frame over frame rate.=C2=A0 From that you can get the seconds as =
a double or long double.</span><div style=3D"font-family:arial,sans-serif;f=
ont-size:small"><br></div><div style=3D"border:1px solid rgb(187,187,187);w=
ord-wrap:break-word;background-color:rgb(250,250,250)"><code><div><span sty=
le=3D"color:#008">class</span><span style=3D"color:#000"> frame_ticks =C2=
=A0</span><span style=3D"color:#800">// or some name that better describes =
this...</span><span style=3D"color:#000"><br></span><span style=3D"color:#6=
60">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 uint64_t fstart</s=
pan><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 uint64_t fend</span><span style=3D"color:#660">;</span><span sty=
le=3D"color:#000"><br>=C2=A0 =C2=A0 uint64_t frate</span><span style=3D"col=
or:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span =
style=3D"color:#800">// ...</span><span style=3D"color:#000"><br></span><sp=
an style=3D"color:#660">};</span></div></code></div><div><span style=3D"fon=
t-family:arial,sans-serif;font-size:small"><br></span></div><div><span styl=
e=3D"font-family:arial,sans-serif;font-size:small">Allowing the start value=
 to be set or reset on starting or stopping record/playback is another feat=
ure that some might need here.=C2=A0 And </span><span style=3D"font-family:=
arial,sans-serif;font-size:small">I don&#39;t recommend eliminating the rat=
e portion from this class since it could lead to trouble where people are m=
aking assumptions they shouldn&#39;t, best to have them together.</span></d=
iv><div><span style=3D"font-family:arial,sans-serif;font-size:small"><br></=
span></div><div><span style=3D"font-family:arial,sans-serif;font-size:small=
">Also, I would not add other data to this class since it could be re-used =
elsewhere as is.=C2=A0 Other properties of a buffer can be defined in anoth=
er class/structure, but again this is just a suggestion...</span></div><div=
><span style=3D"font-family:arial,sans-serif;font-size:small"><br></span></=
div></div></blockquote></span></div><span class=3D"">

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/83016a47-e902-4292-b109-652e811d17fb%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/83016a47-e902-=
4292-b109-652e811d17fb%40isocpp.org</a>.<br>
</blockquote></div><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAOcFa%3DcUNbJ7qB8hqU8jnX18S%3D_CdapS=
AMHsnFur8thE-8PVHw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOcFa%3DcUNb=
J7qB8hqU8jnX18S%3D_CdapSAMHsnFur8thE-8PVHw%40mail.gmail.com</a>.<br />

--001a11404722ccd1210534e6216c--

.


Author: ross.bencina@gmail.com
Date: Fri, 10 Jun 2016 01:06:31 -0700 (PDT)
Raw View
------=_Part_2280_1813943857.1465545991756
Content-Type: multipart/alternative;
 boundary="----=_Part_2281_1375421992.1465545991756"

------=_Part_2281_1375421992.1465545991756
Content-Type: text/plain; charset=UTF-8

> Do you have any suggestions as far as an explicit notion of time should
be in this context?

It needs to be a monotonic system clock.

And you need to be able to correlate it with your i/o buffers.

But you can not assume (as I think you have) that i/o buffers represent a
contiguous stream of samples, because there can be dropped buffers, and you
need to represent this. (btw. this is another example of how real-time
audio is not like an iostream).

Something I forgot earlier: each DAC or ADC may be running in a different
clock domain. The CPU time is usually another clock domain. So you have
multiple drifting clocks. One consequence of this is that you can't make
simplifying assumptions that e.g. 44100 samples elapsed is exactly 1 second
of system monotonic time. That's why you need timestamps associated with
the buffers, so that the client can estimate the actual sample rate.


--
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 email 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/53eaa67d-eec5-4ee1-bea2-848394b4f069%40isocpp.org.

------=_Part_2281_1375421992.1465545991756
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">&gt;=C2=A0<span style=3D"color: rgb(136, 136, 136);">Do yo=
u have any suggestions as far as an explicit notion of time should be in th=
is context?</span><div><span style=3D"color: rgb(136, 136, 136);"><br></spa=
n></div><div><span style=3D"color: rgb(136, 136, 136);">It needs to be a mo=
notonic system clock.</span></div><div><br></div><div>And you need to be ab=
le to correlate it with your i/o buffers.</div><div><br></div><div>But you =
can not assume (as I think you have) that i/o buffers represent a contiguou=
s stream of samples, because there can be dropped buffers, and you need to =
represent this. (btw. this is another example of how real-time audio is not=
 like an iostream).</div><div><br></div><div>Something I forgot earlier: ea=
ch DAC or ADC may be running in a different clock domain. The CPU time is u=
sually another clock domain. So you have multiple drifting clocks. One cons=
equence of this is that you can&#39;t make simplifying assumptions that e.g=
.. 44100 samples elapsed is exactly 1 second of system monotonic time. That&=
#39;s why you need timestamps associated with the buffers, so that the clie=
nt can estimate the actual sample rate.</div><div><br></div><div><br></div>=
</div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/53eaa67d-eec5-4ee1-bea2-848394b4f069%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/53eaa67d-eec5-4ee1-bea2-848394b4f069=
%40isocpp.org</a>.<br />

------=_Part_2281_1375421992.1465545991756--

------=_Part_2280_1813943857.1465545991756--

.


Author: ross.bencina@gmail.com
Date: Fri, 10 Jun 2016 01:13:22 -0700 (PDT)
Raw View
------=_Part_2210_1584071762.1465546402571
Content-Type: multipart/alternative;
 boundary="----=_Part_2211_1033011491.1465546402571"

------=_Part_2211_1033011491.1465546402571
Content-Type: text/plain; charset=UTF-8


>
> > Do you have any suggestions as far as an explicit notion of time should
> be in this context?
>

As a follow-up:

My default suggestion in all cases would be to consider what PortAudio does:
http://portaudio.com/docs/v19-doxydocs/portaudio_8h.html

Here is a list of analysis documents that we produced when we redesigned
the V19 API to cover a bunch of missing cases from the earlier API:
http://www.portaudio.com/docs/proposals/index.html

PortAudio doesn't necessarily cover all advanced use-cases. For that you'll
need to consult other APIs.

Obviously representing system time with a double is not a great idea (we
did it for portability and 32-bit compatibility). Using std::chrono in C++
makes sense.

Another thing that I forgot earlier: you need to consider that the client
of your API may not be able to configure the sample rate of the device.
Sometimes this is controlled by the client, but other times it's controlled
by the device (e.g. the device is synced to another clock source, or its
sample rate may be switched by a hardware switch on the device).

Ross.


--
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 email 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/efb7d239-5d54-4e6d-acc0-8314f3b23aeb%40isocpp.org.

------=_Part_2211_1033011491.1465546402571
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr">&gt;=C2=A0<span style=3D"color: rgb(136, 136, 136);">Do you have any su=
ggestions as far as an explicit notion of time should be in this context?</=
span></div></blockquote><div><br></div><div>As a follow-up:</div><div><br><=
/div><div>My default suggestion in all cases would be to consider what Port=
Audio does:</div><div>http://portaudio.com/docs/v19-doxydocs/portaudio_8h.h=
tml</div><div><br></div><div>Here is a list of analysis documents that we p=
roduced when we redesigned the V19 API to cover a bunch of missing cases fr=
om the earlier API:</div><div>http://www.portaudio.com/docs/proposals/index=
..html</div><div><br></div><div>PortAudio doesn&#39;t necessarily cover all =
advanced use-cases. For that you&#39;ll need to consult other APIs.</div><d=
iv><br></div><div>Obviously representing system time with a double is not a=
 great idea (we did it for portability and 32-bit compatibility). Using std=
::chrono in C++ makes sense.</div><div><br></div><div>Another thing that I =
forgot earlier: you need to consider that the client of your API may not be=
 able to configure the sample rate of the device. Sometimes this is control=
led by the client, but other times it&#39;s controlled by the device (e.g. =
the device is synced to another clock source, or its sample rate may be swi=
tched by a hardware switch on the device).</div><div><br></div><div>Ross.</=
div><div>=C2=A0</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/efb7d239-5d54-4e6d-acc0-8314f3b23aeb%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/efb7d239-5d54-4e6d-acc0-8314f3b23aeb=
%40isocpp.org</a>.<br />

------=_Part_2211_1033011491.1465546402571--

------=_Part_2210_1584071762.1465546402571--

.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Fri, 10 Jun 2016 13:34:47 +0300
Raw View
This is a multi-part message in MIME format.

--nextPart1550987.RFIYz09MSS
Content-Type: text/plain; charset=UTF-8

On Friday, 10 June 2016 13:11:14 MSK alexander.zywicki@gmail.com wrote:
> I suppose we could use the std::chrono library as a basis, and define a
> clock type that has a dynamically set epoch. This would allow a time-point
> to have a value relative to when the stream was started?
>
> So maybe the introduction of:
>
> std::audio::sample_clock;//a clock type that counts in frames(or samples)
> /*
> -has internal member of "rate" that is used for conversion
> -keeps track of number of frames(or samples) elapsed
> -can produce a time_point that is a real number of seconds from epoch.
> -epoch can be reset
> -clock will be synced with hardware??? if possible?? or good idea??
>
> */
> std::chrono::time_point<std::audio::sample_clock> foo;//the current time
> since epoch in seconds

+1 for using chrono.

+1 for monotonic clock (as Ross suggested). At least, by default.

-1 for using an arbitrary epoch clock.

In my practice I found it useful to be able to synchronize multiple streams, which may not
have started at the same time. Or in the same process at all.

I'm not sure there is much use in binding particular frames to the real world clock, at
least not in audio processing domain. In video/image processing this could be useful, e.g.
to present an image to the user at the given time. However, I feel it would still be useful
to allow specifying a custom clock to the audio processing framework as well.

One use case I have in mind is providing a custom clock which is guaranteed to be
equivalent to CLOCK_MONOTONIC on POSIX systems. Unlike std::chrono::steady_clock,
this custom clock would be useful in interfacing with OS primitives like condition
variables or events. Having such clock time points in audio frames would be useful.

One other thing that could be useful is a clock adaptor, which implements the usual
clock interface, but provides time points in sample rate units. The actual time readings
would be obtained from an underlying clock. Something like this:

  template< typename BaseClock, unsigned int SampleRate >
  class sample_rate_clock
  {
  public:
    typedef BaseClock base_clock;
    static constexpr unsigned int sample_rate = SampleRate;
    typedef ratio< 1, sample_rate > period;
    typedef typename base_clock::rep rep;
    typedef std::chrono::duration< rep, period > duration;
    typedef std::chrono::time_point< sample_rate_clock > time_point;
    // ...etc. - other clock members as usual,
    // imported from BaseClock as needed

    static time_point now()
    {
      return time_point(duration_cast< duration >(
        base_clock::now().time_since_epoch()));
    }
  };

Or, on the second thought, this might be a generic tool, not related to audio processing
at all...

--
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 email 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/2271827.u9FbM9WbyY%40lastique-pc.

--nextPart1550987.RFIYz09MSS
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-=
html40/strict.dtd">
<html><head><meta name=3D"qrichtext" content=3D"1" /><style type=3D"text/cs=
s">
p, li { white-space: pre-wrap; }
</style></head><body style=3D" font-family:'DejaVu Sans Mono'; font-size:9p=
t; font-weight:400; font-style:normal;">
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Friday, =
10 June 2016 13:11:14 MSK alexander.zywicki@gmail.com wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; I supp=
ose we could use the std::chrono library as a basis, and define a</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; clock =
type that has a dynamically set epoch. This would allow a time-point</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; to hav=
e a value relative to when the stream was started?</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; So may=
be the introduction of:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; std::a=
udio::sample_clock;//a clock type that counts in frames(or samples)</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; /*</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -has i=
nternal member of &quot;rate&quot; that is used for conversion</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -keeps=
 track of number of frames(or samples) elapsed</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -can p=
roduce a time_point that is a real number of seconds from epoch.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -epoch=
 can be reset</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -clock=
 will be synced with hardware??? if possible?? or good idea??</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; */</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; std::c=
hrono::time_point&lt;std::audio::sample_clock&gt; foo;//the current time</p=
>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; since =
epoch in seconds</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">+1 for usin=
g chrono.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">+1 for mono=
tonic clock (as Ross suggested). At least, by default.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">-1 for usin=
g an arbitrary epoch clock.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">In my pract=
ice I found it useful to be able to synchronize multiple streams, which may=
 not have started at the same time. Or in the same process at all.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">I'm not sur=
e there is much use in binding particular frames to the real world clock, a=
t least not in audio processing domain. In video/image processing this coul=
d be useful, e.g. to present an image to the user at the given time. Howeve=
r, I feel it would still be useful to allow specifying a custom clock to th=
e audio processing framework as well.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">One use cas=
e I have in mind is providing a custom clock which is guaranteed to be equi=
valent to CLOCK_MONOTONIC on POSIX systems. Unlike std::chrono::steady_cloc=
k, this custom clock would be useful in interfacing with OS primitives like=
 condition variables or events. Having such clock time points in audio fram=
es would be useful.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">One other t=
hing that could be useful is a clock adaptor, which implements the usual cl=
ock interface, but provides time points in sample rate units. The actual ti=
me readings would be obtained from an underlying clock. Something like this=
:</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  template&=
lt; typename BaseClock, unsigned int SampleRate &gt;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  class sam=
ple_rate_clock</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  {</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  public:</=
p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 BaseClock base_clock;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    static =
constexpr unsigned int sample_rate =3D SampleRate;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 ratio&lt; 1, sample_rate &gt; period;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 typename base_clock::rep rep;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 std::chrono::duration&lt; rep, period &gt; duration;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 std::chrono::time_point&lt; sample_rate_clock &gt; time_point;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    // ...e=
tc. - other clock members as usual,</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    // impo=
rted from BaseClock as needed</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    static =
time_point now()</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    {</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">      retur=
n time_point(duration_cast&lt; duration &gt;(</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">        bas=
e_clock::now().time_since_epoch()));</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    }</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  };</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Or, on the =
second thought, this might be a generic tool, not related to audio processi=
ng at all...</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2271827.u9FbM9WbyY%40lastique-pc?utm_=
medium=3Demail&utm_source=3Dfooter">https://groups.google.com/a/isocpp.org/=
d/msgid/std-proposals/2271827.u9FbM9WbyY%40lastique-pc</a>.<br />

--nextPart1550987.RFIYz09MSS--


.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Fri, 10 Jun 2016 13:37:22 +0300
Raw View
This is a multi-part message in MIME format.

--nextPart2332950.nM8NnqRuSA
Content-Type: text/plain; charset=UTF-8

On Friday, 10 June 2016 13:36:48 MSK
alexander.zywicki@gmail.com wrote:
> Or are we trying to define how to determine a specific
timepoint that a
> specific frame corresponds to?
>
> double start = fstart/frate;//timepoint that corresponds to the
start of
> the frame
> double end = fend/frate;
>
> double elapsed = end-start;//duration of frame?

Floating point types are definitely not the way to go for
timestamps.

--
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 email 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/1660798.4fr5peXh7P%40lastique-pc.

--nextPart2332950.nM8NnqRuSA
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-=
html40/strict.dtd">
<html><head><meta name=3D"qrichtext" content=3D"1" /><style type=3D"text/cs=
s">
p, li { white-space: pre-wrap; }
</style></head><body style=3D" font-family:'DejaVu Sans Mono'; font-size:9p=
t; font-weight:400; font-style:normal;">
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Friday, =
10 June 2016 13:36:48 MSK alexander.zywicki@gmail.com wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; Or are=
 we trying to define how to determine a specific timepoint that a</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; specif=
ic frame corresponds to?</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; double=
 start =3D fstart/frate;//timepoint that corresponds to the start of</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; the fr=
ame</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; double=
 end =3D fend/frate;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; double=
 elapsed =3D end-start;//duration of frame?</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Floating po=
int types are definitely not the way to go for timestamps.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/1660798.4fr5peXh7P%40lastique-pc?utm_=
medium=3Demail&utm_source=3Dfooter">https://groups.google.com/a/isocpp.org/=
d/msgid/std-proposals/1660798.4fr5peXh7P%40lastique-pc</a>.<br />

--nextPart2332950.nM8NnqRuSA--


.


Author: alexander.zywicki@gmail.com
Date: Fri, 10 Jun 2016 07:24:47 -0500
Raw View
--Apple-Mail-7E39CDD2-52E1-441D-87C6-FBDC55D40E01
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I lie your thought on the clock idea and +1 for the example. A few thoughts=
 though, I would like to explain the distinction that I draw between an "ar=
bitrary epoch" and a "dynamic epoch" as I had proposed. It would not be arb=
itrary in that it would be set to some random point, but rather would be se=
t too a significant time point in terms of the current instance of the prog=
ram... It would be reset to the time when the stream was started. In port a=
udio it would be set to the time when Pa_StartStream was called, having tha=
t as a reference point would allow you to manage the local time within that=
 stream easily.=20

As a second note the sample rate will most likely need to be a runtime para=
meter and cannot be a template parameter because of such( unless we specify=
 the need for a factory to create clocks of different sample rates) we will=
 probably not know the desired sample rate or even the supported sampling r=
ates at compile time

> On Jun 10, 2016, at 5:34 AM, Andrey Semashev <andrey.semashev@gmail.com> =
wrote:
>=20
> On Friday, 10 June 2016 13:11:14 MSK alexander.zywicki@gmail.com wrote:
> > I suppose we could use the std::chrono library as a basis, and define a
> > clock type that has a dynamically set epoch. This would allow a time-po=
int
> > to have a value relative to when the stream was started?
> >
> > So maybe the introduction of:
> >
> > std::audio::sample_clock;//a clock type that counts in frames(or sample=
s)
> > /*
> > -has internal member of "rate" that is used for conversion
> > -keeps track of number of frames(or samples) elapsed
> > -can produce a time_point that is a real number of seconds from epoch.
> > -epoch can be reset
> > -clock will be synced with hardware??? if possible?? or good idea??
> >
> > */
> > std::chrono::time_point<std::audio::sample_clock> foo;//the current tim=
e
> > since epoch in seconds
> =20
> +1 for using chrono.
> =20
> +1 for monotonic clock (as Ross suggested). At least, by default.
> =20
> -1 for using an arbitrary epoch clock.
> =20
> In my practice I found it useful to be able to synchronize multiple strea=
ms, which may not have started at the same time. Or in the same process at =
all.
> =20
> I'm not sure there is much use in binding particular frames to the real w=
orld clock, at least not in audio processing domain. In video/image process=
ing this could be useful, e.g. to present an image to the user at the given=
 time. However, I feel it would still be useful to allow specifying a custo=
m clock to the audio processing framework as well.
> =20
> One use case I have in mind is providing a custom clock which is guarante=
ed to be equivalent to CLOCK_MONOTONIC on POSIX systems. Unlike std::chrono=
::steady_clock, this custom clock would be useful in interfacing with OS pr=
imitives like condition variables or events. Having such clock time points =
in audio frames would be useful.
> =20
> One other thing that could be useful is a clock adaptor, which implements=
 the usual clock interface, but provides time points in sample rate units. =
The actual time readings would be obtained from an underlying clock. Someth=
ing like this:
> =20
> template< typename BaseClock, unsigned int SampleRate >
> class sample_rate_clock
> {
> public:
> typedef BaseClock base_clock;
> static constexpr unsigned int sample_rate =3D SampleRate;
> typedef ratio< 1, sample_rate > period;
> typedef typename base_clock::rep rep;
> typedef std::chrono::duration< rep, period > duration;
> typedef std::chrono::time_point< sample_rate_clock > time_point;
> // ...etc. - other clock members as usual,
> // imported from BaseClock as needed
> =20
> static time_point now()
> {
> return time_point(duration_cast< duration >(
> base_clock::now().time_since_epoch()));
> }
> };
> =20
> Or, on the second thought, this might be a generic tool, not related to a=
udio processing at all...
> =20
> --=20
> You received this message because you are subscribed to a topic in the Go=
ogle Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.=
org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to std-p=
roposals+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/isoc=
pp.org/d/msgid/std-proposals/2271827.u9FbM9WbyY%40lastique-pc.

--=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/485D94E9-3386-4C2E-8C90-2AE821C3B7E6%40gmail.com=
..

--Apple-Mail-7E39CDD2-52E1-441D-87C6-FBDC55D40E01
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=
=3Dutf-8"></head><body dir=3D"auto"><div></div><div>I lie your thought on t=
he clock idea and +1 for the example. A few thoughts though, I would like t=
o explain the distinction that I draw between an "arbitrary epoch" and a "d=
ynamic epoch" as I had proposed. It would not be arbitrary in that it would=
 be set to some random point, but rather would be set too a significant tim=
e point in terms of the current instance of the program... It would be rese=
t to the time when the stream was started. In port audio it would be set to=
 the time when Pa_StartStream was called, having that as a reference point =
would allow you to manage the local time within that stream easily.&nbsp;</=
div><div><br></div><div>As a second note the sample rate will most likely n=
eed to be a runtime parameter and cannot be a template parameter because of=
 such( unless we specify the need for a factory to create clocks of differe=
nt sample rates) we will probably not know the desired sample rate or even =
the supported sampling rates at compile time</div><div><br>On Jun 10, 2016,=
 at 5:34 AM, Andrey Semashev &lt;<a href=3D"mailto:andrey.semashev@gmail.co=
m">andrey.semashev@gmail.com</a>&gt; wrote:<br><br></div><blockquote type=
=3D"cite"><div>
<meta name=3D"qrichtext" content=3D"1">
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Friday, =
10 June 2016 13:11:14 MSK <a href=3D"mailto:alexander.zywicki@gmail.com">al=
exander.zywicki@gmail.com</a> wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; I supp=
ose we could use the std::chrono library as a basis, and define a</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; clock =
type that has a dynamically set epoch. This would allow a time-point</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; to hav=
e a value relative to when the stream was started?</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; So may=
be the introduction of:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; std::a=
udio::sample_clock;//a clock type that counts in frames(or samples)</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; /*</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -has i=
nternal member of "rate" that is used for conversion</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -keeps=
 track of number of frames(or samples) elapsed</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -can p=
roduce a time_point that is a real number of seconds from epoch.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -epoch=
 can be reset</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -clock=
 will be synced with hardware??? if possible?? or good idea??</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; */</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; std::c=
hrono::time_point&lt;std::audio::sample_clock&gt; foo;//the current time</p=
>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; since =
epoch in seconds</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">+1 for usin=
g chrono.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">+1 for mono=
tonic clock (as Ross suggested). At least, by default.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">-1 for usin=
g an arbitrary epoch clock.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">In my pract=
ice I found it useful to be able to synchronize multiple streams, which may=
 not have started at the same time. Or in the same process at all.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">I'm not sur=
e there is much use in binding particular frames to the real world clock, a=
t least not in audio processing domain. In video/image processing this coul=
d be useful, e.g. to present an image to the user at the given time. Howeve=
r, I feel it would still be useful to allow specifying a custom clock to th=
e audio processing framework as well.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">One use cas=
e I have in mind is providing a custom clock which is guaranteed to be equi=
valent to CLOCK_MONOTONIC on POSIX systems. Unlike std::chrono::steady_cloc=
k, this custom clock would be useful in interfacing with OS primitives like=
 condition variables or events. Having such clock time points in audio fram=
es would be useful.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">One other t=
hing that could be useful is a clock adaptor, which implements the usual cl=
ock interface, but provides time points in sample rate units. The actual ti=
me readings would be obtained from an underlying clock. Something like this=
:</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  template&=
lt; typename BaseClock, unsigned int SampleRate &gt;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  class sam=
ple_rate_clock</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  {</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  public:</=
p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 BaseClock base_clock;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    static =
constexpr unsigned int sample_rate =3D SampleRate;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 ratio&lt; 1, sample_rate &gt; period;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 typename base_clock::rep rep;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 std::chrono::duration&lt; rep, period &gt; duration;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 std::chrono::time_point&lt; sample_rate_clock &gt; time_point;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    // ...e=
tc. - other clock members as usual,</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    // impo=
rted from BaseClock as needed</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    static =
time_point now()</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    {</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">      retur=
n time_point(duration_cast&lt; duration &gt;(</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">        bas=
e_clock::now().time_since_epoch()));</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    }</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  };</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Or, on the =
second thought, this might be a generic tool, not related to audio processi=
ng at all...</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>

<p></p>

-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe">https://groups.=
google.com/a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe</a>.<=
br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@=
isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2271827.u9FbM9WbyY%40lastique-pc?utm_=
medium=3Demail&amp;utm_source=3Dfooter">https://groups.google.com/a/isocpp.=
org/d/msgid/std-proposals/2271827.u9FbM9WbyY%40lastique-pc</a>.<br>
</div></blockquote></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/485D94E9-3386-4C2E-8C90-2AE821C3B7E6%=
40gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/485D94E9-3386-4C2E-8C90-2AE821C3B7E6%=
40gmail.com</a>.<br />

--Apple-Mail-7E39CDD2-52E1-441D-87C6-FBDC55D40E01--

.


Author: alexander.zywicki@gmail.com
Date: Fri, 10 Jun 2016 07:37:21 -0500
Raw View
--Apple-Mail-86D056F0-B3B8-4F9C-9D24-B9CDB86B9045
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Or at least store a time point each time the stream is started using a cloc=
k with a well defined epoch, so that we might be able to find the length of=
 time that the stream has been active and have meaningful measurements of t=
ime within the stream.

> On Jun 10, 2016, at 7:24 AM, alexander.zywicki@gmail.com wrote:
>=20
> I lie your thought on the clock idea and +1 for the example. A few though=
ts though, I would like to explain the distinction that I draw between an "=
arbitrary epoch" and a "dynamic epoch" as I had proposed. It would not be a=
rbitrary in that it would be set to some random point, but rather would be =
set too a significant time point in terms of the current instance of the pr=
ogram... It would be reset to the time when the stream was started. In port=
 audio it would be set to the time when Pa_StartStream was called, having t=
hat as a reference point would allow you to manage the local time within th=
at stream easily.=20
>=20
> As a second note the sample rate will most likely need to be a runtime pa=
rameter and cannot be a template parameter because of such( unless we speci=
fy the need for a factory to create clocks of different sample rates) we wi=
ll probably not know the desired sample rate or even the supported sampling=
 rates at compile time
>=20
>> On Jun 10, 2016, at 5:34 AM, Andrey Semashev <andrey.semashev@gmail.com>=
 wrote:
>>=20
>> On Friday, 10 June 2016 13:11:14 MSK alexander.zywicki@gmail.com wrote:
>> > I suppose we could use the std::chrono library as a basis, and define =
a
>> > clock type that has a dynamically set epoch. This would allow a time-p=
oint
>> > to have a value relative to when the stream was started?
>> >
>> > So maybe the introduction of:
>> >
>> > std::audio::sample_clock;//a clock type that counts in frames(or sampl=
es)
>> > /*
>> > -has internal member of "rate" that is used for conversion
>> > -keeps track of number of frames(or samples) elapsed
>> > -can produce a time_point that is a real number of seconds from epoch.
>> > -epoch can be reset
>> > -clock will be synced with hardware??? if possible?? or good idea??
>> >
>> > */
>> > std::chrono::time_point<std::audio::sample_clock> foo;//the current ti=
me
>> > since epoch in seconds
>> =20
>> +1 for using chrono.
>> =20
>> +1 for monotonic clock (as Ross suggested). At least, by default.
>> =20
>> -1 for using an arbitrary epoch clock.
>> =20
>> In my practice I found it useful to be able to synchronize multiple stre=
ams, which may not have started at the same time. Or in the same process at=
 all.
>> =20
>> I'm not sure there is much use in binding particular frames to the real =
world clock, at least not in audio processing domain. In video/image proces=
sing this could be useful, e.g. to present an image to the user at the give=
n time. However, I feel it would still be useful to allow specifying a cust=
om clock to the audio processing framework as well.
>> =20
>> One use case I have in mind is providing a custom clock which is guarant=
eed to be equivalent to CLOCK_MONOTONIC on POSIX systems. Unlike std::chron=
o::steady_clock, this custom clock would be useful in interfacing with OS p=
rimitives like condition variables or events. Having such clock time points=
 in audio frames would be useful.
>> =20
>> One other thing that could be useful is a clock adaptor, which implement=
s the usual clock interface, but provides time points in sample rate units.=
 The actual time readings would be obtained from an underlying clock. Somet=
hing like this:
>> =20
>> template< typename BaseClock, unsigned int SampleRate >
>> class sample_rate_clock
>> {
>> public:
>> typedef BaseClock base_clock;
>> static constexpr unsigned int sample_rate =3D SampleRate;
>> typedef ratio< 1, sample_rate > period;
>> typedef typename base_clock::rep rep;
>> typedef std::chrono::duration< rep, period > duration;
>> typedef std::chrono::time_point< sample_rate_clock > time_point;
>> // ...etc. - other clock members as usual,
>> // imported from BaseClock as needed
>> =20
>> static time_point now()
>> {
>> return time_point(duration_cast< duration >(
>> base_clock::now().time_since_epoch()));
>> }
>> };
>> =20
>> Or, on the second thought, this might be a generic tool, not related to =
audio processing at all...
>> =20
>> --=20
>> You received this message because you are subscribed to a topic in the G=
oogle Groups "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this topic, visit https://groups.google.com/a/isocpp=
..org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email 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/iso=
cpp.org/d/msgid/std-proposals/2271827.u9FbM9WbyY%40lastique-pc.

--=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/31D8D875-9842-4CC4-98C6-F75FD20155DE%40gmail.com=
..

--Apple-Mail-86D056F0-B3B8-4F9C-9D24-B9CDB86B9045
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=
=3Dutf-8"></head><body dir=3D"auto"><div></div><div>Or at least store a tim=
e point each time the stream is started using a clock with a well defined e=
poch, so that we might be able to find the length of time that the stream h=
as been active and have meaningful measurements of time within the stream.<=
/div><div><br>On Jun 10, 2016, at 7:24 AM, <a href=3D"mailto:alexander.zywi=
cki@gmail.com">alexander.zywicki@gmail.com</a> wrote:<br><br></div><blockqu=
ote type=3D"cite"><div><meta http-equiv=3D"content-type" content=3D"text/ht=
ml; charset=3Dutf-8"><div></div><div>I lie your thought on the clock idea a=
nd +1 for the example. A few thoughts though, I would like to explain the d=
istinction that I draw between an "arbitrary epoch" and a "dynamic epoch" a=
s I had proposed. It would not be arbitrary in that it would be set to some=
 random point, but rather would be set too a significant time point in term=
s of the current instance of the program... It would be reset to the time w=
hen the stream was started. In port audio it would be set to the time when =
Pa_StartStream was called, having that as a reference point would allow you=
 to manage the local time within that stream easily.&nbsp;</div><div><br></=
div><div>As a second note the sample rate will most likely need to be a run=
time parameter and cannot be a template parameter because of such( unless w=
e specify the need for a factory to create clocks of different sample rates=
) we will probably not know the desired sample rate or even the supported s=
ampling rates at compile time</div><div><br>On Jun 10, 2016, at 5:34 AM, An=
drey Semashev &lt;<a href=3D"mailto:andrey.semashev@gmail.com">andrey.semas=
hev@gmail.com</a>&gt; wrote:<br><br></div><blockquote type=3D"cite"><div>
<meta name=3D"qrichtext" content=3D"1">
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Friday, =
10 June 2016 13:11:14 MSK <a href=3D"mailto:alexander.zywicki@gmail.com">al=
exander.zywicki@gmail.com</a> wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; I supp=
ose we could use the std::chrono library as a basis, and define a</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; clock =
type that has a dynamically set epoch. This would allow a time-point</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; to hav=
e a value relative to when the stream was started?</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; So may=
be the introduction of:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; std::a=
udio::sample_clock;//a clock type that counts in frames(or samples)</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; /*</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -has i=
nternal member of "rate" that is used for conversion</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -keeps=
 track of number of frames(or samples) elapsed</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -can p=
roduce a time_point that is a real number of seconds from epoch.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -epoch=
 can be reset</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; -clock=
 will be synced with hardware??? if possible?? or good idea??</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; */</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; std::c=
hrono::time_point&lt;std::audio::sample_clock&gt; foo;//the current time</p=
>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; since =
epoch in seconds</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">+1 for usin=
g chrono.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">+1 for mono=
tonic clock (as Ross suggested). At least, by default.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">-1 for usin=
g an arbitrary epoch clock.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">In my pract=
ice I found it useful to be able to synchronize multiple streams, which may=
 not have started at the same time. Or in the same process at all.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">I'm not sur=
e there is much use in binding particular frames to the real world clock, a=
t least not in audio processing domain. In video/image processing this coul=
d be useful, e.g. to present an image to the user at the given time. Howeve=
r, I feel it would still be useful to allow specifying a custom clock to th=
e audio processing framework as well.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">One use cas=
e I have in mind is providing a custom clock which is guaranteed to be equi=
valent to CLOCK_MONOTONIC on POSIX systems. Unlike std::chrono::steady_cloc=
k, this custom clock would be useful in interfacing with OS primitives like=
 condition variables or events. Having such clock time points in audio fram=
es would be useful.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">One other t=
hing that could be useful is a clock adaptor, which implements the usual cl=
ock interface, but provides time points in sample rate units. The actual ti=
me readings would be obtained from an underlying clock. Something like this=
:</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  template&=
lt; typename BaseClock, unsigned int SampleRate &gt;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  class sam=
ple_rate_clock</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  {</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  public:</=
p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 BaseClock base_clock;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    static =
constexpr unsigned int sample_rate =3D SampleRate;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 ratio&lt; 1, sample_rate &gt; period;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 typename base_clock::rep rep;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 std::chrono::duration&lt; rep, period &gt; duration;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    typedef=
 std::chrono::time_point&lt; sample_rate_clock &gt; time_point;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    // ...e=
tc. - other clock members as usual,</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    // impo=
rted from BaseClock as needed</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    static =
time_point now()</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    {</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">      retur=
n time_point(duration_cast&lt; duration &gt;(</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">        bas=
e_clock::now().time_since_epoch()));</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    }</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  };</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Or, on the =
second thought, this might be a generic tool, not related to audio processi=
ng at all...</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>

<p></p>

-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe">https://groups.=
google.com/a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe</a>.<=
br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@=
isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2271827.u9FbM9WbyY%40lastique-pc?utm_=
medium=3Demail&amp;utm_source=3Dfooter">https://groups.google.com/a/isocpp.=
org/d/msgid/std-proposals/2271827.u9FbM9WbyY%40lastique-pc</a>.<br>
</div></blockquote></div></blockquote></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/31D8D875-9842-4CC4-98C6-F75FD20155DE%=
40gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/31D8D875-9842-4CC4-98C6-F75FD20155DE%=
40gmail.com</a>.<br />

--Apple-Mail-86D056F0-B3B8-4F9C-9D24-B9CDB86B9045--

.


Author: alexander.zywicki@gmail.com
Date: Fri, 10 Jun 2016 07:46:00 -0500
Raw View
--Apple-Mail-6E78E1F5-1293-4B8B-B9FA-C792DDBEC784
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I see know what you mean.

Do the IO "driver" would take time stamps at the start and finish of each b=
uffer and calculate the actual operating sample rate of each clock domain? =
That information would also be of use for  latency calculation because we c=
ould predict when the next buffer should come and then determine when it do=
es and note the difference?

> On Jun 10, 2016, at 3:06 AM, ross.bencina@gmail.com wrote:
>=20
> > Do you have any suggestions as far as an explicit notion of time should=
 be in this context?
>=20
> It needs to be a monotonic system clock.
>=20
> And you need to be able to correlate it with your i/o buffers.
>=20
> But you can not assume (as I think you have) that i/o buffers represent a=
 contiguous stream of samples, because there can be dropped buffers, and yo=
u need to represent this. (btw. this is another example of how real-time au=
dio is not like an iostream).
>=20
> Something I forgot earlier: each DAC or ADC may be running in a different=
 clock domain. The CPU time is usually another clock domain. So you have mu=
ltiple drifting clocks. One consequence of this is that you can't make simp=
lifying assumptions that e.g. 44100 samples elapsed is exactly 1 second of =
system monotonic time. That's why you need timestamps associated with the b=
uffers, so that the client can estimate the actual sample rate.
>=20
>=20

--=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/0F247BF9-8538-4D08-8975-386F059F9662%40gmail.com=
..

--Apple-Mail-6E78E1F5-1293-4B8B-B9FA-C792DDBEC784
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=
=3Dutf-8"></head><body dir=3D"auto"><div></div><div>I see know what you mea=
n.</div><div><br></div><div>Do the IO "driver" would take time stamps at th=
e start and finish of each buffer and calculate the actual operating sample=
 rate of each clock domain? That information would also be of use for &nbsp=
;latency calculation because we could predict when the next buffer should c=
ome and then determine when it does and note the difference?</div><div><br>=
On Jun 10, 2016, at 3:06 AM, <a href=3D"mailto:ross.bencina@gmail.com">ross=
..bencina@gmail.com</a> wrote:<br><br></div><blockquote type=3D"cite"><div><=
div dir=3D"ltr">&gt;&nbsp;<span style=3D"color: rgb(136, 136, 136);">Do you=
 have any suggestions as far as an explicit notion of time should be in thi=
s context?</span><div><span style=3D"color: rgb(136, 136, 136);"><br></span=
></div><div><span style=3D"color: rgb(136, 136, 136);">It needs to be a mon=
otonic system clock.</span></div><div><br></div><div>And you need to be abl=
e to correlate it with your i/o buffers.</div><div><br></div><div>But you c=
an not assume (as I think you have) that i/o buffers represent a contiguous=
 stream of samples, because there can be dropped buffers, and you need to r=
epresent this. (btw. this is another example of how real-time audio is not =
like an iostream).</div><div><br></div><div>Something I forgot earlier: eac=
h DAC or ADC may be running in a different clock domain. The CPU time is us=
ually another clock domain. So you have multiple drifting clocks. One conse=
quence of this is that you can't make simplifying assumptions that e.g. 441=
00 samples elapsed is exactly 1 second of system monotonic time. That's why=
 you need timestamps associated with the buffers, so that the client can es=
timate the actual sample rate.</div><div><br></div><div><br></div></div></d=
iv></blockquote></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0F247BF9-8538-4D08-8975-386F059F9662%=
40gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0F247BF9-8538-4D08-8975-386F059F9662%=
40gmail.com</a>.<br />

--Apple-Mail-6E78E1F5-1293-4B8B-B9FA-C792DDBEC784--

.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Sat, 11 Jun 2016 11:03:21 +0300
Raw View
This is a multi-part message in MIME format.

--nextPart2681720.v7ipKe8ngQ
Content-Type: text/plain; charset=UTF-8

On Saturday, 11 June 2016 10:55:17 MSK alexander.zywicki@gmail.com wrote:
> I lie your thought on the clock idea and +1 for the example. A few thoughts
> though, I would like to explain the distinction that I draw between an
> "arbitrary epoch" and a "dynamic epoch" as I had proposed. It would not be
> arbitrary in that it would be set to some random point, but rather would be
> set too a significant time point in terms of the current instance of the
> program... It would be reset to the time when the stream was started. In
> port audio it would be set to the time when Pa_StartStream was called,
> having that as a reference point would allow you to manage the local time
> within that stream easily.

If I understood you right, that's exactly what I'm arguing against.

> As a second note the sample rate will most likely need to be a runtime
> parameter and cannot be a template parameter because of such( unless we
> specify the need for a factory to create clocks of different sample rates)
> we will probably not know the desired sample rate or even the supported
> sampling rates at compile time

A runtime-set precision cannot be implemented with chrono. I would suggest to just
avoid the sample rate based clocks then and use timestamps in conventional units (ms,
us, ns...).

--
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 email 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/4997224.LIi1sQ1Xyy%40lastique-pc.

--nextPart2681720.v7ipKe8ngQ
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-=
html40/strict.dtd">
<html><head><meta name=3D"qrichtext" content=3D"1" /><style type=3D"text/cs=
s">
p, li { white-space: pre-wrap; }
</style></head><body style=3D" font-family:'DejaVu Sans Mono'; font-size:9p=
t; font-weight:400; font-style:normal;">
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Saturday=
, 11 June 2016 10:55:17 MSK alexander.zywicki@gmail.com wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; I lie =
your thought on the clock idea and +1 for the example. A few thoughts</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; though=
, I would like to explain the distinction that I draw between an</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &quot;=
arbitrary epoch&quot; and a &quot;dynamic epoch&quot; as I had proposed. It=
 would not be</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; arbitr=
ary in that it would be set to some random point, but rather would be</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; set to=
o a significant time point in terms of the current instance of the</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; progra=
m... It would be reset to the time when the stream was started. In</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; port a=
udio it would be set to the time when Pa_StartStream was called,</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; having=
 that as a reference point would allow you to manage the local time</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; within=
 that stream easily.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">If I unders=
tood you right, that's exactly what I'm arguing against.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; As a s=
econd note the sample rate will most likely need to be a runtime</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; parame=
ter and cannot be a template parameter because of such( unless we</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; specif=
y the need for a factory to create clocks of different sample rates)</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; we wil=
l probably not know the desired sample rate or even the supported</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; sampli=
ng rates at compile time</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">A runtime-s=
et precision cannot be implemented with chrono. I would suggest to just avo=
id the sample rate based clocks then and use timestamps in conventional uni=
ts (ms, us, ns...).</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/4997224.LIi1sQ1Xyy%40lastique-pc?utm_=
medium=3Demail&utm_source=3Dfooter">https://groups.google.com/a/isocpp.org/=
d/msgid/std-proposals/4997224.LIi1sQ1Xyy%40lastique-pc</a>.<br />

--nextPart2681720.v7ipKe8ngQ--


.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Sat, 11 Jun 2016 11:09:50 +0300
Raw View
This is a multi-part message in MIME format.

--nextPart97720920.6ZTK7XLkJK
Content-Type: text/plain; charset=UTF-8

On Saturday, 11 June 2016 11:03:41 MSK alexander.zywicki@gmail.com wrote:
> Or at least store a time point each time the stream is started using a clock
> with a well defined epoch, so that we might be able to find the length of
> time that the stream has been active and have meaningful measurements of
> time within the stream.

There is no need to have the epoch bound to the beginning of the stream to
calculate its duration. Or any particular epoch at all. All you need is the
timestamp of its first and last frames.

A fixed epoch becomes important when you try to synchronize multiple streams
together. But even then it's not important what exactly is the epoch; what is
important is that it has to be the same for all streams you are processing.

--
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 email 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/3560828.vAATzG8HgS%40lastique-pc.

--nextPart97720920.6ZTK7XLkJK
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-=
html40/strict.dtd">
<html><head><meta name=3D"qrichtext" content=3D"1" /><style type=3D"text/cs=
s">
p, li { white-space: pre-wrap; }
</style></head><body style=3D" font-family:'DejaVu Sans Mono'; font-size:9p=
t; font-weight:400; font-style:normal;">
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Saturday=
, 11 June 2016 11:03:41 MSK alexander.zywicki@gmail.com wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; Or at =
least store a time point each time the stream is started using a clock</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; with a=
 well defined epoch, so that we might be able to find the length of</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; time t=
hat the stream has been active and have meaningful measurements of</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; time w=
ithin the stream.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">There is no=
 need to have the epoch bound to the beginning of the stream to calculate i=
ts duration. Or any particular epoch at all. All you need is the timestamp =
of its first and last frames.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">A fixed epo=
ch becomes important when you try to synchronize multiple streams together.=
 But even then it's not important what exactly is the epoch; what is import=
ant is that it has to be the same for all streams you are processing.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/3560828.vAATzG8HgS%40lastique-pc?utm_=
medium=3Demail&utm_source=3Dfooter">https://groups.google.com/a/isocpp.org/=
d/msgid/std-proposals/3560828.vAATzG8HgS%40lastique-pc</a>.<br />

--nextPart97720920.6ZTK7XLkJK--


.


Author: "dgutson ." <danielgutson@gmail.com>
Date: Sun, 12 Jun 2016 00:00:01 -0300
Raw View
--94eb2c08e626d0615d05350bf791
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Sorry top posting or if this has been already pointed.
Is there any reason this hasn't been submitted to Boost and let it mature
there for few years?
El 3/6/2016 6:37, <alexander.zywicki@gmail.com> escribi=C3=B3:

> I have drafted some ideas on how I think the c++ std library could suppor=
t
> audio functionality.
>
> I know that audio functionality is a very operating specific problem, but
> with the recent trend towards implementing a file-system library and
> possibly a graphics library I believe that audio would not be too much of=
 a
> reach anymore.
>
> Here are some of the ideas I have so far. I have both some code examples
> of the intended usage as well as a list of the types needed to implement
> the given examples.
>
> Please keep in mind my drafts are still very rough.
>
>
> CODE EXAMPLES
>
> //std::audio example 1 "single process"
> void example_1(){
>     double sample_rate =3D 44100;
>     std::size_t frame_size =3D2;
>     std::size_t buffer_size=3D128;
>
>     std::audio_context<float> ctx{sample_rate,buffer_size,frame_size};//c=
ontruct
> from values
>
>     std::astream_process<float> proc(ctx,[](std::iastream const& input,
> std::oastream& output){
>         std::frame_buffer<float>& buff =3D ctx.borrow_buffer();//borrow a
> buffer from the context for usage
>         //prevents the need for dynamic allocation of a temporary buffer
>         input>>buff;//stream data into buffer for manipulation
>         for(auto&& frame: buff){
>             frame=3D0.0;//do something with audio
>         }
>         output<<buff;//stream to output
>     });//dsp object
>     //uses implied routing equivilent to
>     //std::aout<<proc<<std::ain;
>     //
>
>     proc.start();
>     //do other stuff
>     proc.stop();
> }
>
> //std::audio example 2 "process group"
> void example_2(){
>
>     std::audio_context<float> ctx;//default context created with
> std::default_* values
>
>     //version 1: capture context via lambda
>     std::astream_process<float> proc1(ctx,[&ctx](std::iastream const&
> input, std::oastream& output){
>         std::frame_buffer<float>& buff =3D ctx.borrow_buffer();
>         input>>buff;
>         for(auto&& frame: buff){
>             frame*=3D0.5;
>         }
>         output<<buff;
>     });//dsp object
>
>     //version 2: have context passed as argument
>     std::astream_process<float> proc2(ctx,[](std::iastream const& input,
> std::oastream& output,std::audio_context<float> const& context){
>         std::frame_buffer<float>& buff =3D ctx.borrow_buffer();
>         input>>buff;
>         for(auto&& frame: buff){
>             frame*=3D2.0;
>         }
>         output<<buff;
>     });
>
>     std::process_group<float> pgroup;//a group of processes that will
> happen consecutivley
>     pgroup.push(proc1);//add to group
>     pgroup.push(proc2);//add to group
>
>     //configure stream relationships in terms of std::ain / std:aout
> manually
>     //std::ain/std::aout are std::astream globals that refer to the
> default audio inputs and outputs supplied by the context in use
>     //std::ain/std::aout will route the audio to the enpoint specified by
> the context reference held by the process that is streaming the data
>     std::aout<<proc1<<proc2<<std::ain;//method 1
>     //std::ain>>proc2>>proc1>>std::aout;//method 2
>
>     pgroup.start();
>     //do other stuff
>     pgroup.stop();
>
> }
>
>
> //std::audio example 3 "audio files"
> void example_3(){
>
>     std::audio_context<float> ctx;
>
>     std::astream_process<float> proc(ctx,[](std::iafstream const& input,
> std::oafstream& output){
>         std::frame_buffer<float>& buff =3D ctx.borrow_buffer();
>         input>>buff;
>         for(auto&& frame: buff){
>             frame=3D0.0;
>         }
>         output<<buff;
>     });//dsp object
>
>     std::iafstream audio_file1(ctx,"filename1.extension");//an audio file
> handle
>     std::oafstream audio_file2(ctx,"filename2.extension");//an audio file
> handle
>
>     //routing
>     audio_file2<<proc<<audio_file1;//take input from file nad write to
> file
>     //audio_file1>>proc>>audio_file2;//equivilent syntax
>     proc.start();
>     //do other stuff
>     proc.stop();
> }
>
>
> //std::audio example 4 "combination routing"
> void example_3(){
>
>     std::audio_context<float> ctx;
>     //manually select hardware endpoints
>     std::size_t device_id =3D ctx.default_device_id();
>     std::iastream input_device =3D ctx.get_device<std::input_device>(
> device_id);
>     std::oastream output_device =3D ctx.get_device<std::output_device>(
> device_id);
>
>     std::astream_process<float> proc(ctx,[](std::iastream const& input,
>                                             std::oastream& output,
>                                             std::iafstream const&
> input_file,
>                                              std::oafstream& output_file)=
{
>         std::frame_buffer<float>& buff =3D ctx.borrow_buffer();
>         (input + input_file)>>buff;//add streams to perform sum before
> writing to buffer
>         //or you could use seperate buffers
>         //like this
>         /*
>             std::frame_buffer<float> buff1;
>             std::frame_buffer<float> buff2;
>
>             input>>buff1;
>             input_file>>buff2;
>             buff1+=3Dbuff2;//buffer arithmatic
>         */
>         output<<buff;//send the contents of buff to the hardware out and
> the file out
>         output_file<<buff;
>     });
>
>     std::iafstream audio_file1(ctx,"filename1.extension");//the actual
> files to be used above
>     std::oafstream audio_file2(ctx,"filename2.extension");
>
>     //connect the files to the process
>     //connect the hardware device to the process
>     audio_file2<<proc<<audio_file1;//take input from file
>     output_device<<proc<<input_device;//also take from hardware
>     proc.start();
>     //do other stuff
>     proc.stop();
> }
>
>
>
> REQUIRED LIBRARY MEMBERS
>
>
> namespace std{
>     inline namespace audio{
>         //working context for audio flow
>         template<typename>
>         class audio_context;
>         /*
>         *The context in which all audio data is centered.
>         *Contains: sampling rate, buffer size, frame size, etc...
>         *The values of ain,aout,afin,afout refer to the endpoints defined
> by the context, when applied to routing on a porocess tied to the context
>         *think of a context as the program level driver object
>         */
>
>         //audio streams (think like std::fstream and its friends)
>         class astream;//audio stream
>         class oastream;//output audio stream
>         class iastream;//input audio stream
>         class oafstream;//output audio file stream
>         class iafstream;//input audio file stream
>
>
>         //stream endpoints
>         class ain;//audio input endpoint
>         class aout;//audio output endpoint
>         class afin;//audio file input endpoint
>         class afout//audio file output endpoint
>
>         //stream processing
>         template<typename>
>         class astream_process;//a dsp process applied to a stream
>
>         template<typename>
>         class process_group;//a group of processes that will act as one
>
>         //containers
>         template<typename>
>         class frame_buffer;//a sequence container that is resizeable at
> runtime, but only with explicit resize calls. contains frames(see below)
>         /*Implementation note on frame_buffer
>          *frame_buffer is intended to hold N number of frames which
> themselves can hold M number of samples
>          *meaning that the total size in samples if frame_buffer =3D N * =
M
>          *ideally frame_buffers representation of its sample data will be
> continuous in memory
>         */
>
>         template<typename>
>         class frame;//a container that holds samples, thin array wrapper
>
>
>         //hardware representation
>         class device;//an audio device as recognized by the OS
>         class input_device;//an input device
>         class output_device;//an output device
>
>         // audio file formats
>         enum class afformat{
>             raw,//raw headerless audio bytes, interpreted only by the
> settings of the context.
>             //best used for temporary storage within the life of a contex=
t
>             wav,
>             flac//etc...
>         }
>     }
> }
>
>
>
> --
> 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
> email 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/f490fd21-cf0=
7-4d7b-8936-c71c97a1ab9d%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f490fd21-cf=
07-4d7b-8936-c71c97a1ab9d%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>

--=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/CAFdMc-0Dj4BGW0v8ORrcgGM54D5_ZunT2At0OWFEDFr-3CY=
WBw%40mail.gmail.com.

--94eb2c08e626d0615d05350bf791
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p dir=3D"ltr">Sorry top posting or if this has been already pointed.<br>
Is there any reason this hasn&#39;t been submitted to Boost and let it matu=
re there for few years?</p>
<div class=3D"gmail_quote">El 3/6/2016 6:37,  &lt;<a href=3D"mailto:alexand=
er.zywicki@gmail.com">alexander.zywicki@gmail.com</a>&gt; escribi=C3=B3:<br=
 type=3D"attribution"><blockquote class=3D"gmail_quote" style=3D"margin:0 0=
 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">I hav=
e drafted some ideas on how I think the c++ std library could support audio=
 functionality. <br><br>I know that audio functionality is a very operating=
 specific problem, but with the recent trend towards implementing a file-sy=
stem library and possibly a graphics library I believe that audio would not=
 be too much of a reach anymore.<br><br>Here are some of the ideas I have s=
o far. I have both some code examples of the intended usage as well as a li=
st of the types needed to implement the given examples.<br><br>Please keep =
in mind my drafts are still very rough.<br><br><br>CODE EXAMPLES<br><br><di=
v style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);=
border-style:solid;border-width:1px;word-wrap:break-word"><code><div><span =
style=3D"color:#800">//std::audio example 1 &quot;single process&quot;</spa=
n><span style=3D"color:#000"><br></span><span style=3D"color:#008">void</sp=
an><span style=3D"color:#000"> example_1</span><span style=3D"color:#660">(=
)</span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#008">double</span><span style=3D=
"color:#000"> sample_rate </span><span style=3D"color:#660">=3D</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#066">44100</span><span =
style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 s=
td</span><span style=3D"color:#660">::</span><span style=3D"color:#000">siz=
e_t frame_size </span><span style=3D"color:#660">=3D</span><span style=3D"c=
olor:#066">2</span><span style=3D"color:#660">;</span><span style=3D"color:=
#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span=
 style=3D"color:#000">size_t buffer_size</span><span style=3D"color:#660">=
=3D</span><span style=3D"color:#066">128</span><span style=3D"color:#660">;=
</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span><span sty=
le=3D"color:#660">::</span><span style=3D"color:#000">audio_context</span><=
span style=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#000"> c=
tx</span><span style=3D"color:#660">{</span><span style=3D"color:#000">samp=
le_rate</span><span style=3D"color:#660">,</span><span style=3D"color:#000"=
>buffer_size</span><span style=3D"color:#660">,</span><span style=3D"color:=
#000">frame_size</span><span style=3D"color:#660">};</span><span style=3D"c=
olor:#800">//contruct from values</span><span style=3D"color:#000"><br><br>=
=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=3D"=
color:#000">astream_process</span><span style=3D"color:#080">&lt;float&gt;<=
/span><span style=3D"color:#000"> proc</span><span style=3D"color:#660">(</=
span><span style=3D"color:#000">ctx</span><span style=3D"color:#660">,[](</=
span><span style=3D"color:#000">std</span><span style=3D"color:#660">::</sp=
an><span style=3D"color:#000">iastream </span><span style=3D"color:#008">co=
nst</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"=
> input</span><span style=3D"color:#660">,</span><span style=3D"color:#000"=
> std</span><span style=3D"color:#660">::</span><span style=3D"color:#000">=
oastream</span><span style=3D"color:#660">&amp;</span><span style=3D"color:=
#000"> output</span><span style=3D"color:#660">){</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color:#660=
">::</span><span style=3D"color:#000">frame_buffer</span><span style=3D"col=
or:#080">&lt;float&gt;</span><span style=3D"color:#660">&amp;</span><span s=
tyle=3D"color:#000"> buff </span><span style=3D"color:#660">=3D</span><span=
 style=3D"color:#000"> ctx</span><span style=3D"color:#660">.</span><span s=
tyle=3D"color:#000">borrow_buffer</span><span style=3D"color:#660">();</spa=
n><span style=3D"color:#800">//borrow a buffer from the context for usage</=
span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><spa=
n style=3D"color:#800">//prevents the need for dynamic allocation of a temp=
orary buffer</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 input</span><span style=3D"color:#660">&gt;&gt;</span><span style=3D"co=
lor:#000">buff</span><span style=3D"color:#660">;</span><span style=3D"colo=
r:#800">//stream data into buffer for manipulation</span><span style=3D"col=
or:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">=
for</span><span style=3D"color:#660">(</span><span style=3D"color:#008">aut=
o</span><span style=3D"color:#660">&amp;&amp;</span><span style=3D"color:#0=
00"> frame</span><span style=3D"color:#660">:</span><span style=3D"color:#0=
00"> buff</span><span style=3D"color:#660">){</span><span style=3D"color:#0=
00"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame</span><span style=
=3D"color:#660">=3D</span><span style=3D"color:#066">0.0</span><span style=
=3D"color:#660">;</span><span style=3D"color:#800">//do something with audi=
o</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><=
span style=3D"color:#660">}</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 output</span><span style=3D"color:#660">&lt;&lt;</span><s=
pan style=3D"color:#000">buff</span><span style=3D"color:#660">;</span><spa=
n style=3D"color:#800">//stream to output</span><span style=3D"color:#000">=
<br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">});</span><span style=
=3D"color:#800">//dsp object</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:#800">//uses implied routing equivilent =
to</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D=
"color:#800">//std::aout&lt;&lt;proc&lt;&lt;std::ain;</span><span style=3D"=
color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">//</span><s=
pan style=3D"color:#000"><br><br>=C2=A0 =C2=A0 proc</span><span style=3D"co=
lor:#660">.</span><span style=3D"color:#000">start</span><span style=3D"col=
or:#660">();</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><spa=
n style=3D"color:#800">//do other stuff</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 proc</span><span style=3D"color:#660">.</span><span style=
=3D"color:#000">stop</span><span style=3D"color:#660">();</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#660">}</span><span style=
=3D"color:#000"><br><br></span><span style=3D"color:#800">//std::audio exam=
ple 2 &quot;process group&quot;</span><span style=3D"color:#000"><br></span=
><span style=3D"color:#008">void</span><span style=3D"color:#000"> example_=
2</span><code><span style=3D"color:#660">()</span><span style=3D"color:#660=
"></span></code><span style=3D"color:#660">{</span><span style=3D"color:#00=
0"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><spa=
n style=3D"color:#000">audio_context</span><span style=3D"color:#080">&lt;f=
loat&gt;</span><span style=3D"color:#000"> ctx</span><span style=3D"color:#=
660">;</span><span style=3D"color:#800">//default context created with std:=
:default_* values</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 </=
span><span style=3D"color:#800">//version 1: capture context via lambda</sp=
an><span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"co=
lor:#660">::</span><span style=3D"color:#000">astream_process</span><span s=
tyle=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#000"> proc1</=
span><span style=3D"color:#660">(</span><span style=3D"color:#000">ctx</spa=
n><span style=3D"color:#660">,[&amp;</span><span style=3D"color:#000">ctx</=
span><span style=3D"color:#660">](</span><span style=3D"color:#000">std</sp=
an><span style=3D"color:#660">::</span><span style=3D"color:#000">iastream =
</span><span style=3D"color:#008">const</span><span style=3D"color:#660">&a=
mp;</span><span style=3D"color:#000"> input</span><span style=3D"color:#660=
">,</span><span style=3D"color:#000"> std</span><span style=3D"color:#660">=
::</span><span style=3D"color:#000">oastream</span><span style=3D"color:#66=
0">&amp;</span><span style=3D"color:#000"> output</span><span style=3D"colo=
r:#660">){</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 std</span><span style=3D"color:#660">::</span><span style=3D"color:#000">f=
rame_buffer</span><span style=3D"color:#080">&lt;float&gt;</span><span styl=
e=3D"color:#660">&amp;</span><span style=3D"color:#000"> buff </span><span =
style=3D"color:#660">=3D</span><span style=3D"color:#000"> ctx</span><span =
style=3D"color:#660">.</span><span style=3D"color:#000">borrow_buffer</span=
><span style=3D"color:#660">();</span><span style=3D"color:#000"><br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 input</span><span style=3D"color:#660">&gt;&gt;</span=
><span style=3D"color:#000">buff</span><span style=3D"color:#660">;</span><=
span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span styl=
e=3D"color:#008">for</span><span style=3D"color:#660">(</span><span style=
=3D"color:#008">auto</span><span style=3D"color:#660">&amp;&amp;</span><spa=
n style=3D"color:#000"> frame</span><span style=3D"color:#660">:</span><spa=
n style=3D"color:#000"> buff</span><span style=3D"color:#660">){</span><spa=
n style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame<=
/span><span style=3D"color:#660">*=3D</span><span style=3D"color:#066">0.5<=
/span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span st=
yle=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span style=
=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000">buff</span><span =
style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 <=
/span><span style=3D"color:#660">});</span><span style=3D"color:#800">//dsp=
 object</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 </span><span=
 style=3D"color:#800">//version 2: have context passed as argument</span><s=
pan style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#=
660">::</span><span style=3D"color:#000">astream_process</span><span style=
=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#000"> proc2</span=
><span style=3D"color:#660">(</span><span style=3D"color:#000">ctx</span><s=
pan style=3D"color:#660">,[](</span><span style=3D"color:#000">std</span><s=
pan style=3D"color:#660">::</span><span style=3D"color:#000">iastream </spa=
n><span style=3D"color:#008">const</span><span style=3D"color:#660">&amp;</=
span><span style=3D"color:#000"> input</span><span style=3D"color:#660">,</=
span><span style=3D"color:#000"> std</span><span style=3D"color:#660">::</s=
pan><span style=3D"color:#000">oastream</span><span style=3D"color:#660">&a=
mp;</span><span style=3D"color:#000"> output</span><span style=3D"color:#66=
0">,</span><span style=3D"color:#000">std</span><span style=3D"color:#660">=
::</span><span style=3D"color:#000">audio_context</span><span style=3D"colo=
r:#080">&lt;float&gt;</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">const</span><span style=3D"color:#660">&amp;</span><span st=
yle=3D"color:#000"> context</span><span style=3D"color:#660">){</span><span=
 style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=
=3D"color:#660">::</span><span style=3D"color:#000">frame_buffer</span><spa=
n style=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#660">&amp;=
</span><span style=3D"color:#000"> buff </span><span style=3D"color:#660">=
=3D</span><span style=3D"color:#000"> ctx</span><span style=3D"color:#660">=
..</span><span style=3D"color:#000">borrow_buffer</span><span style=3D"color=
:#660">();</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 input</span><span style=3D"color:#660">&gt;&gt;</span><span style=3D"color=
:#000">buff</span><span style=3D"color:#660">;</span><span style=3D"color:#=
000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">for<=
/span><span style=3D"color:#660">(</span><span style=3D"color:#008">auto</s=
pan><span style=3D"color:#660">&amp;&amp;</span><span style=3D"color:#000">=
 frame</span><span style=3D"color:#660">:</span><span style=3D"color:#000">=
 buff</span><span style=3D"color:#660">){</span><span style=3D"color:#000">=
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame</span><span style=3D"co=
lor:#660">*=3D</span><span style=3D"color:#066">2.0</span><span style=3D"co=
lor:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:#660">}</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span style=3D"color:#660">&lt;&=
lt;</span><span style=3D"color:#000">buff</span><span style=3D"color:#660">=
;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"=
color:#660">});</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 std<=
/span><span style=3D"color:#660">::</span><span style=3D"color:#000">proces=
s_group</span><span style=3D"color:#080">&lt;float&gt;</span><span style=3D=
"color:#000"> pgroup</span><span style=3D"color:#660">;</span><span style=
=3D"color:#800">//a group of processes that will happen consecutivley</span=
><span style=3D"color:#000"><br>=C2=A0 =C2=A0 pgroup</span><span style=3D"c=
olor:#660">.</span><span style=3D"color:#000">push</span><span style=3D"col=
or:#660">(</span><span style=3D"color:#000">proc1</span><span style=3D"colo=
r:#660">);</span><span style=3D"color:#800">//add to group</span><span styl=
e=3D"color:#000"><br>=C2=A0 =C2=A0 pgroup</span><span style=3D"color:#660">=
..</span><span style=3D"color:#000">push</span><span style=3D"color:#660">(<=
/span><span style=3D"color:#000">proc2</span><span style=3D"color:#660">);<=
/span><span style=3D"color:#800">//add to group</span><span style=3D"color:=
#000"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">//configure s=
tream relationships in terms of std::ain / std:aout manually</span><span st=
yle=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">//st=
d::ain/std::aout are std::astream globals that refer to the default audio i=
nputs and outputs supplied by the context in use</span><span style=3D"color=
:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">//std::ain/std::=
aout will route the audio to the enpoint specified by the context reference=
 held by the process that is streaming the data</span><span style=3D"color:=
#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span=
 style=3D"color:#000">aout</span><span style=3D"color:#660">&lt;&lt;</span>=
<span style=3D"color:#000">proc1</span><span style=3D"color:#660">&lt;&lt;<=
/span><span style=3D"color:#000">proc2</span><span style=3D"color:#660">&lt=
;&lt;</span><span style=3D"color:#000">std</span><span style=3D"color:#660"=
>::</span><span style=3D"color:#000">ain</span><span style=3D"color:#660">;=
</span><span style=3D"color:#800">//method 1</span><span style=3D"color:#00=
0"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">//std::ain&gt;&gt;pr=
oc2&gt;&gt;proc1&gt;&gt;std::aout;//method 2</span><span style=3D"color:#00=
0"><br><br>=C2=A0 =C2=A0 pgroup</span><span style=3D"color:#660">.</span><s=
pan style=3D"color:#000">start</span><span style=3D"color:#660">();</span><=
span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#80=
0">//do other stuff</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 pgro=
up</span><span style=3D"color:#660">.</span><span style=3D"color:#000">stop=
</span><span style=3D"color:#660">();</span><span style=3D"color:#000"><br>=
<br></span><span style=3D"color:#660">}</span><span style=3D"color:#000"><b=
r><br><br></span><span style=3D"color:#800">//std::audio example 3 &quot;au=
dio files&quot;</span><span style=3D"color:#000"><br></span><span style=3D"=
color:#008">void</span><span style=3D"color:#000"> example_3</span><code><s=
pan style=3D"color:#660">()</span><span style=3D"color:#660"></span></code>=
<span style=3D"color:#660">{</span><span style=3D"color:#000"><br><br>=C2=
=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=3D"col=
or:#000">audio_context</span><span style=3D"color:#080">&lt;float&gt;</span=
><span style=3D"color:#000"> ctx</span><span style=3D"color:#660">;</span><=
span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"co=
lor:#660">::</span><span style=3D"color:#000">astream_process</span><span s=
tyle=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#000"> proc</s=
pan><span style=3D"color:#660">(</span><span style=3D"color:#000">ctx</span=
><span style=3D"color:#660">,[](</span><span style=3D"color:#000">std</span=
><span style=3D"color:#660">::</span><span style=3D"color:#000">iafstream <=
/span><span style=3D"color:#008">const</span><span style=3D"color:#660">&am=
p;</span><span style=3D"color:#000"> input</span><span style=3D"color:#660"=
>,</span><span style=3D"color:#000"> std</span><span style=3D"color:#660">:=
:</span><span style=3D"color:#000">oafstream</span><span style=3D"color:#66=
0">&amp;</span><span style=3D"color:#000"> output</span><span style=3D"colo=
r:#660">){</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 std</span><span style=3D"color:#660">::</span><span style=3D"color:#000">f=
rame_buffer</span><span style=3D"color:#080">&lt;float&gt;</span><span styl=
e=3D"color:#660">&amp;</span><span style=3D"color:#000"> buff </span><span =
style=3D"color:#660">=3D</span><span style=3D"color:#000"> ctx</span><span =
style=3D"color:#660">.</span><span style=3D"color:#000">borrow_buffer</span=
><span style=3D"color:#660">();</span><span style=3D"color:#000"><br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 input</span><span style=3D"color:#660">&gt;&gt;</span=
><span style=3D"color:#000">buff</span><span style=3D"color:#660">;</span><=
span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span styl=
e=3D"color:#008">for</span><span style=3D"color:#660">(</span><span style=
=3D"color:#008">auto</span><span style=3D"color:#660">&amp;&amp;</span><spa=
n style=3D"color:#000"> frame</span><span style=3D"color:#660">:</span><spa=
n style=3D"color:#000"> buff</span><span style=3D"color:#660">){</span><spa=
n style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame<=
/span><span style=3D"color:#660">=3D</span><span style=3D"color:#066">0.0</=
span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span st=
yle=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span style=
=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000">buff</span><span =
style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 <=
/span><span style=3D"color:#660">});</span><span style=3D"color:#800">//dsp=
 object</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span><s=
pan style=3D"color:#660">::</span><span style=3D"color:#000">iafstream audi=
o_file1</span><span style=3D"color:#660">(</span><span style=3D"color:#000"=
>ctx</span><span style=3D"color:#660">,</span><span style=3D"color:#080">&q=
uot;filename1.extension&quot;</span><span style=3D"color:#660">);</span><sp=
an style=3D"color:#800">//an audio file handle</span><span style=3D"color:#=
000"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span =
style=3D"color:#000">oafstream audio_file2</span><span style=3D"color:#660"=
>(</span><span style=3D"color:#000">ctx</span><span style=3D"color:#660">,<=
/span><span style=3D"color:#080">&quot;filename2.extension&quot;</span><spa=
n style=3D"color:#660">);</span><span style=3D"color:#800">//an audio file =
handle</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 </span><span =
style=3D"color:#800">//routing</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 audio_file2</span><span style=3D"color:#660">&lt;&lt;</span><span st=
yle=3D"color:#000">proc</span><span style=3D"color:#660">&lt;&lt;</span><sp=
an style=3D"color:#000">audio_file1</span><span style=3D"color:#660">;</spa=
n><span style=3D"color:#800">//take input from file nad write to file</span=
><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#=
800">//audio_file1&gt;&gt;proc&gt;&gt;audio_file2;//equivilent syntax</span=
><span style=3D"color:#000"><br>=C2=A0 =C2=A0 proc</span><span style=3D"col=
or:#660">.</span><span style=3D"color:#000">start</span><span style=3D"colo=
r:#660">();</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span=
 style=3D"color:#800">//do other stuff</span><span style=3D"color:#000"><br=
>=C2=A0 =C2=A0 proc</span><span style=3D"color:#660">.</span><span style=3D=
"color:#000">stop</span><span style=3D"color:#660">();</span><span style=3D=
"color:#000"><br></span><span style=3D"color:#660">}</span><span style=3D"c=
olor:#000"><br><br><br></span><span style=3D"color:#800">//std::audio examp=
le 4 &quot;combination routing&quot;</span><span style=3D"color:#000"><br><=
/span><span style=3D"color:#008">void</span><span style=3D"color:#000"> exa=
mple_3</span><span style=3D"color:#660"><code><span style=3D"color:#660">()=
</span><span style=3D"color:#660"></span></code>{</span><span style=3D"colo=
r:#000"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span=
><span style=3D"color:#000">audio_context</span><span style=3D"color:#080">=
&lt;float&gt;</span><span style=3D"color:#000"> ctx</span><span style=3D"co=
lor:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span=
 style=3D"color:#800">//manually select hardware endpoints</span><span styl=
e=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::<=
/span><span style=3D"color:#000">size_t device_id </span><span style=3D"col=
or:#660">=3D</span><span style=3D"color:#000"> ctx</span><span style=3D"col=
or:#660">.</span><span style=3D"color:#000">default_device_id</span><span s=
tyle=3D"color:#660">();</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
std</span><span style=3D"color:#660">::</span><span style=3D"color:#000">ia=
stream input_device </span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#000"> ctx</span><span style=3D"color:#660">.</span><span style=
=3D"color:#000">get_device</span><span style=3D"color:#660">&lt;</span><spa=
n style=3D"color:#000">std</span><span style=3D"color:#660">::</span><span =
style=3D"color:#000">input_device</span><span style=3D"color:#660">&gt;(</s=
pan><span style=3D"color:#000">device_id</span><span style=3D"color:#660">)=
;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><span style=
=3D"color:#660">::</span><span style=3D"color:#000">oastream output_device =
</span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> ctx=
</span><span style=3D"color:#660">.</span><span style=3D"color:#000">get_de=
vice</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#000"=
>std</span><span style=3D"color:#660">::</span><span style=3D"color:#000">o=
utput_device</span><span style=3D"color:#660">&gt;(</span><span style=3D"co=
lor:#000">device_id</span><span style=3D"color:#660">);</span><span style=
=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">=
::</span><span style=3D"color:#000">astream_process</span><span style=3D"co=
lor:#080">&lt;float&gt;</span><span style=3D"color:#000"> proc</span><span =
style=3D"color:#660">(</span><span style=3D"color:#000">ctx</span><span sty=
le=3D"color:#660">,[](</span><span style=3D"color:#000">std</span><span sty=
le=3D"color:#660">::</span><span style=3D"color:#000">iastream </span><span=
 style=3D"color:#008">const</span><span style=3D"color:#660">&amp;</span><s=
pan style=3D"color:#000"> input</span><span style=3D"color:#660">,</span><s=
pan style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color:#660">::<=
/span><span style=3D"color:#000">oastream</span><span style=3D"color:#660">=
&amp;</span><span style=3D"color:#000"> output</span><span style=3D"color:#=
660">,</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"c=
olor:#660">::</span><span style=3D"color:#000">iafstream </span><span style=
=3D"color:#008">const</span><span style=3D"color:#660">&amp;</span><span st=
yle=3D"color:#000"> input_file</span><span style=3D"color:#660">,</span><sp=
an style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0std</span><span style=3D"color:#66=
0">::</span><span style=3D"color:#000">oafstream</span><span style=3D"color=
:#660">&amp;</span><span style=3D"color:#000"> output_file</span><span styl=
e=3D"color:#660">){</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=3D"col=
or:#000">frame_buffer</span><span style=3D"color:#080">&lt;float&gt;</span>=
<span style=3D"color:#660">&amp;</span><span style=3D"color:#000"> buff </s=
pan><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> ctx</s=
pan><span style=3D"color:#660">.</span><span style=3D"color:#000">borrow_bu=
ffer</span><span style=3D"color:#660">();</span><span style=3D"color:#000">=
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#660">(</span><=
span style=3D"color:#000">input </span><span style=3D"color:#660">+</span><=
span style=3D"color:#000"> input_file</span><span style=3D"color:#660">)&gt=
;&gt;</span><span style=3D"color:#000">buff</span><span style=3D"color:#660=
">;</span><span style=3D"color:#800">//add streams to perform sum before wr=
iting to buffer</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 </span><span style=3D"color:#800">//or you could use seperate buffer=
s</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><=
span style=3D"color:#800">//like this</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">/*<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::frame_buffer&lt;float&gt; buff1;<br=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::frame_buffer&lt;float&gt; b=
uff2;<br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 input&gt;&gt;buff1;<=
br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 input_file&gt;&gt;buff2;<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 buff1+=3Dbuff2;//buffer arithmati=
c<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 */</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span style=3D"color:#660">&lt;&lt=
;</span><span style=3D"color:#000">buff</span><span style=3D"color:#660">;<=
/span><span style=3D"color:#800">//send the contents of buff to the hardwar=
e out and the file out</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 output_file</span><span style=3D"color:#660">&lt;&lt;</span><=
span style=3D"color:#000">buff</span><span style=3D"color:#660">;</span><sp=
an style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660"=
>});</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span><span=
 style=3D"color:#660">::</span><span style=3D"color:#000">iafstream audio_f=
ile1</span><span style=3D"color:#660">(</span><span style=3D"color:#000">ct=
x</span><span style=3D"color:#660">,</span><span style=3D"color:#080">&quot=
;filename1.extension&quot;</span><span style=3D"color:#660">);</span><span =
style=3D"color:#800">//the actual files to be used above</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</=
span><span style=3D"color:#000">oafstream audio_file2</span><span style=3D"=
color:#660">(</span><span style=3D"color:#000">ctx</span><span style=3D"col=
or:#660">,</span><span style=3D"color:#080">&quot;filename2.extension&quot;=
</span><span style=3D"color:#660">);</span><span style=3D"color:#000"><br><=
br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">//connect the files to t=
he process</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span =
style=3D"color:#800">//connect the hardware device to the process</span><sp=
an style=3D"color:#000"><br>=C2=A0 =C2=A0 audio_file2</span><span style=3D"=
color:#660">&lt;&lt;</span><span style=3D"color:#000">proc</span><span styl=
e=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000">audio_file1</spa=
n><span style=3D"color:#660">;</span><span style=3D"color:#800">//take inpu=
t from file</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 output_devic=
e</span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000=
">proc</span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color=
:#000">input_device</span><span style=3D"color:#660">;</span><span style=3D=
"color:#800">//also take from hardware</span><span style=3D"color:#000"><br=
>=C2=A0 =C2=A0 proc</span><span style=3D"color:#660">.</span><span style=3D=
"color:#000">start</span><span style=3D"color:#660">();</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">//do ot=
her stuff</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 proc</span><sp=
an style=3D"color:#660">.</span><span style=3D"color:#000">stop</span><span=
 style=3D"color:#660">();</span><span style=3D"color:#000"><br></span><span=
 style=3D"color:#660">}</span></div></code></div><br><br><br>REQUIRED LIBRA=
RY MEMBERS<br><br><br><div style=3D"background-color:rgb(250,250,250);borde=
r-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:brea=
k-word"><code><div><span style=3D"color:#008">namespace</span><span style=
=3D"color:#000"> std</span><span style=3D"color:#660">{</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">inline<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#008">namespa=
ce</span><span style=3D"color:#000"> audio</span><span style=3D"color:#660"=
>{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span>=
<span style=3D"color:#800">//working context for audio flow</span><span sty=
le=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"col=
or:#008">template</span><span style=3D"color:#080">&lt;typename&gt;</span><=
span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span styl=
e=3D"color:#008">class</span><span style=3D"color:#000"> audio_context</spa=
n><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">/*<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 *The context in which all audio data is centered.<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 *Contains: sampling rate, buffer size, frame size, etc=
....<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 *The values of ain,aout,afin,afout refer=
 to the endpoints defined by the context, when applied to routing on a poro=
cess tied to the context<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 *think of a context=
 as the program level driver object<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 */</span=
><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><spa=
n style=3D"color:#800">//audio streams (think like std::fstream and its fri=
ends)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </sp=
an><span style=3D"color:#008">class</span><span style=3D"color:#000"> astre=
am</span><span style=3D"color:#660">;</span><span style=3D"color:#800">//au=
dio stream</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 </span><span style=3D"color:#008">class</span><span style=3D"color:#000"> =
oastream</span><span style=3D"color:#660">;</span><span style=3D"color:#800=
">//output audio stream</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span><span style=3D"=
color:#000"> iastream</span><span style=3D"color:#660">;</span><span style=
=3D"color:#800">//input audio stream</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span><=
span style=3D"color:#000"> oafstream</span><span style=3D"color:#660">;</sp=
an><span style=3D"color:#800">//output audio file stream</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color=
:#008">class</span><span style=3D"color:#000"> iafstream</span><span style=
=3D"color:#660">;</span><span style=3D"color:#800">//input audio file strea=
m</span><span style=3D"color:#000"><br><br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
</span><span style=3D"color:#800">//stream endpoints</span><span style=3D"c=
olor:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008=
">class</span><span style=3D"color:#000"> ain</span><span style=3D"color:#6=
60">;</span><span style=3D"color:#800">//audio input endpoint</span><span s=
tyle=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"c=
olor:#008">class</span><span style=3D"color:#000"> aout</span><span style=
=3D"color:#660">;</span><span style=3D"color:#800">//audio output endpoint<=
/span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><sp=
an style=3D"color:#008">class</span><span style=3D"color:#000"> afin</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#800">//audio file =
input endpoint</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 </span><span style=3D"color:#008">class</span><span style=3D"color:#=
000"> afout</span><span style=3D"color:#800">//audio file output endpoint</=
span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span>=
<span style=3D"color:#800">//stream processing</span><span style=3D"color:#=
000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">temp=
late</span><span style=3D"color:#080">&lt;typename&gt;</span><span style=3D=
"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#0=
08">class</span><span style=3D"color:#000"> astream_process</span><span sty=
le=3D"color:#660">;</span><span style=3D"color:#800">//a dsp process applie=
d to a stream</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 </span><span style=3D"color:#008">template</span><span style=3D"col=
or:#080">&lt;typename&gt;</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span><span style=
=3D"color:#000"> process_group</span><span style=3D"color:#660">;</span><sp=
an style=3D"color:#800">//a group of processes that will act as one</span><=
span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span =
style=3D"color:#800">//containers</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">template</span><=
span style=3D"color:#080">&lt;typename&gt;</span><span style=3D"color:#000"=
><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</s=
pan><span style=3D"color:#000"> frame_buffer</span><span style=3D"color:#66=
0">;</span><span style=3D"color:#800">//a sequence container that is resize=
able at runtime, but only with explicit resize calls. contains frames(see b=
elow)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </sp=
an><span style=3D"color:#800">/*Implementation note on frame_buffer<br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*frame_buffer is intended to hold N number o=
f frames which themselves can hold M number of samples<br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0*meaning that the total size in samples if frame_buffer =
=3D N * M<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*ideally frame_buffers repre=
sentation of its sample data will be continuous in memory<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 */</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span style=3D"color:#008">template</span><span style=3D"=
color:#080">&lt;typename&gt;</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span><span st=
yle=3D"color:#000"> frame</span><span style=3D"color:#660">;</span><span st=
yle=3D"color:#800">//a container that holds samples, thin array wrapper</sp=
an><span style=3D"color:#000"><br><br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </spa=
n><span style=3D"color:#800">//hardware representation</span><span style=3D=
"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#0=
08">class</span><span style=3D"color:#000"> device</span><span style=3D"col=
or:#660">;</span><span style=3D"color:#800">//an audio device as recognized=
 by the OS</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 </span><span style=3D"color:#008">class</span><span style=3D"color:#000"> =
input_device</span><span style=3D"color:#660">;</span><span style=3D"color:=
#800">//an input device</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span><span style=3D"=
color:#000"> output_device</span><span style=3D"color:#660">;</span><span s=
tyle=3D"color:#800">//an output device</span><span style=3D"color:#000"><br=
><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">// audio=
 file formats</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:#008">enum</span><span style=3D"color:#000"=
> </span><span style=3D"color:#008">class</span><span style=3D"color:#000">=
 afformat</span><span style=3D"color:#660">{</span><span style=3D"color:#00=
0"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 raw</span><span style=3D"c=
olor:#660">,</span><span style=3D"color:#800">//raw headerless audio bytes,=
 interpreted only by the settings of the context.</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D=
"color:#800">//best used for temporary storage within the life of a context=
</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 wav</span><span style=3D"color:#660">,</span><span style=3D"color:#0=
00"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 flac</span><span style=3D=
"color:#800">//etc...</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span s=
tyle=3D"color:#000"><br></span><span style=3D"color:#660">}</span></div></c=
ode></div><br><br><br></div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f490fd21-cf07-4d7b-8936-c71c97a1ab9d%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f490fd21-cf07-=
4d7b-8936-c71c97a1ab9d%40isocpp.org</a>.<br>
</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAFdMc-0Dj4BGW0v8ORrcgGM54D5_ZunT2At0=
OWFEDFr-3CYWBw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFdMc-0Dj4BGW0v8=
ORrcgGM54D5_ZunT2At0OWFEDFr-3CYWBw%40mail.gmail.com</a>.<br />

--94eb2c08e626d0615d05350bf791--

.


Author: "'Jeffrey Yasskin' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Sun, 12 Jun 2016 05:20:36 -0700
Raw View
--001a11490eb69953ee053513ccfb
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

It doesn't have to go through boost, but I would like to see a public
repository with a bunch of users.

On Jun 12, 2016 5:00 AM, "dgutson ." <danielgutson@gmail.com> wrote:

> Sorry top posting or if this has been already pointed.
> Is there any reason this hasn't been submitted to Boost and let it mature
> there for few years?
> El 3/6/2016 6:37, <alexander.zywicki@gmail.com> escribi=C3=B3:
>
>> I have drafted some ideas on how I think the c++ std library could
>> support audio functionality.
>>
>> I know that audio functionality is a very operating specific problem, bu=
t
>> with the recent trend towards implementing a file-system library and
>> possibly a graphics library I believe that audio would not be too much o=
f a
>> reach anymore.
>>
>> Here are some of the ideas I have so far. I have both some code examples
>> of the intended usage as well as a list of the types needed to implement
>> the given examples.
>>
>> Please keep in mind my drafts are still very rough.
>>
>>
>> CODE EXAMPLES
>>
>> //std::audio example 1 "single process"
>> void example_1(){
>>     double sample_rate =3D 44100;
>>     std::size_t frame_size =3D2;
>>     std::size_t buffer_size=3D128;
>>
>>     std::audio_context<float> ctx{sample_rate,buffer_size,frame_size};//=
contruct
>> from values
>>
>>     std::astream_process<float> proc(ctx,[](std::iastream const& input,
>> std::oastream& output){
>>         std::frame_buffer<float>& buff =3D ctx.borrow_buffer();//borrow =
a
>> buffer from the context for usage
>>         //prevents the need for dynamic allocation of a temporary buffer
>>         input>>buff;//stream data into buffer for manipulation
>>         for(auto&& frame: buff){
>>             frame=3D0.0;//do something with audio
>>         }
>>         output<<buff;//stream to output
>>     });//dsp object
>>     //uses implied routing equivilent to
>>     //std::aout<<proc<<std::ain;
>>     //
>>
>>     proc.start();
>>     //do other stuff
>>     proc.stop();
>> }
>>
>> //std::audio example 2 "process group"
>> void example_2(){
>>
>>     std::audio_context<float> ctx;//default context created with
>> std::default_* values
>>
>>     //version 1: capture context via lambda
>>     std::astream_process<float> proc1(ctx,[&ctx](std::iastream const&
>> input, std::oastream& output){
>>         std::frame_buffer<float>& buff =3D ctx.borrow_buffer();
>>         input>>buff;
>>         for(auto&& frame: buff){
>>             frame*=3D0.5;
>>         }
>>         output<<buff;
>>     });//dsp object
>>
>>     //version 2: have context passed as argument
>>     std::astream_process<float> proc2(ctx,[](std::iastream const& input,
>> std::oastream& output,std::audio_context<float> const& context){
>>         std::frame_buffer<float>& buff =3D ctx.borrow_buffer();
>>         input>>buff;
>>         for(auto&& frame: buff){
>>             frame*=3D2.0;
>>         }
>>         output<<buff;
>>     });
>>
>>     std::process_group<float> pgroup;//a group of processes that will
>> happen consecutivley
>>     pgroup.push(proc1);//add to group
>>     pgroup.push(proc2);//add to group
>>
>>     //configure stream relationships in terms of std::ain / std:aout
>> manually
>>     //std::ain/std::aout are std::astream globals that refer to the
>> default audio inputs and outputs supplied by the context in use
>>     //std::ain/std::aout will route the audio to the enpoint specified
>> by the context reference held by the process that is streaming the data
>>     std::aout<<proc1<<proc2<<std::ain;//method 1
>>     //std::ain>>proc2>>proc1>>std::aout;//method 2
>>
>>     pgroup.start();
>>     //do other stuff
>>     pgroup.stop();
>>
>> }
>>
>>
>> //std::audio example 3 "audio files"
>> void example_3(){
>>
>>     std::audio_context<float> ctx;
>>
>>     std::astream_process<float> proc(ctx,[](std::iafstream const& input,
>> std::oafstream& output){
>>         std::frame_buffer<float>& buff =3D ctx.borrow_buffer();
>>         input>>buff;
>>         for(auto&& frame: buff){
>>             frame=3D0.0;
>>         }
>>         output<<buff;
>>     });//dsp object
>>
>>     std::iafstream audio_file1(ctx,"filename1.extension");//an audio
>> file handle
>>     std::oafstream audio_file2(ctx,"filename2.extension");//an audio
>> file handle
>>
>>     //routing
>>     audio_file2<<proc<<audio_file1;//take input from file nad write to
>> file
>>     //audio_file1>>proc>>audio_file2;//equivilent syntax
>>     proc.start();
>>     //do other stuff
>>     proc.stop();
>> }
>>
>>
>> //std::audio example 4 "combination routing"
>> void example_3(){
>>
>>     std::audio_context<float> ctx;
>>     //manually select hardware endpoints
>>     std::size_t device_id =3D ctx.default_device_id();
>>     std::iastream input_device =3D ctx.get_device<std::input_device>(
>> device_id);
>>     std::oastream output_device =3D ctx.get_device<std::output_device>(
>> device_id);
>>
>>     std::astream_process<float> proc(ctx,[](std::iastream const& input,
>>                                             std::oastream& output,
>>                                             std::iafstream const&
>> input_file,
>>                                              std::oafstream& output_file
>> ){
>>         std::frame_buffer<float>& buff =3D ctx.borrow_buffer();
>>         (input + input_file)>>buff;//add streams to perform sum before
>> writing to buffer
>>         //or you could use seperate buffers
>>         //like this
>>         /*
>>             std::frame_buffer<float> buff1;
>>             std::frame_buffer<float> buff2;
>>
>>             input>>buff1;
>>             input_file>>buff2;
>>             buff1+=3Dbuff2;//buffer arithmatic
>>         */
>>         output<<buff;//send the contents of buff to the hardware out and
>> the file out
>>         output_file<<buff;
>>     });
>>
>>     std::iafstream audio_file1(ctx,"filename1.extension");//the actual
>> files to be used above
>>     std::oafstream audio_file2(ctx,"filename2.extension");
>>
>>     //connect the files to the process
>>     //connect the hardware device to the process
>>     audio_file2<<proc<<audio_file1;//take input from file
>>     output_device<<proc<<input_device;//also take from hardware
>>     proc.start();
>>     //do other stuff
>>     proc.stop();
>> }
>>
>>
>>
>> REQUIRED LIBRARY MEMBERS
>>
>>
>> namespace std{
>>     inline namespace audio{
>>         //working context for audio flow
>>         template<typename>
>>         class audio_context;
>>         /*
>>         *The context in which all audio data is centered.
>>         *Contains: sampling rate, buffer size, frame size, etc...
>>         *The values of ain,aout,afin,afout refer to the endpoints define=
d
>> by the context, when applied to routing on a porocess tied to the contex=
t
>>         *think of a context as the program level driver object
>>         */
>>
>>         //audio streams (think like std::fstream and its friends)
>>         class astream;//audio stream
>>         class oastream;//output audio stream
>>         class iastream;//input audio stream
>>         class oafstream;//output audio file stream
>>         class iafstream;//input audio file stream
>>
>>
>>         //stream endpoints
>>         class ain;//audio input endpoint
>>         class aout;//audio output endpoint
>>         class afin;//audio file input endpoint
>>         class afout//audio file output endpoint
>>
>>         //stream processing
>>         template<typename>
>>         class astream_process;//a dsp process applied to a stream
>>
>>         template<typename>
>>         class process_group;//a group of processes that will act as one
>>
>>         //containers
>>         template<typename>
>>         class frame_buffer;//a sequence container that is resizeable at
>> runtime, but only with explicit resize calls. contains frames(see below)
>>         /*Implementation note on frame_buffer
>>          *frame_buffer is intended to hold N number of frames which
>> themselves can hold M number of samples
>>          *meaning that the total size in samples if frame_buffer =3D N *=
 M
>>          *ideally frame_buffers representation of its sample data will b=
e
>> continuous in memory
>>         */
>>
>>         template<typename>
>>         class frame;//a container that holds samples, thin array wrapper
>>
>>
>>         //hardware representation
>>         class device;//an audio device as recognized by the OS
>>         class input_device;//an input device
>>         class output_device;//an output device
>>
>>         // audio file formats
>>         enum class afformat{
>>             raw,//raw headerless audio bytes, interpreted only by the
>> settings of the context.
>>             //best used for temporary storage within the life of a
>> context
>>             wav,
>>             flac//etc...
>>         }
>>     }
>> }
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Group=
s
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n
>> email 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/f490fd21-cf=
07-4d7b-8936-c71c97a1ab9d%40isocpp.org
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f490fd21-c=
f07-4d7b-8936-c71c97a1ab9d%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoo=
ter>
>> .
>>
> --
> 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
> email 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/CAFdMc-0Dj4B=
GW0v8ORrcgGM54D5_ZunT2At0OWFEDFr-3CYWBw%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFdMc-0Dj4=
BGW0v8ORrcgGM54D5_ZunT2At0OWFEDFr-3CYWBw%40mail.gmail.com?utm_medium=3Demai=
l&utm_source=3Dfooter>
> .
>

--=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/CANh-dXkYYpdDk7Xjegr7Byu1BpWE-ZiaCyyV_EMS-4%3D2n=
W1iDw%40mail.gmail.com.

--001a11490eb69953ee053513ccfb
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p dir=3D"ltr">It doesn&#39;t have to go through boost, but I would like to=
 see a public repository with a bunch of users.</p>
<div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Jun 12, 2016 5=
:00 AM, &quot;dgutson .&quot; &lt;<a href=3D"mailto:danielgutson@gmail.com"=
>danielgutson@gmail.com</a>&gt; wrote:<br type=3D"attribution"><blockquote =
class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid=
;padding-left:1ex"><p dir=3D"ltr">Sorry top posting or if this has been alr=
eady pointed.<br>
Is there any reason this hasn&#39;t been submitted to Boost and let it matu=
re there for few years?</p>
<div class=3D"gmail_quote">El 3/6/2016 6:37,  &lt;<a href=3D"mailto:alexand=
er.zywicki@gmail.com" target=3D"_blank">alexander.zywicki@gmail.com</a>&gt;=
 escribi=C3=B3:<br type=3D"attribution"><blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div=
 dir=3D"ltr">I have drafted some ideas on how I think the c++ std library c=
ould support audio functionality. <br><br>I know that audio functionality i=
s a very operating specific problem, but with the recent trend towards impl=
ementing a file-system library and possibly a graphics library I believe th=
at audio would not be too much of a reach anymore.<br><br>Here are some of =
the ideas I have so far. I have both some code examples of the intended usa=
ge as well as a list of the types needed to implement the given examples.<b=
r><br>Please keep in mind my drafts are still very rough.<br><br><br>CODE E=
XAMPLES<br><br><div style=3D"background-color:rgb(250,250,250);border-color=
:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"=
><code><div><span style=3D"color:#800">//std::audio example 1 &quot;single =
process&quot;</span><span style=3D"color:#000"><br></span><span style=3D"co=
lor:#008">void</span><span style=3D"color:#000"> example_1</span><span styl=
e=3D"color:#660">()</span><span style=3D"color:#660">{</span><span style=3D=
"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">double</sp=
an><span style=3D"color:#000"> sample_rate </span><span style=3D"color:#660=
">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#066">4=
4100</span><span style=3D"color:#660">;</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=
=3D"color:#000">size_t frame_size </span><span style=3D"color:#660">=3D</sp=
an><span style=3D"color:#066">2</span><span style=3D"color:#660">;</span><s=
pan style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#=
660">::</span><span style=3D"color:#000">size_t buffer_size</span><span sty=
le=3D"color:#660">=3D</span><span style=3D"color:#066">128</span><span styl=
e=3D"color:#660">;</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 s=
td</span><span style=3D"color:#660">::</span><span style=3D"color:#000">aud=
io_context</span><span style=3D"color:#080">&lt;float&gt;</span><span style=
=3D"color:#000"> ctx</span><span style=3D"color:#660">{</span><span style=
=3D"color:#000">sample_rate</span><span style=3D"color:#660">,</span><span =
style=3D"color:#000">buffer_size</span><span style=3D"color:#660">,</span><=
span style=3D"color:#000">frame_size</span><span style=3D"color:#660">};</s=
pan><span style=3D"color:#800">//contruct from values</span><span style=3D"=
color:#000"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</=
span><span style=3D"color:#000">astream_process</span><span style=3D"color:=
#080">&lt;float&gt;</span><span style=3D"color:#000"> proc</span><span styl=
e=3D"color:#660">(</span><span style=3D"color:#000">ctx</span><span style=
=3D"color:#660">,[](</span><span style=3D"color:#000">std</span><span style=
=3D"color:#660">::</span><span style=3D"color:#000">iastream </span><span s=
tyle=3D"color:#008">const</span><span style=3D"color:#660">&amp;</span><spa=
n style=3D"color:#000"> input</span><span style=3D"color:#660">,</span><spa=
n style=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span=
 style=3D"color:#000">oastream</span><span style=3D"color:#660">&amp;</span=
><span style=3D"color:#000"> output</span><span style=3D"color:#660">){</sp=
an><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><sp=
an style=3D"color:#660">::</span><span style=3D"color:#000">frame_buffer</s=
pan><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#66=
0">&amp;</span><span style=3D"color:#000"> buff </span><span style=3D"color=
:#660">=3D</span><span style=3D"color:#000"> ctx</span><span style=3D"color=
:#660">.</span><span style=3D"color:#000">borrow_buffer</span><span style=
=3D"color:#660">();</span><span style=3D"color:#800">//borrow a buffer from=
 the context for usage</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 </span><span style=3D"color:#800">//prevents the need for dyn=
amic allocation of a temporary buffer</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 input</span><span style=3D"color:#660">&gt;&gt;=
</span><span style=3D"color:#000">buff</span><span style=3D"color:#660">;</=
span><span style=3D"color:#800">//stream data into buffer for manipulation<=
/span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><sp=
an style=3D"color:#008">for</span><span style=3D"color:#660">(</span><span =
style=3D"color:#008">auto</span><span style=3D"color:#660">&amp;&amp;</span=
><span style=3D"color:#000"> frame</span><span style=3D"color:#660">:</span=
><span style=3D"color:#000"> buff</span><span style=3D"color:#660">){</span=
><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 f=
rame</span><span style=3D"color:#660">=3D</span><span style=3D"color:#066">=
0.0</span><span style=3D"color:#660">;</span><span style=3D"color:#800">//d=
o something with audio</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span style=3D"color:#=
660">&lt;&lt;</span><span style=3D"color:#000">buff</span><span style=3D"co=
lor:#660">;</span><span style=3D"color:#800">//stream to output</span><span=
 style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">}=
);</span><span style=3D"color:#800">//dsp object</span><span style=3D"color=
:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">//uses implied r=
outing equivilent to</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color:#800">//std::aout&lt;&lt;proc&lt;&lt;std::ain;</sp=
an><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color=
:#800">//</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 proc</span=
><span style=3D"color:#660">.</span><span style=3D"color:#000">start</span>=
<span style=3D"color:#660">();</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:#800">//do other stuff</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 proc</span><span style=3D"color:#660">.</=
span><span style=3D"color:#000">stop</span><span style=3D"color:#660">();</=
span><span style=3D"color:#000"><br></span><span style=3D"color:#660">}</sp=
an><span style=3D"color:#000"><br><br></span><span style=3D"color:#800">//s=
td::audio example 2 &quot;process group&quot;</span><span style=3D"color:#0=
00"><br></span><span style=3D"color:#008">void</span><span style=3D"color:#=
000"> example_2</span><code><span style=3D"color:#660">()</span><span style=
=3D"color:#660"></span></code><span style=3D"color:#660">{</span><span styl=
e=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660"=
>::</span><span style=3D"color:#000">audio_context</span><span style=3D"col=
or:#080">&lt;float&gt;</span><span style=3D"color:#000"> ctx</span><span st=
yle=3D"color:#660">;</span><span style=3D"color:#800">//default context cre=
ated with std::default_* values</span><span style=3D"color:#000"><br><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#800">//version 1: capture contex=
t via lambda</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><=
span style=3D"color:#660">::</span><span style=3D"color:#000">astream_proce=
ss</span><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"colo=
r:#000"> proc1</span><span style=3D"color:#660">(</span><span style=3D"colo=
r:#000">ctx</span><span style=3D"color:#660">,[&amp;</span><span style=3D"c=
olor:#000">ctx</span><span style=3D"color:#660">](</span><span style=3D"col=
or:#000">std</span><span style=3D"color:#660">::</span><span style=3D"color=
:#000">iastream </span><span style=3D"color:#008">const</span><span style=
=3D"color:#660">&amp;</span><span style=3D"color:#000"> input</span><span s=
tyle=3D"color:#660">,</span><span style=3D"color:#000"> std</span><span sty=
le=3D"color:#660">::</span><span style=3D"color:#000">oastream</span><span =
style=3D"color:#660">&amp;</span><span style=3D"color:#000"> output</span><=
span style=3D"color:#660">){</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span st=
yle=3D"color:#000">frame_buffer</span><span style=3D"color:#080">&lt;float&=
gt;</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"=
> buff </span><span style=3D"color:#660">=3D</span><span style=3D"color:#00=
0"> ctx</span><span style=3D"color:#660">.</span><span style=3D"color:#000"=
>borrow_buffer</span><span style=3D"color:#660">();</span><span style=3D"co=
lor:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 input</span><span style=3D"color:=
#660">&gt;&gt;</span><span style=3D"color:#000">buff</span><span style=3D"c=
olor:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:#008">for</span><span style=3D"color:#660">=
(</span><span style=3D"color:#008">auto</span><span style=3D"color:#660">&a=
mp;&amp;</span><span style=3D"color:#000"> frame</span><span style=3D"color=
:#660">:</span><span style=3D"color:#000"> buff</span><span style=3D"color:=
#660">){</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 frame</span><span style=3D"color:#660">*=3D</span><span style=
=3D"color:#066">0.5</span><span style=3D"color:#660">;</span><span style=3D=
"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#6=
60">}</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 outp=
ut</span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#00=
0">buff</span><span style=3D"color:#660">;</span><span style=3D"color:#000"=
><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">});</span><span style=
=3D"color:#800">//dsp object</span><span style=3D"color:#000"><br><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:#800">//version 2: have context pass=
ed as argument</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span=
><span style=3D"color:#660">::</span><span style=3D"color:#000">astream_pro=
cess</span><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"co=
lor:#000"> proc2</span><span style=3D"color:#660">(</span><span style=3D"co=
lor:#000">ctx</span><span style=3D"color:#660">,[](</span><span style=3D"co=
lor:#000">std</span><span style=3D"color:#660">::</span><span style=3D"colo=
r:#000">iastream </span><span style=3D"color:#008">const</span><span style=
=3D"color:#660">&amp;</span><span style=3D"color:#000"> input</span><span s=
tyle=3D"color:#660">,</span><span style=3D"color:#000"> std</span><span sty=
le=3D"color:#660">::</span><span style=3D"color:#000">oastream</span><span =
style=3D"color:#660">&amp;</span><span style=3D"color:#000"> output</span><=
span style=3D"color:#660">,</span><span style=3D"color:#000">std</span><spa=
n style=3D"color:#660">::</span><span style=3D"color:#000">audio_context</s=
pan><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#008">const</span><span style=3D"color:#660=
">&amp;</span><span style=3D"color:#000"> context</span><span style=3D"colo=
r:#660">){</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 std</span><span style=3D"color:#660">::</span><span style=3D"color:#000">f=
rame_buffer</span><span style=3D"color:#080">&lt;float&gt;</span><span styl=
e=3D"color:#660">&amp;</span><span style=3D"color:#000"> buff </span><span =
style=3D"color:#660">=3D</span><span style=3D"color:#000"> ctx</span><span =
style=3D"color:#660">.</span><span style=3D"color:#000">borrow_buffer</span=
><span style=3D"color:#660">();</span><span style=3D"color:#000"><br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 input</span><span style=3D"color:#660">&gt;&gt;</span=
><span style=3D"color:#000">buff</span><span style=3D"color:#660">;</span><=
span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span styl=
e=3D"color:#008">for</span><span style=3D"color:#660">(</span><span style=
=3D"color:#008">auto</span><span style=3D"color:#660">&amp;&amp;</span><spa=
n style=3D"color:#000"> frame</span><span style=3D"color:#660">:</span><spa=
n style=3D"color:#000"> buff</span><span style=3D"color:#660">){</span><spa=
n style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame<=
/span><span style=3D"color:#660">*=3D</span><span style=3D"color:#066">2.0<=
/span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span st=
yle=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span style=
=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000">buff</span><span =
style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 <=
/span><span style=3D"color:#660">});</span><span style=3D"color:#000"><br><=
br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=
=3D"color:#000">process_group</span><span style=3D"color:#080">&lt;float&gt=
;</span><span style=3D"color:#000"> pgroup</span><span style=3D"color:#660"=
>;</span><span style=3D"color:#800">//a group of processes that will happen=
 consecutivley</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 pgroup</s=
pan><span style=3D"color:#660">.</span><span style=3D"color:#000">push</spa=
n><span style=3D"color:#660">(</span><span style=3D"color:#000">proc1</span=
><span style=3D"color:#660">);</span><span style=3D"color:#800">//add to gr=
oup</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 pgroup</span><span s=
tyle=3D"color:#660">.</span><span style=3D"color:#000">push</span><span sty=
le=3D"color:#660">(</span><span style=3D"color:#000">proc2</span><span styl=
e=3D"color:#660">);</span><span style=3D"color:#800">//add to group</span><=
span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color=
:#800">//configure stream relationships in terms of std::ain / std:aout man=
ually</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color:#800">//std::ain/std::aout are std::astream globals that refer to=
 the default audio inputs and outputs supplied by the context in use</span>=
<span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#8=
00">//std::ain/std::aout will route the audio to the enpoint specified by t=
he context reference held by the process that is streaming the data</span><=
span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:=
#660">::</span><span style=3D"color:#000">aout</span><span style=3D"color:#=
660">&lt;&lt;</span><span style=3D"color:#000">proc1</span><span style=3D"c=
olor:#660">&lt;&lt;</span><span style=3D"color:#000">proc2</span><span styl=
e=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000">std</span><span =
style=3D"color:#660">::</span><span style=3D"color:#000">ain</span><span st=
yle=3D"color:#660">;</span><span style=3D"color:#800">//method 1</span><spa=
n style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">=
//std::ain&gt;&gt;proc2&gt;&gt;proc1&gt;&gt;std::aout;//method 2</span><spa=
n style=3D"color:#000"><br><br>=C2=A0 =C2=A0 pgroup</span><span style=3D"co=
lor:#660">.</span><span style=3D"color:#000">start</span><span style=3D"col=
or:#660">();</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><spa=
n style=3D"color:#800">//do other stuff</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 pgroup</span><span style=3D"color:#660">.</span><span style=
=3D"color:#000">stop</span><span style=3D"color:#660">();</span><span style=
=3D"color:#000"><br><br></span><span style=3D"color:#660">}</span><span sty=
le=3D"color:#000"><br><br><br></span><span style=3D"color:#800">//std::audi=
o example 3 &quot;audio files&quot;</span><span style=3D"color:#000"><br></=
span><span style=3D"color:#008">void</span><span style=3D"color:#000"> exam=
ple_3</span><code><span style=3D"color:#660">()</span><span style=3D"color:=
#660"></span></code><span style=3D"color:#660">{</span><span style=3D"color=
:#000"><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span>=
<span style=3D"color:#000">audio_context</span><span style=3D"color:#080">&=
lt;float&gt;</span><span style=3D"color:#000"> ctx</span><span style=3D"col=
or:#660">;</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span=
><span style=3D"color:#660">::</span><span style=3D"color:#000">astream_pro=
cess</span><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"co=
lor:#000"> proc</span><span style=3D"color:#660">(</span><span style=3D"col=
or:#000">ctx</span><span style=3D"color:#660">,[](</span><span style=3D"col=
or:#000">std</span><span style=3D"color:#660">::</span><span style=3D"color=
:#000">iafstream </span><span style=3D"color:#008">const</span><span style=
=3D"color:#660">&amp;</span><span style=3D"color:#000"> input</span><span s=
tyle=3D"color:#660">,</span><span style=3D"color:#000"> std</span><span sty=
le=3D"color:#660">::</span><span style=3D"color:#000">oafstream</span><span=
 style=3D"color:#660">&amp;</span><span style=3D"color:#000"> output</span>=
<span style=3D"color:#660">){</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span st=
yle=3D"color:#000">frame_buffer</span><span style=3D"color:#080">&lt;float&=
gt;</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"=
> buff </span><span style=3D"color:#660">=3D</span><span style=3D"color:#00=
0"> ctx</span><span style=3D"color:#660">.</span><span style=3D"color:#000"=
>borrow_buffer</span><span style=3D"color:#660">();</span><span style=3D"co=
lor:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 input</span><span style=3D"color:=
#660">&gt;&gt;</span><span style=3D"color:#000">buff</span><span style=3D"c=
olor:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:#008">for</span><span style=3D"color:#660">=
(</span><span style=3D"color:#008">auto</span><span style=3D"color:#660">&a=
mp;&amp;</span><span style=3D"color:#000"> frame</span><span style=3D"color=
:#660">:</span><span style=3D"color:#000"> buff</span><span style=3D"color:=
#660">){</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 frame</span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#066">0.0</span><span style=3D"color:#660">;</span><span style=3D=
"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#6=
60">}</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 outp=
ut</span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#00=
0">buff</span><span style=3D"color:#660">;</span><span style=3D"color:#000"=
><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">});</span><span style=
=3D"color:#800">//dsp object</span><span style=3D"color:#000"><br><br>=C2=
=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=3D"col=
or:#000">iafstream audio_file1</span><span style=3D"color:#660">(</span><sp=
an style=3D"color:#000">ctx</span><span style=3D"color:#660">,</span><span =
style=3D"color:#080">&quot;filename1.extension&quot;</span><span style=3D"c=
olor:#660">);</span><span style=3D"color:#800">//an audio file handle</span=
><span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"colo=
r:#660">::</span><span style=3D"color:#000">oafstream audio_file2</span><sp=
an style=3D"color:#660">(</span><span style=3D"color:#000">ctx</span><span =
style=3D"color:#660">,</span><span style=3D"color:#080">&quot;filename2.ext=
ension&quot;</span><span style=3D"color:#660">);</span><span style=3D"color=
:#800">//an audio file handle</span><span style=3D"color:#000"><br><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:#800">//routing</span><span style=3D=
"color:#000"><br>=C2=A0 =C2=A0 audio_file2</span><span style=3D"color:#660"=
>&lt;&lt;</span><span style=3D"color:#000">proc</span><span style=3D"color:=
#660">&lt;&lt;</span><span style=3D"color:#000">audio_file1</span><span sty=
le=3D"color:#660">;</span><span style=3D"color:#800">//take input from file=
 nad write to file</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </spa=
n><span style=3D"color:#800">//audio_file1&gt;&gt;proc&gt;&gt;audio_file2;/=
/equivilent syntax</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 proc<=
/span><span style=3D"color:#660">.</span><span style=3D"color:#000">start</=
span><span style=3D"color:#660">();</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#800">//do other stuff</span><spa=
n style=3D"color:#000"><br>=C2=A0 =C2=A0 proc</span><span style=3D"color:#6=
60">.</span><span style=3D"color:#000">stop</span><span style=3D"color:#660=
">();</span><span style=3D"color:#000"><br></span><span style=3D"color:#660=
">}</span><span style=3D"color:#000"><br><br><br></span><span style=3D"colo=
r:#800">//std::audio example 4 &quot;combination routing&quot;</span><span =
style=3D"color:#000"><br></span><span style=3D"color:#008">void</span><span=
 style=3D"color:#000"> example_3</span><span style=3D"color:#660"><code><sp=
an style=3D"color:#660">()</span><span style=3D"color:#660"></span></code>{=
</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span><span sty=
le=3D"color:#660">::</span><span style=3D"color:#000">audio_context</span><=
span style=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#000"> c=
tx</span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#800">//manually select hardware =
endpoints</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><spa=
n style=3D"color:#660">::</span><span style=3D"color:#000">size_t device_id=
 </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> ct=
x</span><span style=3D"color:#660">.</span><span style=3D"color:#000">defau=
lt_device_id</span><span style=3D"color:#660">();</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><sp=
an style=3D"color:#000">iastream input_device </span><span style=3D"color:#=
660">=3D</span><span style=3D"color:#000"> ctx</span><span style=3D"color:#=
660">.</span><span style=3D"color:#000">get_device</span><span style=3D"col=
or:#660">&lt;</span><span style=3D"color:#000">std</span><span style=3D"col=
or:#660">::</span><span style=3D"color:#000">input_device</span><span style=
=3D"color:#660">&gt;(</span><span style=3D"color:#000">device_id</span><spa=
n style=3D"color:#660">);</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 std</span><span style=3D"color:#660">::</span><span style=3D"color:#000=
">oastream output_device </span><span style=3D"color:#660">=3D</span><span =
style=3D"color:#000"> ctx</span><span style=3D"color:#660">.</span><span st=
yle=3D"color:#000">get_device</span><span style=3D"color:#660">&lt;</span><=
span style=3D"color:#000">std</span><span style=3D"color:#660">::</span><sp=
an style=3D"color:#000">output_device</span><span style=3D"color:#660">&gt;=
(</span><span style=3D"color:#000">device_id</span><span style=3D"color:#66=
0">);</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 std</span><spa=
n style=3D"color:#660">::</span><span style=3D"color:#000">astream_process<=
/span><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#=
000"> proc</span><span style=3D"color:#660">(</span><span style=3D"color:#0=
00">ctx</span><span style=3D"color:#660">,[](</span><span style=3D"color:#0=
00">std</span><span style=3D"color:#660">::</span><span style=3D"color:#000=
">iastream </span><span style=3D"color:#008">const</span><span style=3D"col=
or:#660">&amp;</span><span style=3D"color:#000"> input</span><span style=3D=
"color:#660">,</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span=
 style=3D"color:#660">::</span><span style=3D"color:#000">oastream</span><s=
pan style=3D"color:#660">&amp;</span><span style=3D"color:#000"> output</sp=
an><span style=3D"color:#660">,</span><span style=3D"color:#000"><br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 s=
td</span><span style=3D"color:#660">::</span><span style=3D"color:#000">iaf=
stream </span><span style=3D"color:#008">const</span><span style=3D"color:#=
660">&amp;</span><span style=3D"color:#000"> input_file</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0std</span=
><span style=3D"color:#660">::</span><span style=3D"color:#000">oafstream</=
span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"> out=
put_file</span><span style=3D"color:#660">){</span><span style=3D"color:#00=
0"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color:#660">::<=
/span><span style=3D"color:#000">frame_buffer</span><span style=3D"color:#0=
80">&lt;float&gt;</span><span style=3D"color:#660">&amp;</span><span style=
=3D"color:#000"> buff </span><span style=3D"color:#660">=3D</span><span sty=
le=3D"color:#000"> ctx</span><span style=3D"color:#660">.</span><span style=
=3D"color:#000">borrow_buffer</span><span style=3D"color:#660">();</span><s=
pan style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=
=3D"color:#660">(</span><span style=3D"color:#000">input </span><span style=
=3D"color:#660">+</span><span style=3D"color:#000"> input_file</span><span =
style=3D"color:#660">)&gt;&gt;</span><span style=3D"color:#000">buff</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#800">//add streams=
 to perform sum before writing to buffer</span><span style=3D"color:#000"><=
br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">//or you c=
ould use seperate buffers</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">//like this</span><span=
 style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D=
"color:#800">/*<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::frame_buf=
fer&lt;float&gt; buff1;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::f=
rame_buffer&lt;float&gt; buff2;<br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 input&gt;&gt;buff1;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 inp=
ut_file&gt;&gt;buff2;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 buff1+=
=3Dbuff2;//buffer arithmatic<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 */</span><span =
style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output</span><span sty=
le=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000">buff</span><spa=
n style=3D"color:#660">;</span><span style=3D"color:#800">//send the conten=
ts of buff to the hardware out and the file out</span><span style=3D"color:=
#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 output_file</span><span style=3D"colo=
r:#660">&lt;&lt;</span><span style=3D"color:#000">buff</span><span style=3D=
"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><s=
pan style=3D"color:#660">});</span><span style=3D"color:#000"><br><br>=C2=
=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=3D"col=
or:#000">iafstream audio_file1</span><span style=3D"color:#660">(</span><sp=
an style=3D"color:#000">ctx</span><span style=3D"color:#660">,</span><span =
style=3D"color:#080">&quot;filename1.extension&quot;</span><span style=3D"c=
olor:#660">);</span><span style=3D"color:#800">//the actual files to be use=
d above</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 std</span><span =
style=3D"color:#660">::</span><span style=3D"color:#000">oafstream audio_fi=
le2</span><span style=3D"color:#660">(</span><span style=3D"color:#000">ctx=
</span><span style=3D"color:#660">,</span><span style=3D"color:#080">&quot;=
filename2.extension&quot;</span><span style=3D"color:#660">);</span><span s=
tyle=3D"color:#000"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800"=
>//connect the files to the process</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#800">//connect the hardware devi=
ce to the process</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 audio_=
file2</span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:=
#000">proc</span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"c=
olor:#000">audio_file1</span><span style=3D"color:#660">;</span><span style=
=3D"color:#800">//take input from file</span><span style=3D"color:#000"><br=
>=C2=A0 =C2=A0 output_device</span><span style=3D"color:#660">&lt;&lt;</spa=
n><span style=3D"color:#000">proc</span><span style=3D"color:#660">&lt;&lt;=
</span><span style=3D"color:#000">input_device</span><span style=3D"color:#=
660">;</span><span style=3D"color:#800">//also take from hardware</span><sp=
an style=3D"color:#000"><br>=C2=A0 =C2=A0 proc</span><span style=3D"color:#=
660">.</span><span style=3D"color:#000">start</span><span style=3D"color:#6=
60">();</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span sty=
le=3D"color:#800">//do other stuff</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 proc</span><span style=3D"color:#660">.</span><span style=3D"col=
or:#000">stop</span><span style=3D"color:#660">();</span><span style=3D"col=
or:#000"><br></span><span style=3D"color:#660">}</span></div></code></div><=
br><br><br>REQUIRED LIBRARY MEMBERS<br><br><br><div style=3D"background-col=
or:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border=
-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#008">name=
space</span><span style=3D"color:#000"> std</span><span style=3D"color:#660=
">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color:#008">inline</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">namespace</span><span style=3D"color:#000"> audio</span><sp=
an style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">//working context for a=
udio flow</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
</span><span style=3D"color:#008">template</span><span style=3D"color:#080"=
>&lt;typename&gt;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 </span><span style=3D"color:#008">class</span><span style=3D"color:=
#000"> audio_context</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color=
:#800">/*<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 *The context in which all audio da=
ta is centered.<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 *Contains: sampling rate, bu=
ffer size, frame size, etc...<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 *The values of=
 ain,aout,afin,afout refer to the endpoints defined by the context, when ap=
plied to routing on a porocess tied to the context<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 *think of a context as the program level driver object<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 */</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 </span><span style=3D"color:#800">//audio streams (think lik=
e std::fstream and its friends)</span><span style=3D"color:#000"><br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span><span s=
tyle=3D"color:#000"> astream</span><span style=3D"color:#660">;</span><span=
 style=3D"color:#800">//audio stream</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span><=
span style=3D"color:#000"> oastream</span><span style=3D"color:#660">;</spa=
n><span style=3D"color:#800">//output audio stream</span><span style=3D"col=
or:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">=
class</span><span style=3D"color:#000"> iastream</span><span style=3D"color=
:#660">;</span><span style=3D"color:#800">//input audio stream</span><span =
style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"=
color:#008">class</span><span style=3D"color:#000"> oafstream</span><span s=
tyle=3D"color:#660">;</span><span style=3D"color:#800">//output audio file =
stream</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </s=
pan><span style=3D"color:#008">class</span><span style=3D"color:#000"> iafs=
tream</span><span style=3D"color:#660">;</span><span style=3D"color:#800">/=
/input audio file stream</span><span style=3D"color:#000"><br><br><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">//stream endpoin=
ts</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span>=
<span style=3D"color:#008">class</span><span style=3D"color:#000"> ain</spa=
n><span style=3D"color:#660">;</span><span style=3D"color:#800">//audio inp=
ut endpoint</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:#008">class</span><span style=3D"color:#000=
"> aout</span><span style=3D"color:#660">;</span><span style=3D"color:#800"=
>//audio output endpoint</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span><span style=3D=
"color:#000"> afin</span><span style=3D"color:#660">;</span><span style=3D"=
color:#800">//audio file input endpoint</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span=
><span style=3D"color:#000"> afout</span><span style=3D"color:#800">//audio=
 file output endpoint</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">//stream processing</sp=
an><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span =
style=3D"color:#008">template</span><span style=3D"color:#080">&lt;typename=
&gt;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </spa=
n><span style=3D"color:#008">class</span><span style=3D"color:#000"> astrea=
m_process</span><span style=3D"color:#660">;</span><span style=3D"color:#80=
0">//a dsp process applied to a stream</span><span style=3D"color:#000"><br=
><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">template=
</span><span style=3D"color:#080">&lt;typename&gt;</span><span style=3D"col=
or:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">=
class</span><span style=3D"color:#000"> process_group</span><span style=3D"=
color:#660">;</span><span style=3D"color:#800">//a group of processes that =
will act as one</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span style=3D"color:#800">//containers</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color=
:#008">template</span><span style=3D"color:#080">&lt;typename&gt;</span><sp=
an style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=
=3D"color:#008">class</span><span style=3D"color:#000"> frame_buffer</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#800">//a sequence =
container that is resizeable at runtime, but only with explicit resize call=
s. contains frames(see below)</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">/*Implementation not=
e on frame_buffer<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*frame_buffer is int=
ended to hold N number of frames which themselves can hold M number of samp=
les<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*meaning that the total size in sa=
mples if frame_buffer =3D N * M<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*ideal=
ly frame_buffers representation of its sample data will be continuous in me=
mory<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 */</span><span style=3D"color:#000"><br=
><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">template=
</span><span style=3D"color:#080">&lt;typename&gt;</span><span style=3D"col=
or:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">=
class</span><span style=3D"color:#000"> frame</span><span style=3D"color:#6=
60">;</span><span style=3D"color:#800">//a container that holds samples, th=
in array wrapper</span><span style=3D"color:#000"><br><br><br>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 </span><span style=3D"color:#800">//hardware representation<=
/span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><sp=
an style=3D"color:#008">class</span><span style=3D"color:#000"> device</spa=
n><span style=3D"color:#660">;</span><span style=3D"color:#800">//an audio =
device as recognized by the OS</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</span><span st=
yle=3D"color:#000"> input_device</span><span style=3D"color:#660">;</span><=
span style=3D"color:#800">//an input device</span><span style=3D"color:#000=
"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">class</=
span><span style=3D"color:#000"> output_device</span><span style=3D"color:#=
660">;</span><span style=3D"color:#800">//an output device</span><span styl=
e=3D"color:#000"><br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"=
color:#800">// audio file formats</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">enum</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#008">class</span><span =
style=3D"color:#000"> afformat</span><span style=3D"color:#660">{</span><sp=
an style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 raw</=
span><span style=3D"color:#660">,</span><span style=3D"color:#800">//raw he=
aderless audio bytes, interpreted only by the settings of the context.</spa=
n><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
</span><span style=3D"color:#800">//best used for temporary storage within =
the life of a context</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 wav</span><span style=3D"color:#660">,</span><s=
pan style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 flac=
</span><span style=3D"color:#800">//etc...</span><span style=3D"color:#000"=
><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span>=
<span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#6=
60">}</span><span style=3D"color:#000"><br></span><span style=3D"color:#660=
">}</span></div></code></div><br><br><br></div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f490fd21-cf07-4d7b-8936-c71c97a1ab9d%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f490fd21-cf07-=
4d7b-8936-c71c97a1ab9d%40isocpp.org</a>.<br>
</blockquote></div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAFdMc-0Dj4BGW0v8ORrcgGM54D5_ZunT2At0=
OWFEDFr-3CYWBw%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfooter"=
 target=3D"_blank">https://groups.google.com/a/isocpp.org/d/msgid/std-propo=
sals/CAFdMc-0Dj4BGW0v8ORrcgGM54D5_ZunT2At0OWFEDFr-3CYWBw%40mail.gmail.com</=
a>.<br>
</blockquote></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CANh-dXkYYpdDk7Xjegr7Byu1BpWE-ZiaCyyV=
_EMS-4%3D2nW1iDw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CANh-dXkYYpdDk7=
Xjegr7Byu1BpWE-ZiaCyyV_EMS-4%3D2nW1iDw%40mail.gmail.com</a>.<br />

--001a11490eb69953ee053513ccfb--

.


Author: alexander.zywicki@gmail.com
Date: Sun, 12 Jun 2016 17:09:39 -0400
Raw View
--Apple-Mail-66A41169-1247-4481-A37C-8CC22BA8D3F4
Content-Type: text/plain; charset=UTF-8

In that case I would argue for the use of the "std::chrono::steady_clock" based on the fact that it is specified to be a monotonic clock.

Or a clock defined in a similar manor that counts in samples.

I also would imagine that our clock would need to have "is_steady" always be true?


> On Jun 11, 2016, at 4:09 AM, Andrey Semashev <andrey.semashev@gmail.com> wrote:
>
> On Saturday, 11 June 2016 11:03:41 MSK alexander.zywicki@gmail.com wrote:
> > Or at least store a time point each time the stream is started using a clock
> > with a well defined epoch, so that we might be able to find the length of
> > time that the stream has been active and have meaningful measurements of
> > time within the stream.
>
> There is no need to have the epoch bound to the beginning of the stream to calculate its duration. Or any particular epoch at all. All you need is the timestamp of its first and last frames.
>
> A fixed epoch becomes important when you try to synchronize multiple streams together. But even then it's not important what exactly is the epoch; what is important is that it has to be the same for all streams you are processing.
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe.
> To unsubscribe from this group and all its topics, send an email 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/3560828.vAATzG8HgS%40lastique-pc.

--
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 email 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/8AB38C1F-590D-4F81-9839-D7A4604E1831%40gmail.com.

--Apple-Mail-66A41169-1247-4481-A37C-8CC22BA8D3F4
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=
=3Dutf-8"></head><body dir=3D"auto"><div></div><div>In that case I would ar=
gue for the use of the "std::chrono::steady_clock" based on the fact that i=
t is specified to be a monotonic clock.&nbsp;</div><div><br></div><div>Or a=
 clock defined in a similar manor that counts in samples.&nbsp;</div><div><=
br></div><div>I also would imagine that our clock would need to have "is_st=
eady" always be true?</div><div><br></div><div><br>On Jun 11, 2016, at 4:09=
 AM, Andrey Semashev &lt;<a href=3D"mailto:andrey.semashev@gmail.com">andre=
y.semashev@gmail.com</a>&gt; wrote:<br><br></div><blockquote type=3D"cite">=
<div>
<meta name=3D"qrichtext" content=3D"1">
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Saturday=
, 11 June 2016 11:03:41 MSK <a href=3D"mailto:alexander.zywicki@gmail.com">=
alexander.zywicki@gmail.com</a> wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; Or at =
least store a time point each time the stream is started using a clock</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; with a=
 well defined epoch, so that we might be able to find the length of</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; time t=
hat the stream has been active and have meaningful measurements of</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; time w=
ithin the stream.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">There is no=
 need to have the epoch bound to the beginning of the stream to calculate i=
ts duration. Or any particular epoch at all. All you need is the timestamp =
of its first and last frames.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">A fixed epo=
ch becomes important when you try to synchronize multiple streams together.=
 But even then it's not important what exactly is the epoch; what is import=
ant is that it has to be the same for all streams you are processing.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>

<p></p>

-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe">https://groups.=
google.com/a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe</a>.<=
br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@=
isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/3560828.vAATzG8HgS%40lastique-pc?utm_=
medium=3Demail&amp;utm_source=3Dfooter">https://groups.google.com/a/isocpp.=
org/d/msgid/std-proposals/3560828.vAATzG8HgS%40lastique-pc</a>.<br>
</div></blockquote></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8AB38C1F-590D-4F81-9839-D7A4604E1831%=
40gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8AB38C1F-590D-4F81-9839-D7A4604E1831%=
40gmail.com</a>.<br />

--Apple-Mail-66A41169-1247-4481-A37C-8CC22BA8D3F4--

.


Author: alexander.zywicki@gmail.com
Date: Sun, 12 Jun 2016 20:40:46 -0700 (PDT)
Raw View
------=_Part_743_64243900.1465789247040
Content-Type: multipart/alternative;
 boundary="----=_Part_744_99390176.1465789247040"

------=_Part_744_99390176.1465789247040
Content-Type: text/plain; charset=UTF-8

How do you all feel about this definition for a clock?

#include <chrono>
#include <type_traits>

//define audio_clock as high_resolution clock if high_resolution clock
is_steady==true else use steady_clock
//conditional will result in a clock that is monotonic either way
//but can result in using a high_resolution_clock on certain platforms
using audio_clock = typename std::conditional<std::chrono::
high_resolution_clock::is_steady,
                                              std::chrono::
high_resolution_clock,
                                              std::chrono::steady_clock>::
type;



On Sunday, June 12, 2016 at 4:09:44 PM UTC-5, alexande...@gmail.com wrote:
>
> In that case I would argue for the use of the "std::chrono::steady_clock"
> based on the fact that it is specified to be a monotonic clock.
>
> Or a clock defined in a similar manor that counts in samples.
>
> I also would imagine that our clock would need to have "is_steady" always
> be true?
>
>
> On Jun 11, 2016, at 4:09 AM, Andrey Semashev <andrey.semashev@gmail.com>
> wrote:
>
> On Saturday, 11 June 2016 11:03:41 MSK alexander.zywicki@gmail.com wrote:
>
> > Or at least store a time point each time the stream is started using a
> clock
>
> > with a well defined epoch, so that we might be able to find the length of
>
> > time that the stream has been active and have meaningful measurements of
>
> > time within the stream.
>
>
>
> There is no need to have the epoch bound to the beginning of the stream to
> calculate its duration. Or any particular epoch at all. All you need is the
> timestamp of its first and last frames.
>
>
>
> A fixed epoch becomes important when you try to synchronize multiple
> streams together. But even then it's not important what exactly is the
> epoch; what is important is that it has to be the same for all streams you
> are processing.
>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email 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/3560828.vAATzG8HgS%40lastique-pc
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/3560828.vAATzG8HgS%40lastique-pc?utm_medium=email&utm_source=footer>
> .
>
>

--
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 email 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/2943c5c2-2c46-4447-b8f6-7647fc34d52c%40isocpp.org.

------=_Part_744_99390176.1465789247040
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">How do you all feel about this definition for a clock?<br>=
<br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250=
); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px=
; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #800;" class=3D"styled-by-prettify">#include=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #080;" class=3D"styled-by-prettify">&lt;chrono&gt;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><spa=
n style=3D"color: #800;" class=3D"styled-by-prettify">#include</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #080;" class=3D"styled-by-prettify">&lt;type_traits&gt;</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span st=
yle=3D"color: #800;" class=3D"styled-by-prettify">//define audio_clock as h=
igh_resolution clock if high_resolution clock is_steady=3D=3Dtrue else use =
steady_clock</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span><span style=3D"color: #800;" class=3D"styled-by-prettify">//co=
nditional will result in a clock that is monotonic either way</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//but can result in using a =
high_resolution_clock on certain platforms</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">using</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> audio_clock </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">typename</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">conditio=
nal</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">std</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">chrono</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">high_resolution_clock</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">is_steady</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">chrono</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">high_resolution_clock</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">chrono</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">steady_clock</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">&gt;::</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">type</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">;</span></div></code></div><br><br><br>On Sunday, June 12, 2016 at 4:09=
:44 PM UTC-5, alexande...@gmail.com wrote:<blockquote class=3D"gmail_quote"=
 style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-=
left: 1ex;"><div dir=3D"auto"><div></div><div>In that case I would argue fo=
r the use of the &quot;std::chrono::steady_clock&quot; based on the fact th=
at it is specified to be a monotonic clock.=C2=A0</div><div><br></div><div>=
Or a clock defined in a similar manor that counts in samples.=C2=A0</div><d=
iv><br></div><div>I also would imagine that our clock would need to have &q=
uot;is_steady&quot; always be true?</div><div><br></div><div><br>On Jun 11,=
 2016, at 4:09 AM, Andrey Semashev &lt;<a href=3D"mailto:andrey.semashev@gm=
ail.com" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39=
;mailto:andrey.semashev@gmail.com&#39;;return true;" onclick=3D"this.href=
=3D&#39;mailto:andrey.semashev@gmail.com&#39;;return true;">andrey.semashev=
@gmail.com</a>&gt; wrote:<br><br></div><blockquote type=3D"cite"><div>

<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">On Saturday, 11 June 2016 11:03:41 MSK <a href=3D"mailt=
o:alexander.zywicki@gmail.com" target=3D"_blank" rel=3D"nofollow" onmousedo=
wn=3D"this.href=3D&#39;mailto:alexander.zywicki@gmail.com&#39;;return true;=
" onclick=3D"this.href=3D&#39;mailto:alexander.zywicki@gmail.com&#39;;retur=
n true;">alexander.zywicki@gmail.com</a> wrote:</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; Or at least store a time point each time the strea=
m is started using a clock</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; with a well defined epoch, so that we might be abl=
e to find the length of</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; time that the stream has been active and have mean=
ingful measurements of</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; time within the stream.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">=C2=A0</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">There is no need to have the epoch bound to the beginni=
ng of the stream to calculate its duration. Or any particular epoch at all.=
 All you need is the timestamp of its first and last frames.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">=C2=A0</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">A fixed epoch becomes important when you try to synchro=
nize multiple streams together. But even then it&#39;s not important what e=
xactly is the epoch; what is important is that it has to be the same for al=
l streams you are processing.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">=C2=A0</p>

<p></p>

-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe" target=3D"_blan=
k" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://groups.google.c=
om/a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe&#39;;return t=
rue;" onclick=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/=
topic/std-proposals/Hkdh02Ejx6s/unsubscribe&#39;;return true;">https://grou=
ps.google.com/a/<wbr>isocpp.org/d/topic/std-<wbr>proposals/Hkdh02Ejx6s/<wbr=
>unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_blank" rel=3D"n=
ofollow" onmousedown=3D"this.href=3D&#39;mailto:std-proposals+unsubscribe@i=
socpp.org&#39;;return true;" onclick=3D"this.href=3D&#39;mailto:std-proposa=
ls+unsubscribe@isocpp.org&#39;;return true;">std-proposals+unsubscribe@<wbr=
>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;ma=
ilto:std-proposals@isocpp.org&#39;;return true;" onclick=3D"this.href=3D&#3=
9;mailto:std-proposals@isocpp.org&#39;;return true;">std-proposals@isocpp.o=
rg</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/3560828.vAATzG8HgS%40lastique-pc?utm_=
medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank" rel=3D"nofollow" =
onmousedown=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/ms=
gid/std-proposals/3560828.vAATzG8HgS%40lastique-pc?utm_medium\x3demail\x26u=
tm_source\x3dfooter&#39;;return true;" onclick=3D"this.href=3D&#39;https://=
groups.google.com/a/isocpp.org/d/msgid/std-proposals/3560828.vAATzG8HgS%40l=
astique-pc?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">h=
ttps://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/35608=
28.vAATzG8HgS%<wbr>40lastique-pc</a>.<br>
</div></blockquote></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2943c5c2-2c46-4447-b8f6-7647fc34d52c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2943c5c2-2c46-4447-b8f6-7647fc34d52c=
%40isocpp.org</a>.<br />

------=_Part_744_99390176.1465789247040--

------=_Part_743_64243900.1465789247040--

.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Mon, 13 Jun 2016 11:24:24 +0300
Raw View
This is a multi-part message in MIME format.

--nextPart1596736.jOlD2Hf51T
Content-Type: text/plain; charset=UTF-8

As I suggested earlier, I think the clock should be specified by the user (probably as a
template parameter for the audio frame).

On Monday, 13 June 2016 11:22:50 MSK alexander.zywicki@gmail.com wrote:
> How do you all feel about this definition for a clock?
>
> #include <chrono>
> #include <type_traits>
>
> //define audio_clock as high_resolution clock if high_resolution clock
> is_steady==true else use steady_clock
> //conditional will result in a clock that is monotonic either way
> //but can result in using a high_resolution_clock on certain platforms
> using audio_clock = typename std::conditional<std::chrono::
> high_resolution_clock::is_steady,
>                                               std::chrono::
> high_resolution_clock,
>                                               std::chrono::steady_clock>::
> type;
>
> On Sunday, June 12, 2016 at 4:09:44 PM UTC-5, alexande...@gmail.com wrote:
> > In that case I would argue for the use of the "std::chrono::steady_clock"
> > based on the fact that it is specified to be a monotonic clock.
> >
> > Or a clock defined in a similar manor that counts in samples.
> >
> > I also would imagine that our clock would need to have "is_steady" always
> > be true?
> >
> >
> > On Jun 11, 2016, at 4:09 AM, Andrey Semashev <andrey.semashev@gmail.com>
> > wrote:
> >
> > On Saturday, 11 June 2016 11:03:41 MSK alexander.zywicki@gmail.com wrote:
> > > Or at least store a time point each time the stream is started using a
> >
> > clock
> >
> > > with a well defined epoch, so that we might be able to find the length
> > > of
> > >
> > > time that the stream has been active and have meaningful measurements of
> > >
> > > time within the stream.
> >
> > There is no need to have the epoch bound to the beginning of the stream to
> > calculate its duration. Or any particular epoch at all. All you need is
> > the
> > timestamp of its first and last frames.
> >
> >
> >
> > A fixed epoch becomes important when you try to synchronize multiple
> > streams together. But even then it's not important what exactly is the
> > epoch; what is important is that it has to be the same for all streams you
> > are processing.


--
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 email 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/2897526.WjqoZ8n3I9%40lastique-pc.

--nextPart1596736.jOlD2Hf51T
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-=
html40/strict.dtd">
<html><head><meta name=3D"qrichtext" content=3D"1" /><style type=3D"text/cs=
s">
p, li { white-space: pre-wrap; }
</style></head><body style=3D" font-family:'DejaVu Sans Mono'; font-size:9p=
t; font-weight:400; font-style:normal;">
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">As I sugges=
ted earlier, I think the clock should be specified by the user (probably as=
 a template parameter for the audio frame).</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Monday, =
13 June 2016 11:22:50 MSK alexander.zywicki@gmail.com wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; How do=
 you all feel about this definition for a clock?</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; #inclu=
de &lt;chrono&gt;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; #inclu=
de &lt;type_traits&gt;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; //defi=
ne audio_clock as high_resolution clock if high_resolution clock</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; is_ste=
ady=3D=3Dtrue else use steady_clock</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; //cond=
itional will result in a clock that is monotonic either way</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; //but =
can result in using a high_resolution_clock on certain platforms</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; using =
audio_clock =3D typename std::conditional&lt;std::chrono::</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; high_r=
esolution_clock::is_steady,</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt;       =
                                        std::chrono::</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; high_r=
esolution_clock,</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt;       =
                                        std::chrono::steady_clock&gt;::</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; type;<=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; On Sun=
day, June 12, 2016 at 4:09:44 PM UTC-5, alexande...@gmail.com wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; I=
n that case I would argue for the use of the &quot;std::chrono::steady_cloc=
k&quot;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; b=
ased on the fact that it is specified to be a monotonic clock.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; O=
r a clock defined in a similar manor that counts in samples.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; I=
 also would imagine that our clock would need to have &quot;is_steady&quot;=
 always</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; b=
e true?</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; O=
n Jun 11, 2016, at 4:09 AM, Andrey Semashev &lt;andrey.semashev@gmail.com&g=
t;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; w=
rote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; O=
n Saturday, 11 June 2016 11:03:41 MSK alexander.zywicki@gmail.com wrote:</p=
>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; &=
gt; Or at least store a time point each time the stream is started using a<=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; c=
lock</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; &=
gt; with a well defined epoch, so that we might be able to find the length<=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; &=
gt; of</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; &=
gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; &=
gt; time that the stream has been active and have meaningful measurements o=
f</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; &=
gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; &=
gt; time within the stream.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; T=
here is no need to have the epoch bound to the beginning of the stream to</=
p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; c=
alculate its duration. Or any particular epoch at all. All you need is</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; t=
he</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; t=
imestamp of its first and last frames.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; A=
 fixed epoch becomes important when you try to synchronize multiple</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; s=
treams together. But even then it's not important what exactly is the</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; e=
poch; what is important is that it has to be the same for all streams you</=
p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; a=
re processing.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2897526.WjqoZ8n3I9%40lastique-pc?utm_=
medium=3Demail&utm_source=3Dfooter">https://groups.google.com/a/isocpp.org/=
d/msgid/std-proposals/2897526.WjqoZ8n3I9%40lastique-pc</a>.<br />

--nextPart1596736.jOlD2Hf51T--


.


Author: ron novy <rsn10100@gmail.com>
Date: Mon, 13 Jun 2016 02:32:00 -0700
Raw View
--001a1135b1949711a80535258fb2
Content-Type: text/plain; charset=UTF-8

Well, what if we just had both a sample clock and a high resolution clock
together?  One could then use either or both at their own discretion.  And
theoretically you could then calculate some approximation of clock jitter
or drift between buffers/packets or separate record devices.  Or does that
even make sense?

On Mon, Jun 13, 2016 at 1:24 AM, Andrey Semashev <andrey.semashev@gmail.com>
wrote:

> As I suggested earlier, I think the clock should be specified by the user
> (probably as a template parameter for the audio frame).
>
>
>
> On Monday, 13 June 2016 11:22:50 MSK alexander.zywicki@gmail.com wrote:
>
> > How do you all feel about this definition for a clock?
>
> >
>
> > #include <chrono>
>
> > #include <type_traits>
>
> >
>
> > //define audio_clock as high_resolution clock if high_resolution clock
>
> > is_steady==true else use steady_clock
>
> > //conditional will result in a clock that is monotonic either way
>
> > //but can result in using a high_resolution_clock on certain platforms
>
> > using audio_clock = typename std::conditional<std::chrono::
>
> > high_resolution_clock::is_steady,
>
> > std::chrono::
>
> > high_resolution_clock,
>
> > std::chrono::steady_clock>::
>
> > type;
>
> >
>
> > On Sunday, June 12, 2016 at 4:09:44 PM UTC-5, alexande...@gmail.com
> wrote:
>
> > > In that case I would argue for the use of the
> "std::chrono::steady_clock"
>
> > > based on the fact that it is specified to be a monotonic clock.
>
> > >
>
> > > Or a clock defined in a similar manor that counts in samples.
>
> > >
>
> > > I also would imagine that our clock would need to have "is_steady"
> always
>
> > > be true?
>
> > >
>
> > >
>
> > > On Jun 11, 2016, at 4:09 AM, Andrey Semashev <
> andrey.semashev@gmail.com>
>
> > > wrote:
>
> > >
>
> > > On Saturday, 11 June 2016 11:03:41 MSK alexander.zywicki@gmail.com
> wrote:
>
> > > > Or at least store a time point each time the stream is started using
> a
>
> > >
>
> > > clock
>
> > >
>
> > > > with a well defined epoch, so that we might be able to find the
> length
>
> > > > of
>
> > > >
>
> > > > time that the stream has been active and have meaningful
> measurements of
>
> > > >
>
> > > > time within the stream.
>
> > >
>
> > > There is no need to have the epoch bound to the beginning of the
> stream to
>
> > > calculate its duration. Or any particular epoch at all. All you need is
>
> > > the
>
> > > timestamp of its first and last frames.
>
> > >
>
> > >
>
> > >
>
> > > A fixed epoch becomes important when you try to synchronize multiple
>
> > > streams together. But even then it's not important what exactly is the
>
> > > epoch; what is important is that it has to be the same for all streams
> you
>
> > > are processing.
>
>
>
>
>
> --
> 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
> email 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/2897526.WjqoZ8n3I9%40lastique-pc
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/2897526.WjqoZ8n3I9%40lastique-pc?utm_medium=email&utm_source=footer>
> .
>

--
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 email 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/CAOcFa%3DdvmLW0u8R3MesuJMc7rbkewr%2Bmbv1qjVSQ3ip_U%3DsbZA%40mail.gmail.com.

--001a1135b1949711a80535258fb2
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Well, what if we just had both a sample clock and a high r=
esolution clock together?=C2=A0 One could then use either or both at their =
own discretion.=C2=A0 And theoretically you could then calculate some appro=
ximation of clock jitter or drift between buffers/packets or separate recor=
d devices.=C2=A0 Or does that even make sense?</div><div class=3D"gmail_ext=
ra"><br><div class=3D"gmail_quote">On Mon, Jun 13, 2016 at 1:24 AM, Andrey =
Semashev <span dir=3D"ltr">&lt;<a href=3D"mailto:andrey.semashev@gmail.com"=
 target=3D"_blank">andrey.semashev@gmail.com</a>&gt;</span> wrote:<br><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #cc=
c solid;padding-left:1ex"><u></u>
<div style=3D"font-family:&#39;DejaVu Sans Mono&#39;;font-size:9pt;font-wei=
ght:400;font-style:normal">
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">As I suggested earlier, I think the clock should be spe=
cified by the user (probably as a template parameter for the audio frame).<=
/p><div><div class=3D"h5">
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">=C2=A0</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">On Monday, 13 June 2016 11:22:50 MSK <a href=3D"mailto:=
alexander.zywicki@gmail.com" target=3D"_blank">alexander.zywicki@gmail.com<=
/a> wrote:</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; How do you all feel about this definition for a cl=
ock?</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; #include &lt;chrono&gt;</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; #include &lt;type_traits&gt;</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; //define audio_clock as high_resolution clock if h=
igh_resolution clock</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; is_steady=3D=3Dtrue else use steady_clock</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; //conditional will result in a clock that is monot=
onic either way</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; //but can result in using a high_resolution_clock =
on certain platforms</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; using audio_clock =3D typename std::conditional&lt=
;std::chrono::</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; high_resolution_clock::is_steady,</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt;                                               std:=
:chrono::</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; high_resolution_clock,</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt;                                               std:=
:chrono::steady_clock&gt;::</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; type;</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; On Sunday, June 12, 2016 at 4:09:44 PM UTC-5, <a h=
ref=3D"mailto:alexande...@gmail.com" target=3D"_blank">alexande...@gmail.co=
m</a> wrote:</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; In that case I would argue for the use of the=
 &quot;std::chrono::steady_clock&quot;</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; based on the fact that it is specified to be =
a monotonic clock.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; Or a clock defined in a similar manor that co=
unts in samples.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; I also would imagine that our clock would nee=
d to have &quot;is_steady&quot; always</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; be true?</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; On Jun 11, 2016, at 4:09 AM, Andrey Semashev =
&lt;<a href=3D"mailto:andrey.semashev@gmail.com" target=3D"_blank">andrey.s=
emashev@gmail.com</a>&gt;</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; wrote:</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; On Saturday, 11 June 2016 11:03:41 MSK <a hre=
f=3D"mailto:alexander.zywicki@gmail.com" target=3D"_blank">alexander.zywick=
i@gmail.com</a> wrote:</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; &gt; Or at least store a time point each time=
 the stream is started using a</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; clock</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; &gt; with a well defined epoch, so that we mi=
ght be able to find the length</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; &gt; of</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; &gt; time that the stream has been active and=
 have meaningful measurements of</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; &gt; time within the stream.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; There is no need to have the epoch bound to t=
he beginning of the stream to</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; calculate its duration. Or any particular epo=
ch at all. All you need is</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; the</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; timestamp of its first and last frames.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; A fixed epoch becomes important when you try =
to synchronize multiple</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; streams together. But even then it&#39;s not =
important what exactly is the</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; epoch; what is important is that it has to be=
 the same for all streams you</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; are processing.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">=C2=A0</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">=C2=A0</p></div></div></div>

<p></p>

-- <br><span class=3D"">
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2897526.WjqoZ8n3I9%40lastique-pc?utm_=
medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">https://groups.go=
ogle.com/a/isocpp.org/d/msgid/std-proposals/2897526.WjqoZ8n3I9%40lastique-p=
c</a>.<br>
</blockquote></div><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAOcFa%3DdvmLW0u8R3MesuJMc7rbkewr%2Bm=
bv1qjVSQ3ip_U%3DsbZA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOcFa%3Ddv=
mLW0u8R3MesuJMc7rbkewr%2Bmbv1qjVSQ3ip_U%3DsbZA%40mail.gmail.com</a>.<br />

--001a1135b1949711a80535258fb2--

.


Author: alexander.zywicki@gmail.com
Date: Mon, 13 Jun 2016 06:46:50 -0500
Raw View
--Apple-Mail-738C6CDE-EAD2-4C84-9A9B-DBAC83FBEF25
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

That could be a workable idea. The definition proposed earlier would be for=
 just the high resolution clock though. That definition provides a type tha=
t will always be steady and could be high resolution as well. The important=
 part is steady. Please note that the standard says that high_resolution_cl=
ock can be an alias of steady clock, system clock or its own third clock ty=
pe. A sample clock would need to be custom built to count in samples as wel=
l as somehow sync with other clocks(hardware and software) and would probab=
ly not be as useful as I had originally thought. Having a steady high resol=
ution clock in seconds would be much more versatile than a sample clock.

> On Jun 13, 2016, at 4:32 AM, ron novy <rsn10100@gmail.com> wrote:
>=20
> Well, what if we just had both a sample clock and a high resolution clock=
 together?  One could then use either or both at their own discretion.  And=
 theoretically you could then calculate some approximation of clock jitter =
or drift between buffers/packets or separate record devices.  Or does that =
even make sense?
>=20
>> On Mon, Jun 13, 2016 at 1:24 AM, Andrey Semashev <andrey.semashev@gmail.=
com> wrote:
>> As I suggested earlier, I think the clock should be specified by the use=
r (probably as a template parameter for the audio frame).
>> =20
>> On Monday, 13 June 2016 11:22:50 MSK alexander.zywicki@gmail.com wrote:
>> > How do you all feel about this definition for a clock?
>> >
>> > #include <chrono>
>> > #include <type_traits>
>> >
>> > //define audio_clock as high_resolution clock if high_resolution clock
>> > is_steady=3D=3Dtrue else use steady_clock
>> > //conditional will result in a clock that is monotonic either way
>> > //but can result in using a high_resolution_clock on certain platforms
>> > using audio_clock =3D typename std::conditional<std::chrono::
>> > high_resolution_clock::is_steady,
>> > std::chrono::
>> > high_resolution_clock,
>> > std::chrono::steady_clock>::
>> > type;
>> >
>> > On Sunday, June 12, 2016 at 4:09:44 PM UTC-5, alexande...@gmail.com wr=
ote:
>> > > In that case I would argue for the use of the "std::chrono::steady_c=
lock"
>> > > based on the fact that it is specified to be a monotonic clock.
>> > >
>> > > Or a clock defined in a similar manor that counts in samples.
>> > >
>> > > I also would imagine that our clock would need to have "is_steady" a=
lways
>> > > be true?
>> > >
>> > >
>> > > On Jun 11, 2016, at 4:09 AM, Andrey Semashev <andrey.semashev@gmail.=
com>
>> > > wrote:
>> > >
>> > > On Saturday, 11 June 2016 11:03:41 MSK alexander.zywicki@gmail.com w=
rote:
>> > > > Or at least store a time point each time the stream is started usi=
ng a
>> > >
>> > > clock
>> > >
>> > > > with a well defined epoch, so that we might be able to find the le=
ngth
>> > > > of
>> > > >
>> > > > time that the stream has been active and have meaningful measureme=
nts of
>> > > >
>> > > > time within the stream.
>> > >
>> > > There is no need to have the epoch bound to the beginning of the str=
eam to
>> > > calculate its duration. Or any particular epoch at all. All you need=
 is
>> > > the
>> > > timestamp of its first and last frames.
>> > >
>> > >
>> > >
>> > > A fixed epoch becomes important when you try to synchronize multiple
>> > > streams together. But even then it's not important what exactly is t=
he
>> > > epoch; what is important is that it has to be the same for all strea=
ms you
>> > > are processing.
>> =20
>> =20
>> --=20
>> You received this message because you are subscribed to the Google Group=
s "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n email 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/iso=
cpp.org/d/msgid/std-proposals/2897526.WjqoZ8n3I9%40lastique-pc.
>=20
> --=20
> You received this message because you are subscribed to a topic in the Go=
ogle Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.=
org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to std-p=
roposals+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/isoc=
pp.org/d/msgid/std-proposals/CAOcFa%3DdvmLW0u8R3MesuJMc7rbkewr%2Bmbv1qjVSQ3=
ip_U%3DsbZA%40mail.gmail.com.

--=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/0CBC13EE-E8D2-47D8-A7E9-484B6AF0F02A%40gmail.com=
..

--Apple-Mail-738C6CDE-EAD2-4C84-9A9B-DBAC83FBEF25
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=
=3Dutf-8"></head><body dir=3D"auto"><div></div><div>That could be a workabl=
e idea. The definition proposed earlier would be for just the high resoluti=
on clock though. That definition provides a type that will always be steady=
 and could be high resolution as well. The important part is steady. Please=
 note that the standard says that high_resolution_clock can be an alias of =
steady clock, system clock or its own third clock type. A sample clock woul=
d need to be custom built to count in samples as well as somehow sync with =
other clocks(hardware and software) and would probably not be as useful as =
I had originally thought. Having a steady high resolution clock in seconds =
would be much more versatile than a sample clock.</div><div><br>On Jun 13, =
2016, at 4:32 AM, ron novy &lt;<a href=3D"mailto:rsn10100@gmail.com">rsn101=
00@gmail.com</a>&gt; wrote:<br><br></div><blockquote type=3D"cite"><div><di=
v dir=3D"ltr">Well, what if we just had both a sample clock and a high reso=
lution clock together?&nbsp; One could then use either or both at their own=
 discretion.&nbsp; And theoretically you could then calculate some approxim=
ation of clock jitter or drift between buffers/packets or separate record d=
evices.&nbsp; Or does that even make sense?</div><div class=3D"gmail_extra"=
><br><div class=3D"gmail_quote">On Mon, Jun 13, 2016 at 1:24 AM, Andrey Sem=
ashev <span dir=3D"ltr">&lt;<a href=3D"mailto:andrey.semashev@gmail.com" ta=
rget=3D"_blank">andrey.semashev@gmail.com</a>&gt;</span> wrote:<br><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc s=
olid;padding-left:1ex"><u></u>
<div style=3D"font-family:'DejaVu Sans Mono';font-size:9pt;font-weight:400;=
font-style:normal">
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">As I suggested earlier, I think the clock should be spe=
cified by the user (probably as a template parameter for the audio frame).<=
/p><div><div class=3D"h5">
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&nbsp;</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">On Monday, 13 June 2016 11:22:50 MSK <a href=3D"mailto:=
alexander.zywicki@gmail.com" target=3D"_blank">alexander.zywicki@gmail.com<=
/a> wrote:</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; How do you all feel about this definition for a cl=
ock?</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; #include &lt;chrono&gt;</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; #include &lt;type_traits&gt;</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; //define audio_clock as high_resolution clock if h=
igh_resolution clock</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; is_steady=3D=3Dtrue else use steady_clock</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; //conditional will result in a clock that is monot=
onic either way</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; //but can result in using a high_resolution_clock =
on certain platforms</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; using audio_clock =3D typename std::conditional&lt=
;std::chrono::</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; high_resolution_clock::is_steady,</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt;                                               std:=
:chrono::</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; high_resolution_clock,</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt;                                               std:=
:chrono::steady_clock&gt;::</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; type;</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; On Sunday, June 12, 2016 at 4:09:44 PM UTC-5, <a h=
ref=3D"mailto:alexande...@gmail.com" target=3D"_blank">alexande...@gmail.co=
m</a> wrote:</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; In that case I would argue for the use of the=
 "std::chrono::steady_clock"</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; based on the fact that it is specified to be =
a monotonic clock.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; Or a clock defined in a similar manor that co=
unts in samples.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; I also would imagine that our clock would nee=
d to have "is_steady" always</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; be true?</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; On Jun 11, 2016, at 4:09 AM, Andrey Semashev =
&lt;<a href=3D"mailto:andrey.semashev@gmail.com" target=3D"_blank">andrey.s=
emashev@gmail.com</a>&gt;</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; wrote:</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; On Saturday, 11 June 2016 11:03:41 MSK <a hre=
f=3D"mailto:alexander.zywicki@gmail.com" target=3D"_blank">alexander.zywick=
i@gmail.com</a> wrote:</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; &gt; Or at least store a time point each time=
 the stream is started using a</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; clock</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; &gt; with a well defined epoch, so that we mi=
ght be able to find the length</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; &gt; of</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; &gt; time that the stream has been active and=
 have meaningful measurements of</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; &gt; time within the stream.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; There is no need to have the epoch bound to t=
he beginning of the stream to</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; calculate its duration. Or any particular epo=
ch at all. All you need is</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; the</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; timestamp of its first and last frames.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; </p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; A fixed epoch becomes important when you try =
to synchronize multiple</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; streams together. But even then it's not impo=
rtant what exactly is the</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; epoch; what is important is that it has to be=
 the same for all streams you</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; &gt; are processing.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&nbsp;</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&nbsp;</p></div></div></div>

<p></p>

-- <br><span class=3D"">
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2897526.WjqoZ8n3I9%40lastique-pc?utm_=
medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">https://groups.go=
ogle.com/a/isocpp.org/d/msgid/std-proposals/2897526.WjqoZ8n3I9%40lastique-p=
c</a>.<br>
</blockquote></div><br></div>

<p></p>

-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe">https://groups.=
google.com/a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe</a>.<=
br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@=
isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAOcFa%3DdvmLW0u8R3MesuJMc7rbkewr%2Bm=
bv1qjVSQ3ip_U%3DsbZA%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Df=
ooter">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOcFa%=
3DdvmLW0u8R3MesuJMc7rbkewr%2Bmbv1qjVSQ3ip_U%3DsbZA%40mail.gmail.com</a>.<br=
>
</div></blockquote></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0CBC13EE-E8D2-47D8-A7E9-484B6AF0F02A%=
40gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0CBC13EE-E8D2-47D8-A7E9-484B6AF0F02A%=
40gmail.com</a>.<br />

--Apple-Mail-738C6CDE-EAD2-4C84-9A9B-DBAC83FBEF25--

.


Author: alexander.zywicki@gmail.com
Date: Mon, 13 Jun 2016 06:48:45 -0500
Raw View
--Apple-Mail-07E7F8DF-30EC-4467-9F11-C5FF69FD73F6
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

If that should be the case we would have to write a type trait that makes s=
ure that the user supplied clock was an acceptable clock source. I suggest =
using the built in ones for the mean time because the std makes certain gua=
rantees about those clocks that can make sure that thy meet our needs. Not =
to mention that a default would be needed even if we allowed user supplied =
clocks

> On Jun 13, 2016, at 3:24 AM, Andrey Semashev <andrey.semashev@gmail.com> =
wrote:
>=20
> As I suggested earlier, I think the clock should be specified by the user=
 (probably as a template parameter for the audio frame).
> =20
> On Monday, 13 June 2016 11:22:50 MSK alexander.zywicki@gmail.com wrote:
> > How do you all feel about this definition for a clock?
> >
> > #include <chrono>
> > #include <type_traits>
> >
> > //define audio_clock as high_resolution clock if high_resolution clock
> > is_steady=3D=3Dtrue else use steady_clock
> > //conditional will result in a clock that is monotonic either way
> > //but can result in using a high_resolution_clock on certain platforms
> > using audio_clock =3D typename std::conditional<std::chrono::
> > high_resolution_clock::is_steady,
> > std::chrono::
> > high_resolution_clock,
> > std::chrono::steady_clock>::
> > type;
> >
> > On Sunday, June 12, 2016 at 4:09:44 PM UTC-5, alexande...@gmail.com wro=
te:
> > > In that case I would argue for the use of the "std::chrono::steady_cl=
ock"
> > > based on the fact that it is specified to be a monotonic clock.
> > >
> > > Or a clock defined in a similar manor that counts in samples.
> > >
> > > I also would imagine that our clock would need to have "is_steady" al=
ways
> > > be true?
> > >
> > >
> > > On Jun 11, 2016, at 4:09 AM, Andrey Semashev <andrey.semashev@gmail.c=
om>
> > > wrote:
> > >
> > > On Saturday, 11 June 2016 11:03:41 MSK alexander.zywicki@gmail.com wr=
ote:
> > > > Or at least store a time point each time the stream is started usin=
g a
> > >
> > > clock
> > >
> > > > with a well defined epoch, so that we might be able to find the len=
gth
> > > > of
> > > >
> > > > time that the stream has been active and have meaningful measuremen=
ts of
> > > >
> > > > time within the stream.
> > >
> > > There is no need to have the epoch bound to the beginning of the stre=
am to
> > > calculate its duration. Or any particular epoch at all. All you need =
is
> > > the
> > > timestamp of its first and last frames.
> > >
> > >
> > >
> > > A fixed epoch becomes important when you try to synchronize multiple
> > > streams together. But even then it's not important what exactly is th=
e
> > > epoch; what is important is that it has to be the same for all stream=
s you
> > > are processing.
> =20
> =20
> --=20
> You received this message because you are subscribed to a topic in the Go=
ogle Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.=
org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to std-p=
roposals+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/isoc=
pp.org/d/msgid/std-proposals/2897526.WjqoZ8n3I9%40lastique-pc.

--=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/8DC89BEC-9ED2-4268-9D12-77D7C57128CC%40gmail.com=
..

--Apple-Mail-07E7F8DF-30EC-4467-9F11-C5FF69FD73F6
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=
=3Dutf-8"></head><body dir=3D"auto"><div></div><div>If that should be the c=
ase we would have to write a type trait that makes sure that the user suppl=
ied clock was an acceptable clock source. I suggest using the built in ones=
 for the mean time because the std makes certain guarantees about those clo=
cks that can make sure that thy meet our needs. Not to mention that a defau=
lt would be needed even if we allowed user supplied clocks</div><div><br>On=
 Jun 13, 2016, at 3:24 AM, Andrey Semashev &lt;<a href=3D"mailto:andrey.sem=
ashev@gmail.com">andrey.semashev@gmail.com</a>&gt; wrote:<br><br></div><blo=
ckquote type=3D"cite"><div>
<meta name=3D"qrichtext" content=3D"1">
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">As I sugges=
ted earlier, I think the clock should be specified by the user (probably as=
 a template parameter for the audio frame).</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Monday, =
13 June 2016 11:22:50 MSK <a href=3D"mailto:alexander.zywicki@gmail.com">al=
exander.zywicki@gmail.com</a> wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; How do=
 you all feel about this definition for a clock?</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; #inclu=
de &lt;chrono&gt;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; #inclu=
de &lt;type_traits&gt;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; //defi=
ne audio_clock as high_resolution clock if high_resolution clock</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; is_ste=
ady=3D=3Dtrue else use steady_clock</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; //cond=
itional will result in a clock that is monotonic either way</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; //but =
can result in using a high_resolution_clock on certain platforms</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; using =
audio_clock =3D typename std::conditional&lt;std::chrono::</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; high_r=
esolution_clock::is_steady,</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt;       =
                                        std::chrono::</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; high_r=
esolution_clock,</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt;       =
                                        std::chrono::steady_clock&gt;::</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; type;<=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; On Sun=
day, June 12, 2016 at 4:09:44 PM UTC-5, alexande...@<a href=3D"http://gmail=
..com">gmail.com</a> wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; I=
n that case I would argue for the use of the "std::chrono::steady_clock"</p=
>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; b=
ased on the fact that it is specified to be a monotonic clock.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; O=
r a clock defined in a similar manor that counts in samples.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; I=
 also would imagine that our clock would need to have "is_steady" always</p=
>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; b=
e true?</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; O=
n Jun 11, 2016, at 4:09 AM, Andrey Semashev &lt;<a href=3D"mailto:andrey.se=
mashev@gmail.com">andrey.semashev@gmail.com</a>&gt;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; w=
rote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; O=
n Saturday, 11 June 2016 11:03:41 MSK <a href=3D"mailto:alexander.zywicki@g=
mail.com">alexander.zywicki@gmail.com</a> wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; &=
gt; Or at least store a time point each time the stream is started using a<=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; c=
lock</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; &=
gt; with a well defined epoch, so that we might be able to find the length<=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; &=
gt; of</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; &=
gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; &=
gt; time that the stream has been active and have meaningful measurements o=
f</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; &=
gt; </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; &=
gt; time within the stream.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; T=
here is no need to have the epoch bound to the beginning of the stream to</=
p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; c=
alculate its duration. Or any particular epoch at all. All you need is</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; t=
he</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; t=
imestamp of its first and last frames.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; <=
/p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; A=
 fixed epoch becomes important when you try to synchronize multiple</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; s=
treams together. But even then it's not important what exactly is the</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; e=
poch; what is important is that it has to be the same for all streams you</=
p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; a=
re processing.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>

<p></p>

-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe">https://groups.=
google.com/a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe</a>.<=
br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@=
isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2897526.WjqoZ8n3I9%40lastique-pc?utm_=
medium=3Demail&amp;utm_source=3Dfooter">https://groups.google.com/a/isocpp.=
org/d/msgid/std-proposals/2897526.WjqoZ8n3I9%40lastique-pc</a>.<br>
</div></blockquote></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8DC89BEC-9ED2-4268-9D12-77D7C57128CC%=
40gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8DC89BEC-9ED2-4268-9D12-77D7C57128CC%=
40gmail.com</a>.<br />

--Apple-Mail-07E7F8DF-30EC-4467-9F11-C5FF69FD73F6--

.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Mon, 13 Jun 2016 15:05:25 +0300
Raw View
This is a multi-part message in MIME format.

--nextPart1881748.xZfsF50Y85
Content-Type: text/plain; charset=UTF-8

On Monday, 13 June 2016 14:55:43 MSK alexander.zywicki@gmail.com wrote:
> If that should be the case we would have to write a type trait that makes
> sure that the user supplied clock was an acceptable clock source.

I'm not sure we need a trait for checking the clock for acceptance.

> I suggest
> using the built in ones for the mean time because the std makes certain
> guarantees about those clocks that can make sure that thy meet our needs.
> Not to mention that a default would be needed even if we allowed user
> supplied clocks

The problem I have with std::chrono::steady_clock is that it's not guaranteed
to be equivalent to CLOCK_MONOTONIC. Or any other POSIX clock type. It may
work as a default clock type, should we decide one is needed, but IMO it
should be customizable from the start.

--
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 email 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/8842319.5S1MoY7pmH%40lastique-pc.

--nextPart1881748.xZfsF50Y85
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-=
html40/strict.dtd">
<html><head><meta name=3D"qrichtext" content=3D"1" /><style type=3D"text/cs=
s">
p, li { white-space: pre-wrap; }
</style></head><body style=3D" font-family:'DejaVu Sans Mono'; font-size:9p=
t; font-weight:400; font-style:normal;">
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Monday, =
13 June 2016 14:55:43 MSK alexander.zywicki@gmail.com wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; If tha=
t should be the case we would have to write a type trait that makes</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; sure t=
hat the user supplied clock was an acceptable clock source.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">I'm not sur=
e we need a trait for checking the clock for acceptance.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; I sugg=
est</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; using =
the built in ones for the mean time because the std makes certain</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; guaran=
tees about those clocks that can make sure that thy meet our needs.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; Not to=
 mention that a default would be needed even if we allowed user</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; suppli=
ed clocks</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">The problem=
 I have with std::chrono::steady_clock is that it's not guaranteed to be eq=
uivalent to CLOCK_MONOTONIC. Or any other POSIX clock type. It may work as =
a default clock type, should we decide one is needed, but IMO it should be =
customizable from the start.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8842319.5S1MoY7pmH%40lastique-pc?utm_=
medium=3Demail&utm_source=3Dfooter">https://groups.google.com/a/isocpp.org/=
d/msgid/std-proposals/8842319.5S1MoY7pmH%40lastique-pc</a>.<br />

--nextPart1881748.xZfsF50Y85--


.


Author: alexander.zywicki@gmail.com
Date: Mon, 13 Jun 2016 10:52:35 -0500
Raw View
--Apple-Mail-7AEC68FB-A09A-40B6-BDDD-7AFBFBDAAFFD
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

It may not match any posix monotonic clock type but it is specified to be m=
onotonic as far as I remember( at least going off of http://en.cppreference=
..com/w/cpp/chrono/steady_clock) I will dig through the std eventually to do=
uble check. As long as the is_steady is set to true it will work for this c=
ontext

> On Jun 13, 2016, at 7:05 AM, Andrey Semashev <andrey.semashev@gmail.com> =
wrote:
>=20
> On Monday, 13 June 2016 14:55:43 MSK alexander.zywicki@gmail.com wrote:
> > If that should be the case we would have to write a type trait that mak=
es
> > sure that the user supplied clock was an acceptable clock source.
> =20
> I'm not sure we need a trait for checking the clock for acceptance.
> =20
> > I suggest
> > using the built in ones for the mean time because the std makes certain
> > guarantees about those clocks that can make sure that thy meet our need=
s.
> > Not to mention that a default would be needed even if we allowed user
> > supplied clocks
> =20
> The problem I have with std::chrono::steady_clock is that it's not guaran=
teed to be equivalent to CLOCK_MONOTONIC. Or any other POSIX clock type. It=
 may work as a default clock type, should we decide one is needed, but IMO =
it should be customizable from the start.
> =20
> --=20
> You received this message because you are subscribed to a topic in the Go=
ogle Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.=
org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to std-p=
roposals+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/isoc=
pp.org/d/msgid/std-proposals/8842319.5S1MoY7pmH%40lastique-pc.

--=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/DB2ADD2C-9975-4545-8379-9BF5088F7FB2%40gmail.com=
..

--Apple-Mail-7AEC68FB-A09A-40B6-BDDD-7AFBFBDAAFFD
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=
=3Dutf-8"></head><body dir=3D"auto"><div></div><div>It may not match any po=
six monotonic clock type but it is specified to be monotonic as far as I re=
member( at least going off of&nbsp;<a href=3D"http://en.cppreference.com/w/=
cpp/chrono/steady_clock">http://en.cppreference.com/w/cpp/chrono/steady_clo=
ck</a>) I will dig through the std eventually to double check. As long as t=
he is_steady is set to true it will work for this context</div><div><br>On =
Jun 13, 2016, at 7:05 AM, Andrey Semashev &lt;<a href=3D"mailto:andrey.sema=
shev@gmail.com">andrey.semashev@gmail.com</a>&gt; wrote:<br><br></div><bloc=
kquote type=3D"cite"><div>
<meta name=3D"qrichtext" content=3D"1">
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Monday, =
13 June 2016 14:55:43 MSK <a href=3D"mailto:alexander.zywicki@gmail.com">al=
exander.zywicki@gmail.com</a> wrote:</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; If tha=
t should be the case we would have to write a type trait that makes</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; sure t=
hat the user supplied clock was an acceptable clock source.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">I'm not sur=
e we need a trait for checking the clock for acceptance.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; I sugg=
est</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; using =
the built in ones for the mean time because the std makes certain</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; guaran=
tees about those clocks that can make sure that thy meet our needs.</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; Not to=
 mention that a default would be needed even if we allowed user</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; suppli=
ed clocks</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">The problem=
 I have with std::chrono::steady_clock is that it's not guaranteed to be eq=
uivalent to CLOCK_MONOTONIC. Or any other POSIX clock type. It may work as =
a default clock type, should we decide one is needed, but IMO it should be =
customizable from the start.</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>

<p></p>

-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe">https://groups.=
google.com/a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe</a>.<=
br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@=
isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8842319.5S1MoY7pmH%40lastique-pc?utm_=
medium=3Demail&amp;utm_source=3Dfooter">https://groups.google.com/a/isocpp.=
org/d/msgid/std-proposals/8842319.5S1MoY7pmH%40lastique-pc</a>.<br>
</div></blockquote></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/DB2ADD2C-9975-4545-8379-9BF5088F7FB2%=
40gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/DB2ADD2C-9975-4545-8379-9BF5088F7FB2%=
40gmail.com</a>.<br />

--Apple-Mail-7AEC68FB-A09A-40B6-BDDD-7AFBFBDAAFFD--

.


Author: Robert Bielik <robert.bielik@gmail.com>
Date: Mon, 13 Jun 2016 18:48:29 +0200
Raw View
--001a113ad4c277b76205352ba8a4
Content-Type: text/plain; charset=UTF-8

Since ultimately, the timing of audio frames could be used to synchronize
audio from sources not sharing a clock, the resolution of the timestamp
must be substantially larger than "number of samples ", I propose what was
mentioned earlier, a steady clock with nanosecond resolution.

/R
Den 12 jun 2016 23:09 skrev <alexander.zywicki@gmail.com>:

> In that case I would argue for the use of the "std::chrono::steady_clock"
> based on the fact that it is specified to be a monotonic clock.
>
> Or a clock defined in a similar manor that counts in samples.
>
> I also would imagine that our clock would need to have "is_steady" always
> be true?
>
>
> On Jun 11, 2016, at 4:09 AM, Andrey Semashev <andrey.semashev@gmail.com>
> wrote:
>
> On Saturday, 11 June 2016 11:03:41 MSK alexander.zywicki@gmail.com wrote:
>
> > Or at least store a time point each time the stream is started using a
> clock
>
> > with a well defined epoch, so that we might be able to find the length of
>
> > time that the stream has been active and have meaningful measurements of
>
> > time within the stream.
>
>
>
> There is no need to have the epoch bound to the beginning of the stream to
> calculate its duration. Or any particular epoch at all. All you need is the
> timestamp of its first and last frames.
>
>
>
> A fixed epoch becomes important when you try to synchronize multiple
> streams together. But even then it's not important what exactly is the
> epoch; what is important is that it has to be the same for all streams you
> are processing.
>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email 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/3560828.vAATzG8HgS%40lastique-pc
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/3560828.vAATzG8HgS%40lastique-pc?utm_medium=email&utm_source=footer>
> .
>
> --
> 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
> email 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/8AB38C1F-590D-4F81-9839-D7A4604E1831%40gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/8AB38C1F-590D-4F81-9839-D7A4604E1831%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

--
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 email 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/CAEvHzA0emfwFJxzU%2BYyKog0H52MLnq6BnyuOzC27QVNUA_8Thw%40mail.gmail.com.

--001a113ad4c277b76205352ba8a4
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p dir=3D"ltr">Since ultimately, the timing of audio frames could be used t=
o synchronize audio from sources not sharing a clock, the resolution of the=
 timestamp must be substantially larger than &quot;number of samples &quot;=
, I propose what was mentioned earlier, a steady clock with nanosecond reso=
lution.</p>
<p dir=3D"ltr">/R</p>
<div class=3D"gmail_quote">Den 12 jun 2016 23:09 skrev  &lt;<a href=3D"mail=
to:alexander.zywicki@gmail.com">alexander.zywicki@gmail.com</a>&gt;:<br typ=
e=3D"attribution"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .=
8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"auto"><div></d=
iv><div>In that case I would argue for the use of the &quot;std::chrono::st=
eady_clock&quot; based on the fact that it is specified to be a monotonic c=
lock.=C2=A0</div><div><br></div><div>Or a clock defined in a similar manor =
that counts in samples.=C2=A0</div><div><br></div><div>I also would imagine=
 that our clock would need to have &quot;is_steady&quot; always be true?</d=
iv><div><br></div><div><br>On Jun 11, 2016, at 4:09 AM, Andrey Semashev &lt=
;<a href=3D"mailto:andrey.semashev@gmail.com" target=3D"_blank">andrey.sema=
shev@gmail.com</a>&gt; wrote:<br><br></div><blockquote type=3D"cite"><div>

<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">On Saturday, 11 June 2016 11:03:41 MSK <a href=3D"mailt=
o:alexander.zywicki@gmail.com" target=3D"_blank">alexander.zywicki@gmail.co=
m</a> wrote:</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; Or at least store a time point each time the strea=
m is started using a clock</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; with a well defined epoch, so that we might be abl=
e to find the length of</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; time that the stream has been active and have mean=
ingful measurements of</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; time within the stream.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">=C2=A0</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">There is no need to have the epoch bound to the beginni=
ng of the stream to calculate its duration. Or any particular epoch at all.=
 All you need is the timestamp of its first and last frames.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">=C2=A0</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">A fixed epoch becomes important when you try to synchro=
nize multiple streams together. But even then it&#39;s not important what e=
xactly is the epoch; what is important is that it has to be the same for al=
l streams you are processing.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">=C2=A0</p>

<p></p>

-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s=
/unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_blank">std-prop=
osals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/3560828.vAATzG8HgS%40lastique-pc?utm_=
medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">https://groups.go=
ogle.com/a/isocpp.org/d/msgid/std-proposals/3560828.vAATzG8HgS%40lastique-p=
c</a>.<br>
</div></blockquote></div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8AB38C1F-590D-4F81-9839-D7A4604E1831%=
40gmail.com?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/8AB38C1F-590D-4=
F81-9839-D7A4604E1831%40gmail.com</a>.<br>
</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAEvHzA0emfwFJxzU%2BYyKog0H52MLnq6Bny=
uOzC27QVNUA_8Thw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAEvHzA0emfwFJx=
zU%2BYyKog0H52MLnq6BnyuOzC27QVNUA_8Thw%40mail.gmail.com</a>.<br />

--001a113ad4c277b76205352ba8a4--

.


Author: alexander.zywicki@gmail.com
Date: Mon, 13 Jun 2016 12:06:37 -0500
Raw View
--Apple-Mail-588765F3-D62F-4896-8A83-F19AD26C8B22
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

That is why I am arguing for the definition of a clock I provided in the co=
de example earlier. It will provide the highest resolution steady clock tha=
t chrono provides. Or we will need to create our own. But I'm at least for =
the mean time Trying to use what is already standardized=20

> On Jun 13, 2016, at 11:48 AM, Robert Bielik <robert.bielik@gmail.com> wro=
te:
>=20
> Since ultimately, the timing of audio frames could be used to synchronize=
 audio from sources not sharing a clock, the resolution of the timestamp mu=
st be substantially larger than "number of samples ", I propose what was me=
ntioned earlier, a steady clock with nanosecond resolution.
>=20
> /R
>=20
> Den 12 jun 2016 23:09 skrev <alexander.zywicki@gmail.com>:
>> In that case I would argue for the use of the "std::chrono::steady_clock=
" based on the fact that it is specified to be a monotonic clock.=20
>>=20
>> Or a clock defined in a similar manor that counts in samples.=20
>>=20
>> I also would imagine that our clock would need to have "is_steady" alway=
s be true?
>>=20
>>=20
>>> On Jun 11, 2016, at 4:09 AM, Andrey Semashev <andrey.semashev@gmail.com=
> wrote:
>>>=20
>>> On Saturday, 11 June 2016 11:03:41 MSK alexander.zywicki@gmail.com wrot=
e:
>>> > Or at least store a time point each time the stream is started using =
a clock
>>> > with a well defined epoch, so that we might be able to find the lengt=
h of
>>> > time that the stream has been active and have meaningful measurements=
 of
>>> > time within the stream.
>>> =20
>>> There is no need to have the epoch bound to the beginning of the stream=
 to calculate its duration. Or any particular epoch at all. All you need is=
 the timestamp of its first and last frames.
>>> =20
>>> A fixed epoch becomes important when you try to synchronize multiple st=
reams together. But even then it's not important what exactly is the epoch;=
 what is important is that it has to be the same for all streams you are pr=
ocessing.
>>> =20
>>> --=20
>>> You received this message because you are subscribed to a topic in the =
Google Groups "ISO C++ Standard - Future Proposals" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/a/isocp=
p.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email 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/is=
ocpp.org/d/msgid/std-proposals/3560828.vAATzG8HgS%40lastique-pc.
>>=20
>> --=20
>> You received this message because you are subscribed to the Google Group=
s "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n email 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/iso=
cpp.org/d/msgid/std-proposals/8AB38C1F-590D-4F81-9839-D7A4604E1831%40gmail.=
com.
>=20
> --=20
> You received this message because you are subscribed to a topic in the Go=
ogle Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.=
org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to std-p=
roposals+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/isoc=
pp.org/d/msgid/std-proposals/CAEvHzA0emfwFJxzU%2BYyKog0H52MLnq6BnyuOzC27QVN=
UA_8Thw%40mail.gmail.com.

--=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/33B6A68A-3AD7-4664-B5AC-D46DEE473A84%40gmail.com=
..

--Apple-Mail-588765F3-D62F-4896-8A83-F19AD26C8B22
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=
=3Dutf-8"></head><body dir=3D"auto"><div></div><div>That is why I am arguin=
g for the definition of a clock I provided in the code example earlier. It =
will provide the highest resolution steady clock that chrono provides. Or w=
e will need to create our own. But I'm at least for the mean time Trying to=
 use what is already standardized&nbsp;</div><div><br>On Jun 13, 2016, at 1=
1:48 AM, Robert Bielik &lt;<a href=3D"mailto:robert.bielik@gmail.com">rober=
t.bielik@gmail.com</a>&gt; wrote:<br><br></div><blockquote type=3D"cite"><d=
iv><p dir=3D"ltr">Since ultimately, the timing of audio frames could be use=
d to synchronize audio from sources not sharing a clock, the resolution of =
the timestamp must be substantially larger than "number of samples ", I pro=
pose what was mentioned earlier, a steady clock with nanosecond resolution.=
</p>
<p dir=3D"ltr">/R</p>
<div class=3D"gmail_quote">Den 12 jun 2016 23:09 skrev  &lt;<a href=3D"mail=
to:alexander.zywicki@gmail.com">alexander.zywicki@gmail.com</a>&gt;:<br typ=
e=3D"attribution"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .=
8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"auto"><div></d=
iv><div>In that case I would argue for the use of the "std::chrono::steady_=
clock" based on the fact that it is specified to be a monotonic clock.&nbsp=
;</div><div><br></div><div>Or a clock defined in a similar manor that count=
s in samples.&nbsp;</div><div><br></div><div>I also would imagine that our =
clock would need to have "is_steady" always be true?</div><div><br></div><d=
iv><br>On Jun 11, 2016, at 4:09 AM, Andrey Semashev &lt;<a href=3D"mailto:a=
ndrey.semashev@gmail.com" target=3D"_blank">andrey.semashev@gmail.com</a>&g=
t; wrote:<br><br></div><blockquote type=3D"cite"><div>

<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">On Saturday, 11 June 2016 11:03:41 MSK <a href=3D"mailt=
o:alexander.zywicki@gmail.com" target=3D"_blank">alexander.zywicki@gmail.co=
m</a> wrote:</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; Or at least store a time point each time the strea=
m is started using a clock</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; with a well defined epoch, so that we might be abl=
e to find the length of</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; time that the stream has been active and have mean=
ingful measurements of</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&gt; time within the stream.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&nbsp;</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">There is no need to have the epoch bound to the beginni=
ng of the stream to calculate its duration. Or any particular epoch at all.=
 All you need is the timestamp of its first and last frames.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&nbsp;</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">A fixed epoch becomes important when you try to synchro=
nize multiple streams together. But even then it's not important what exact=
ly is the epoch; what is important is that it has to be the same for all st=
reams you are processing.</p>
<p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0=
px;text-indent:0px">&nbsp;</p>

<p></p>

-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s=
/unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_blank">std-prop=
osals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/3560828.vAATzG8HgS%40lastique-pc?utm_=
medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">https://groups.go=
ogle.com/a/isocpp.org/d/msgid/std-proposals/3560828.vAATzG8HgS%40lastique-p=
c</a>.<br>
</div></blockquote></div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8AB38C1F-590D-4F81-9839-D7A4604E1831%=
40gmail.com?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/8AB38C1F-590D-4=
F81-9839-D7A4604E1831%40gmail.com</a>.<br>
</blockquote></div>

<p></p>

-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe">https://groups.=
google.com/a/isocpp.org/d/topic/std-proposals/Hkdh02Ejx6s/unsubscribe</a>.<=
br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@=
isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAEvHzA0emfwFJxzU%2BYyKog0H52MLnq6Bny=
uOzC27QVNUA_8Thw%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAEvHzA0emf=
wFJxzU%2BYyKog0H52MLnq6BnyuOzC27QVNUA_8Thw%40mail.gmail.com</a>.<br>
</div></blockquote></body></html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/33B6A68A-3AD7-4664-B5AC-D46DEE473A84%=
40gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/33B6A68A-3AD7-4664-B5AC-D46DEE473A84%=
40gmail.com</a>.<br />

--Apple-Mail-588765F3-D62F-4896-8A83-F19AD26C8B22--

.