From 48e6520f6517f196a0a8f39bf86159075ad44c6b Mon Sep 17 00:00:00 2001 From: sanine Date: Wed, 31 Aug 2022 14:34:22 -0500 Subject: finish basic implementation --- src/CMakeLists.txt | 1 + src/mossrose.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 101 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cca9610..0453c34 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,6 +3,7 @@ project(mossrose) target_sources(mossrose PUBLIC ${CMAKE_CURRENT_LIST_DIR}/mossrose.c ${CMAKE_CURRENT_LIST_DIR}/channel.c + ${CMAKE_CURRENT_LIST_DIR}/sound.c ) diff --git a/src/mossrose.c b/src/mossrose.c index 4babfd7..fb017cd 100644 --- a/src/mossrose.c +++ b/src/mossrose.c @@ -13,26 +13,125 @@ struct mossrose_global_t { } mossrose_global; +static int callback( + const void *input, + void *output, + unsigned long frame_count, + const PaStreamCallbackTimeInfo* time_info, + PaStreamCallbackFlags status_flags, + void *user_data) +{ + float *out = output; + float *left, *right; + float l, r; + + for (int i=0; i= 0) { + /* play on specified channel */ + if (channel_sound_load(mossrose_global.channels + channel, sound, true) == 0) + return channel; + else + return -1; + } + else { + /* play on first available channel */ + for (int i=0; i