From 8e1a431d10da22f3b8a717db1ed1b7d3e01046c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Agsj=C3=B6?= Date: Sat, 3 Feb 2024 12:57:18 +0100 Subject: [PATCH] Cleanup before PR --- src/amy-example.c | 6 ++++-- src/amy_config.h | 2 +- src/examples.c | 11 ++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/amy-example.c b/src/amy-example.c index d880e08..a717e3d 100644 --- a/src/amy-example.c +++ b/src/amy-example.c @@ -46,7 +46,9 @@ int main(int argc, char ** argv) { } uint32_t start = amy_sysclock(); + #if AMY_HAS_CUSTOM == 1 example_init_custom(); + #endif amy_start(/* cores= */ 1, /* reverb= */ 1, /* chorus= */ 1); @@ -68,9 +70,9 @@ int main(int argc, char ** argv) { //example_reverb(); //example_chorus(); //example_sine(start); - bleep(start); + //example_custom_beep(); - example_custom_beep(); + bleep(start); example_drums(start+500, 4); example_multimbral_fm(start + 2500, /* start_osc= */ 6); diff --git a/src/amy_config.h b/src/amy_config.h index be5b967..147e724 100644 --- a/src/amy_config.h +++ b/src/amy_config.h @@ -23,7 +23,7 @@ extern const uint16_t pcm_samples; #define AMY_MAX_DRIFT_MS 20000 // ms of time you can schedule ahead before synth recomputes time base #define AMY_KS_OSCS 1 // How many karplus-strong oscillators to keep track of (0 disables KS) #define AMY_HAS_PARTIALS 1 // 1 = Make partials available -#define AMY_HAS_CUSTOM 1 // 1 = Make custom oscillators available +#define AMY_HAS_CUSTOM 0 // 1 = Make custom oscillators available #define PCM_AMY_SAMPLE_RATE 22050 #define AMY_EVENT_FIFO_LEN 2000 diff --git a/src/examples.c b/src/examples.c index 4a4e873..0cb5eaa 100644 --- a/src/examples.c +++ b/src/examples.c @@ -201,18 +201,19 @@ void example_drums(uint32_t start, int loops) { } } +// Minimal custom oscillator + +#if AMY_HAS_CUSTOM == 1 void beeper_init(void) { printf("Beeper init\n"); } void beeper_note_on(struct synthinfo* osc, float freq) { - printf("Beeper note on\n"); saw_down_note_on(osc->osc, freq); } void beeper_note_off(struct synthinfo* osc) { - printf("Beeper note off\n"); osc->note_off_clock = total_samples; } @@ -238,9 +239,7 @@ struct custom_oscillator beeper = { }; void example_init_custom() { - if(AMY_HAS_CUSTOM == 1) { - amy_set_custom(&beeper); - } + amy_set_custom(&beeper); } void example_custom_beep() { @@ -256,3 +255,5 @@ void example_custom_beep() { e.time += 500; amy_add_event(e); } + +#endif