From 1972040cb0edbfc4dc8919c6ed34ed1bc1a6536f Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Fri, 3 Feb 2023 11:48:37 +0100 Subject: [PATCH] beginning of daisy seed support --- TODO | 1 + examples/common/daisy-seed/daisy-seed.mk | 16 ++++++++ examples/common/daisy-seed/fx.cpp | 52 ++++++++++++++++++++++++ examples/fx_wah/daisy-seed/Makefile | 6 +++ 4 files changed, 75 insertions(+) create mode 100644 examples/common/daisy-seed/daisy-seed.mk create mode 100644 examples/common/daisy-seed/fx.cpp create mode 100644 examples/fx_wah/daisy-seed/Makefile diff --git a/TODO b/TODO index ab2dc6a..53d8597 100644 --- a/TODO +++ b/TODO @@ -26,6 +26,7 @@ code: * pan process with no out: should just reset coeffs? * trace calls (debug) * svf bandpass out polarity too confusing? +* better common config.h (less stuff maybe) build system: * make makefiles handle paths with spaces etc diff --git a/examples/common/daisy-seed/daisy-seed.mk b/examples/common/daisy-seed/daisy-seed.mk new file mode 100644 index 0000000..ed7ac51 --- /dev/null +++ b/examples/common/daisy-seed/daisy-seed.mk @@ -0,0 +1,16 @@ +LIBDAISY_DIR := ${ROOT_DIR}/../../../../libDaisy + +ifdef SYNTH +CPP_SOURCES = ${ROOT_DIR}/../../common/daisy-seed/synth.cpp +else +CPP_SOURCES = ${ROOT_DIR}/../../common/daisy-seed/fx.cpp +endif + +LDFLAGS += -u _printf_float + +SYSTEM_FILES_DIR = ${LIBDAISY_DIR}/core +include ${SYSTEM_FILES_DIR}/Makefile + +CPPFLAGS += \ + -I${ROOT_DIR}/../src \ + -I${ROOT_DIR}/../../../include diff --git a/examples/common/daisy-seed/fx.cpp b/examples/common/daisy-seed/fx.cpp new file mode 100644 index 0000000..da249e4 --- /dev/null +++ b/examples/common/daisy-seed/fx.cpp @@ -0,0 +1,52 @@ +#include "daisy_seed.h" +#include "config.h" + +using namespace daisy; + +DaisySeed hardware; + +P_TYPE instance; + +static void AudioCallback( + AudioHandle::InterleavingInputBuffer in, + AudioHandle::InterleavingOutputBuffer out, + size_t size) { + // set params + // update coeffs ctrl + for (size_t i = 0; i < size; i++) + // update coeffs audio + out[i] = in[i]; +} + +int main() { + hardware.Configure(); + hardware.Init(); + + // ... + AdcChannelConfig adcConfig; + adcConfig.InitSingle(hardware.GetPin(21)); + + hardware.adc.Init(&adcConfig, 1); + hardware.adc.Start(); + // ... + + hardware.SetAudioBlockSize(32); + float sample_rate = hardware.AudioSampleRate(); + + // init + // set sample rate + + hardware.StartLog(); + + // set params + // reset coeffs + // reset state + + hardware.StartAudio(AudioCallback); + + while (1) { + //hardware.adc.GetFloat(0); + //hardware.PrintLine("%f",x); + //System::Delay(x); + } +} diff --git a/examples/fx_wah/daisy-seed/Makefile b/examples/fx_wah/daisy-seed/Makefile new file mode 100644 index 0000000..958ca97 --- /dev/null +++ b/examples/fx_wah/daisy-seed/Makefile @@ -0,0 +1,6 @@ +ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) + +TARGET = bw_example_fx_wah +CPP_SOURCES += ${ROOT_DIR}/../src/bw_example_fx_wah.c + +include ${ROOT_DIR}/../../common/daisy-seed/daisy-seed.mk