From 54351358e17b36212872313f4a820d59f14fdf12 Mon Sep 17 00:00:00 2001 From: sanine Date: Wed, 31 Aug 2022 11:51:54 -0500 Subject: add channel sound loading --- src/mossrose.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/mossrose.c') diff --git a/src/mossrose.c b/src/mossrose.c index 40f4393..4babfd7 100644 --- a/src/mossrose.c +++ b/src/mossrose.c @@ -6,8 +6,25 @@ #include "channel.h" -int mossrose_init(double sample_rate, int n_channels) +struct mossrose_global_t { + PaStream *stream; + struct channel_t *channels; + int n_channels; +} mossrose_global; + + +int mossrose_init(double sample_rate, int n_channels, bool init_plibsys) { + /* initialize channels */ + mossrose_global.n_channels = n_channels; + mossrose_global.channels = malloc(n_channels * sizeof(struct channel_t)); + if (mossrose_global.channels == NULL) { + fprintf("failed to allocate memory for %d channels\n", n_channels); + return 1; + } + for (int i=0; i