Compare commits
5 Commits
58adc59e59
...
5e802093a7
Author | SHA1 | Date |
---|---|---|
|
5e802093a7 | 6 months ago |
|
c8d2ec33e7 | 6 months ago |
|
a55a15756a | 6 months ago |
|
c9c5bfc193 | 6 months ago |
|
22ba774ac8 | 6 months ago |
3 changed files with 53 additions and 50 deletions
@ -1,54 +1,41 @@ |
|||||
#include "types.hh" |
#include "daisy_seed.h" |
||||
|
#include "daisysp.h" |
||||
|
|
||||
namespace Heck { |
namespace ld = daisy; |
||||
namespace Constants { |
namespace dsp = daisysp; |
||||
} |
|
||||
|
|
||||
ld::DaisySeed hw{}; |
ld::DaisySeed seed{}; |
||||
dsp::Oscillator osc{}; |
dsp::Oscillator osc_l{}; |
||||
|
dsp::Oscillator osc_r{}; |
||||
|
|
||||
void AudioCallback( |
void AudioCallback( |
||||
ld::AudioHandle::InterleavingInputBuffer in, |
ld::AudioHandle::InputBuffer in, |
||||
ld::AudioHandle::InterleavingOutputBuffer out, |
ld::AudioHandle::OutputBuffer out, |
||||
size_t size) |
size_t size) |
||||
{ |
{ |
||||
float osc_out; |
float osc_out{}; |
||||
osc.SetFreq(1000); |
for (size_t i = 0; i < size; i++) { |
||||
|
out[0][i] = osc_l.Process() * 0.005; |
||||
for (size_t i = 0; i < size; i += 2) { |
out[1][i] = osc_r.Process() * 0.005; |
||||
osc.SetAmp(1.0); |
|
||||
osc_out = osc.Process(); |
|
||||
osc_out *= 0.005; |
|
||||
out[i] = osc_out; |
|
||||
out[i + 1] = osc_out; |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
|
|
||||
void init() |
int main(void) |
||||
{ |
{ |
||||
hw.Configure(); |
// system init
|
||||
hw.Init(); |
seed.Configure(); |
||||
hw.SetAudioBlockSize(4); |
seed.Init(); |
||||
float samplerate = hw.AudioSampleRate(); |
seed.SetAudioBlockSize(4); |
||||
|
float samplerate = seed.AudioSampleRate(); |
||||
osc.Init(samplerate); |
|
||||
osc.SetWaveform(osc.WAVE_SIN); |
|
||||
osc.SetAmp(1.f); |
|
||||
osc.SetFreq(1000); |
|
||||
|
|
||||
hw.StartAudio(AudioCallback); |
|
||||
} |
|
||||
|
|
||||
void mainloop() |
// application init
|
||||
{ |
osc_l.Init(samplerate); |
||||
for (;;) {} |
osc_l.SetFreq(300); |
||||
} |
|
||||
} // namespace Heck
|
|
||||
|
|
||||
|
osc_r.Init(samplerate); |
||||
|
osc_r.SetFreq(400); |
||||
|
|
||||
int main(void) |
// system main
|
||||
{ |
seed.StartAudio(AudioCallback); |
||||
Heck::init(); |
|
||||
Heck::mainloop(); |
|
||||
return 0; |
return 0; |
||||
} |
} |
||||
|
Loading…
Reference in new issue