2 changed files with 49 additions and 34 deletions
@ -1,43 +1,54 @@ |
|||||
#include "daisy_seed.h" |
#include "types.hh" |
||||
#include "daisysp.h" |
|
||||
|
|
||||
namespace ld = daisy; |
namespace Heck { |
||||
namespace dsp = daisysp; |
namespace Constants { |
||||
|
} |
||||
static ld::DaisySeed hardware; |
|
||||
static dsp::Oscillator osc; |
|
||||
|
|
||||
void AudioCallback( |
ld::DaisySeed hw{}; |
||||
ld::AudioHandle::InterleavingInputBuffer in, |
dsp::Oscillator osc{}; |
||||
ld::AudioHandle::InterleavingOutputBuffer out, |
|
||||
size_t size) |
void AudioCallback( |
||||
{ |
ld::AudioHandle::InterleavingInputBuffer in, |
||||
float osc_out; |
ld::AudioHandle::InterleavingOutputBuffer out, |
||||
osc.SetFreq(1000); |
size_t size) |
||||
for (size_t i = 0; i < size; i += 2) { |
{ |
||||
osc.SetAmp(1.0); |
float osc_out; |
||||
osc_out = osc.Process(); |
osc.SetFreq(1000); |
||||
osc_out *= 0.01; |
|
||||
out[i] = osc_out; |
for (size_t i = 0; i < size; i += 2) { |
||||
out[i + 1] = osc_out; |
osc.SetAmp(1.0); |
||||
|
osc_out = osc.Process(); |
||||
|
osc_out *= 0.005; |
||||
|
out[i] = osc_out; |
||||
|
out[i + 1] = osc_out; |
||||
|
} |
||||
} |
} |
||||
} |
|
||||
|
|
||||
|
void init() |
||||
|
{ |
||||
|
hw.Configure(); |
||||
|
hw.Init(); |
||||
|
hw.SetAudioBlockSize(4); |
||||
|
float samplerate = hw.AudioSampleRate(); |
||||
|
|
||||
int main(void) |
osc.Init(samplerate); |
||||
{ |
osc.SetWaveform(osc.WAVE_SIN); |
||||
hardware.Configure(); |
osc.SetAmp(1.f); |
||||
hardware.Init(); |
osc.SetFreq(1000); |
||||
hardware.SetAudioBlockSize(4); |
|
||||
|
|
||||
float samplerate = hardware.AudioSampleRate(); |
hw.StartAudio(AudioCallback); |
||||
|
} |
||||
|
|
||||
osc.Init(samplerate); |
void mainloop() |
||||
osc.SetWaveform(osc.WAVE_SIN); |
{ |
||||
osc.SetAmp(1.f); |
for (;;) {} |
||||
osc.SetFreq(1000); |
} |
||||
|
} // namespace Heck
|
||||
|
|
||||
hardware.StartAudio(AudioCallback); |
|
||||
|
|
||||
while (true) {} |
int main(void) |
||||
|
{ |
||||
|
Heck::init(); |
||||
|
Heck::mainloop(); |
||||
|
return 0; |
||||
} |
} |
||||
|
Loading…
Reference in new issue