summaryrefslogtreecommitdiff
path: root/src/mossrose.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-08-31 11:51:54 -0500
committersanine <sanine.not@pm.me>2022-08-31 11:51:54 -0500
commit54351358e17b36212872313f4a820d59f14fdf12 (patch)
treeecbbf34f0d2958600956c485d3f1739279b7ee81 /src/mossrose.c
parentb4db9391540442f9708388731d5bcd6fc59b6f5c (diff)
add channel sound loading
Diffstat (limited to 'src/mossrose.c')
-rw-r--r--src/mossrose.c21
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()
{
}