aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md51
-rw-r--r--src/opcodes.cpp4
2 files changed, 48 insertions, 7 deletions
diff --git a/README.md b/README.md
index 97fe2a9..8e82b28 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
# csound-datacore : Data audification/sonification for Csound on Linux
## Overview
-csound-datacore provides a way to read data associated with a process ID as audio.
-Only Linux is supported or an OS that supports userspace reading of /proc/.../mem
+csound-datacore provides a way to read raw data from disk, memory and screen.
+For the memory and X11 window reading opcodes, only Linux is supported or an OS that supports userspace reading of /proc/.../mem
## Requirements
* Linux
@@ -10,7 +10,7 @@ Only Linux is supported or an OS that supports userspace reading of /proc/.../me
* Csound with development headers >= 6.14.0
* Optional: X11 with development libraries
-Tested on Linux as of August 2021.
+Tested on Linux as of August 2021, Windows as of March 2024.
## Installation
@@ -30,7 +30,7 @@ Some examples are provided in the examples directory.
## Opcode reference
### ipids[] memps
-Obtain a list of process IDs owned by the executing user.
+Obtain a list of process IDs readable by the executing user.
* ipids[] : array of process IDs
@@ -43,6 +43,16 @@ Get the process command line or name for a given process ID if available.
* Sname : the process command line
+### isize mempssize ipid [, iskipzero=0]
+Get the memory usage of a process, interpreted as a number of audio samples.
+
+* isize : the size in samples
+
+* ipid : the process ID
+* iskipzero : if non-zero, skip empty memory locations associated with the process
+
+
+
### ifn mem2tab ipid [, iskipzero=0]
Read the memory associated with a process ID into a new function table which can be
used by loscil and other such opcodes.
@@ -62,4 +72,35 @@ Buffered memory reading and direct audio output. The buffer is only refilled whe
* koffset : position to read memory from, normalised to between 0 and 1
* kbuffermultiplier : buffer read size multiplier between 0 and 1
* ibuffersize : the size in samples of the buffer to read memory data into
-* iskipzero : if non-zero, skip empty memory locations, without this the output may contain a lot of silence depending on the process \ No newline at end of file
+* iskipzero : if non-zero, skip empty memory locations, without this the output may contain a lot of silence depending on the process
+
+
+### ifn rawreadtable Sfile [, ichannels=1, istart=0, iskip=1]
+Read a file from the filesystem to a new f-table, interpreting raw character data as floats according to the orchestra samplerate and bit depth of the build.
+
+* ifn : the newly created f-table containing the data read
+
+* Sfile : path of the file to read
+* ichannels : how many channels to interpret the raw data as (1 or 2)
+* istart : offset the initial read by this number of bytes
+* iskip : how many bytes to increment each read step by
+
+
+### aL [, aR] rawread Sfile [, iloop=0]
+Read a file from the filesystem, interpreting raw character data as floats according to the orchestra samplerate and bit depth of the build.
+
+* aL, aR : left and right channels. If only one output is specified then the file is read as mono data, otherwise stereo.
+
+* Sfile : path of the file to read
+* iloop : whether to loop the reading of the file when the end is reached; 1 = loop, 0 = no loop
+
+
+### aout winson iwindowid
+Read the contents of a X11 window and interpret pixel data as floats, outputting audio correpsonding to the orchestra samplerate and bit depth.
+Currently not fully implemented and iwindowid will default to the DefaultRootWindow response from X11.
+
+* aout : the resulting audio
+
+* iwindowid : the X11 window ID to inspect
+
+
diff --git a/src/opcodes.cpp b/src/opcodes.cpp
index fab6c7c..65ba587 100644
--- a/src/opcodes.cpp
+++ b/src/opcodes.cpp
@@ -537,8 +537,8 @@ struct winson : csnd::Plugin<1, 1> {
int init() {
display = XOpenDisplay(NULL);
- //root = DefaultRootWindow(display);
- root = 0x2200004;
+ root = DefaultRootWindow(display);
+ //root = 0x2200004;
XWindowAttributes gwa;
XGetWindowAttributes(display, root, &gwa);