aboutsummaryrefslogtreecommitdiff
path: root/spectrogram.c
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2013-06-23 13:50:07 +0000
committerDimitri Sokolyuk <demon@dim13.org>2013-06-23 13:50:07 +0000
commit68f146a132954db19c352db4168101e8f016a67f (patch)
treeb27690eba142c40480ba7d859018b3330d0e7cfa /spectrogram.c
parenta96e6ccdca73f9c57a9d08dea3d3c36a07ab986f (diff)
encapsulate sio read buffer
Diffstat (limited to 'spectrogram.c')
-rw-r--r--spectrogram.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/spectrogram.c b/spectrogram.c
index 58b5181..4f882d4 100644
--- a/spectrogram.c
+++ b/spectrogram.c
@@ -60,7 +60,6 @@ int die = 0;
struct data {
int16_t *buffer;
- size_t bufsz;
double *left;
double *right;
int *left_shadow;
@@ -332,11 +331,6 @@ main(int argc, char **argv)
XSelectInput(dsp, win, ExposureMask|KeyPressMask);
XMapWindow(dsp, win);
- data.bufsz = RCHAN * delta * sizeof(int16_t); /* par.rchan */
- data.buffer = malloc(data.bufsz);
- if (!data.buffer)
- errx(1, "malloc failed");
-
data.left = calloc(delta, sizeof(double));
data.right = calloc(delta, sizeof(double));
data.left_shadow = calloc(delta, sizeof(int));
@@ -358,7 +352,7 @@ main(int argc, char **argv)
fft = init_fft(delta);
while (!die) {
- read_sio(sio, data.buffer, data.bufsz);
+ data.buffer = read_sio(sio);
dofft(fft, data.buffer, data.left, 0);
dofft(fft, data.buffer, data.right, 1);
draw(&data);