diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2023-07-07 22:19:48 +0300 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2023-07-07 22:19:48 +0300 |
commit | 3466a5ee2a4e03dae73f6c441d6f1daa5718952d (patch) | |
tree | db6f4d1056bda6042523805c3edcbdbd5abf1b97 /src/osc.h | |
parent | c8cd7f9298de876f2046fddd2e322a63c421a505 (diff) | |
download | synth-project-3466a5ee2a4e03dae73f6c441d6f1daa5718952d.tar.gz synth-project-3466a5ee2a4e03dae73f6c441d6f1daa5718952d.tar.bz2 synth-project-3466a5ee2a4e03dae73f6c441d6f1daa5718952d.zip |
moar
Diffstat (limited to 'src/osc.h')
-rw-r--r-- | src/osc.h | 35 |
1 files changed, 24 insertions, 11 deletions
@@ -28,6 +28,15 @@ typedef struct osc_t { long end; enum osc_type type; } osc_t; + +#define MAKE_OSC(_name, _len, _type) {\ + .name = _name, \ + .data = 0, \ + .len = _len, \ + .start = 0, \ + .end = _len, \ + .type = _type, \ + }; /* Initializes the wavetables and functions for the oscilators */ void init_osc(); @@ -42,31 +51,35 @@ int osc_load_wav(osc_t * osc, const char * path); /* OSCILATORS */ /***************/ -#define OSC_COMMON(osc) \ - void \ - set_##osc##_start(long start) \ - { OSC_##osc.start = start; } \ - void \ - set_##osc##_end(long end) \ - { OSC_##osc.end = end; } - +// function prototypes common for all oscs #define OSC_COMMON_H(osc) \ void \ set_##osc##_start(long start); \ void \ set_##osc##_end(long end); \ + void \ + set_##osc##_len(long len); \ float \ osc_##osc(float offset); \ float \ osc_##osc##_next(float f, float offset); -/*****************/ -/* osc functions */ -/*****************/ +// function definitions common for all oscs +#define OSC_COMMON(osc) \ + void \ + set_##osc##_start(long start) \ + { OSC_##osc.start = start; } \ + void \ + set_##osc##_end(long end) \ + { OSC_##osc.end = end; } \ + void \ + set_##osc##_len(long len) \ + { OSC_##osc.len = len; } OSC_COMMON_H(tri) OSC_COMMON_H(sin) OSC_COMMON_H(weird) OSC_COMMON_H(sound) +OSC_COMMON_H(saw) #endif /* OSC_H */ |