Skip to content

Commit

Permalink
Cleanup before PR
Browse files Browse the repository at this point in the history
  • Loading branch information
erkkah committed Feb 3, 2024
1 parent 1570155 commit 8e1a431
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/amy-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/amy_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 6 additions & 5 deletions src/examples.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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() {
Expand All @@ -256,3 +255,5 @@ void example_custom_beep() {
e.time += 500;
amy_add_event(e);
}

#endif

0 comments on commit 8e1a431

Please sign in to comment.