Browse Source

examples belong into heck_daisy_template repo

main
heck 9 months ago
parent
commit
6b6dfd5122
  1. 16
      src/main_blink.cc
  2. 51
      src/main_testtone.cc

16
src/main_blink.cc

@ -1,16 +0,0 @@
#include "daisy_seed.h"
using namespace daisy;
static DaisySeed hw{};
int main()
{
hw.Init();
while (true) {
hw.SetLed(true);
hw.DelayMs(100);
hw.SetLed(false);
hw.DelayMs(500);
}
}

51
src/main_testtone.cc

@ -1,51 +0,0 @@
#include "daisy_seed.h"
#include "daisysp.h"
// Use the daisy namespace to prevent having to type
// daisy:: before all libdaisy functions
using namespace daisy;
using namespace daisysp;
// Declare a DaisySeed object called hardware
DaisySeed hardware;
Oscillator osc;
void AudioCallback(
AudioHandle::InterleavingInputBuffer in,
AudioHandle::InterleavingOutputBuffer out,
size_t size)
{
float osc_out;
//Convert floating point knob to midi (0-127)
//Then convert midi to freq. in Hz
osc.SetFreq(1000);
//Fill the block with samples
for (size_t i = 0; i < size; i += 2) {
osc.SetAmp(1.0);
osc_out = osc.Process();
osc_out *= 0.1;
out[i] = osc_out;
out[i + 1] = osc_out;
}
}
int main(void)
{
hardware.Configure();
hardware.Init();
hardware.SetAudioBlockSize(4);
float samplerate = hardware.AudioSampleRate();
osc.Init(samplerate);
osc.SetWaveform(osc.WAVE_SIN);
osc.SetAmp(1.f);
osc.SetFreq(1000);
hardware.StartAudio(AudioCallback);
for (;;) {}
}
Loading…
Cancel
Save