From irederik m@iii@g oii oib@@et  Wed May  6 21:26:07 2020
From: irederik m@iii@g oii oib@@et (irederik m@iii@g oii oib@@et)
Date: Wed, 6 May 2020 12:26:07 -0700
Subject: [Rd] defining r audio connections
In-Reply-To: <d6158363-d59a-3fa9-7ccd-0a80985094ab@gmail.com>
References: <20200506170919.GA34684@localhost>
 <d6158363-d59a-3fa9-7ccd-0a80985094ab@gmail.com>
Message-ID: <20200506192607.GB34684-3160@localhost>


On Wed, May 06, 2020 at 02:26:34PM -0400, Duncan Murdoch wrote:
>On 06/05/2020 1:09 p.m., frederik at ofb.net wrote:
>>I only want an object that I can use `readBin` and `writeBin` on, to read and write audio data using e.g. `snd_pcm_writei` which is part of the `alsa-lib` package.
>
>I don't think R supports user-defined connections, but probably 
>writing readBin and writeBin equivalents specific to your library 
>wouldn't be any harder than creating a connection.  For those, you 
>will probably want to work with an "external pointer" (see Writing R 
>Extensions). Rcpp probably has support for these if you're working in 
>C++.

Thank you, yes I was following

https://stackoverflow.com/questions/59384221/proper-way-to-return-a-pointer-to-a-new-object-from-an-rcpp-function

which uses XPtr.

I'll forget about making a connection, if it is not supported.

I had this idea that I would be able to use the same code for writing to a file as to an audio device, but I can create my own class for that.

Frederick



[Rd] defining r audio connections
irederik m@iii@g oii oib@@et