diff options
Diffstat (limited to 'src/mossrose.c')
-rw-r--r-- | src/mossrose.c | 21 |
1 files changed, 19 insertions, 2 deletions
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<n_channels; i++) + channel_init(mossrose_global.channels + i); + }; @@ -16,6 +33,6 @@ int mossrose_play(struct mossrose_sound_t *sound, int channel) } -int mossrose_terminate(double sample_rate, int n_channels) +int mossrose_terminate() { } |