diff options
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 */ |