On Wed, May 06, 2020 at 02:26:34PM -0400, Duncan Murdoch wrote:
On 06/05/2020 1:09 p.m., frede...@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

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to