diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2023-07-07 01:09:12 +0300 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2023-07-07 01:09:12 +0300 |
commit | c8cd7f9298de876f2046fddd2e322a63c421a505 (patch) | |
tree | 1b764fed928592f8f3465e9ef28552b451efad8a /src/osc_sound.c | |
parent | f170fb058a07175e6e753f2a6d20283dc7200a88 (diff) | |
download | synth-project-c8cd7f9298de876f2046fddd2e322a63c421a505.tar.gz synth-project-c8cd7f9298de876f2046fddd2e322a63c421a505.tar.bz2 synth-project-c8cd7f9298de876f2046fddd2e322a63c421a505.zip |
suppa
Diffstat (limited to 'src/osc_sound.c')
-rw-r--r-- | src/osc_sound.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/osc_sound.c b/src/osc_sound.c new file mode 100644 index 0000000..dd4eda5 --- /dev/null +++ b/src/osc_sound.c @@ -0,0 +1,34 @@ +#include "osc.h" + +#include <stdlib.h> + +osc_t OSC_sound = { + .name = "w_sound", + .data = 0, + .len = 0, + .start = 0, + .end = 0, + .type = SAMPLE, +}; + +OSC_COMMON(sound) + +float +osc_sound(float offset) +{ + if (!OSC_sound.len) { + //osc_load_wav(&OSC_sound, "/home/gramanas/code/synth-project/waves/test2.wav"); + osc_load_wav(&OSC_sound, "/home/gramanas/code/synth-project/waves/test_lick.wav"); + /* osc_load_wav(&OSC_sound, "/mnt/data/music/samples/velvet/Drums/Kick/Kick Coldwire 1.wav"); */ + } + + return osc_interpolate(offset, + OSC_sound.data[(int)offset], + OSC_sound.data[osc_next_index(&OSC_sound, offset)]); +} + +float +osc_sound_next(float f, float offset) +{ + return osc_next_offset(&OSC_sound, f, offset); +} |