stuff
This commit is contained in:
parent
67e4b2382b
commit
37bb77bc88
7 changed files with 78 additions and 49 deletions
|
@ -8,13 +8,17 @@ using namespace daisy;
|
|||
using namespace daisysp;
|
||||
|
||||
#define DMA_AREA_SIZE (1 << 12)
|
||||
#define SCOPE_RING_BUF_SIZE 1024
|
||||
#define SCOPE_RING_BUF_SIZE 4096
|
||||
#define AUDIO_BLOCK_SIZE 2
|
||||
|
||||
#define AUDIOC_DEBUG
|
||||
|
||||
/* declarations */
|
||||
DaisySeed daisy_hw;
|
||||
|
||||
#ifdef AUDIOC_DEBUG
|
||||
CpuLoadMeter load_meter;
|
||||
#endif
|
||||
|
||||
osclsk_scope scope;
|
||||
|
||||
|
@ -39,7 +43,9 @@ audio_cb(AudioHandle::InputBuffer in,
|
|||
float osc_out, noise_out, snr_env_out, kck_env_out;
|
||||
float sig[AUDIO_BLOCK_SIZE];
|
||||
|
||||
// load_meter.OnBlockStart();
|
||||
#ifdef AUDIOC_DEBUG
|
||||
load_meter.OnBlockStart();
|
||||
#endif
|
||||
//Get rid of any bouncing
|
||||
snare.Debounce();
|
||||
kick.Debounce();
|
||||
|
@ -89,7 +95,9 @@ audio_cb(AudioHandle::InputBuffer in,
|
|||
|
||||
scope_in.Overwrite(sig, sz);
|
||||
|
||||
// load_meter.OnBlockEnd();
|
||||
#ifdef AUDIOC_DEBUG
|
||||
load_meter.OnBlockEnd();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -143,14 +151,15 @@ main(void)
|
|||
{
|
||||
size_t read;
|
||||
float s[AUDIO_BLOCK_SIZE];
|
||||
uint32_t load_tick;
|
||||
daisy_hw.Configure();
|
||||
daisy_hw.Init();
|
||||
daisy_hw.StartLog(false); /* true = wait for usb connection */
|
||||
daisy_hw.SetAudioBlockSize(AUDIO_BLOCK_SIZE);
|
||||
|
||||
//load_meter.Init(daisy_hw.AudioSampleRate(), daisy_hw.AudioBlockSize());
|
||||
//load_tick = LOAD_METER_TICKS;
|
||||
#ifdef AUDIOC_DEBUG
|
||||
load_meter.Init(daisy_hw.AudioSampleRate(), daisy_hw.AudioBlockSize());
|
||||
uint32_t load_tick = LOAD_METER_TICKS;
|
||||
#endif
|
||||
|
||||
if (scope.init(dma_area, sizeof(dma_area)) == -1)
|
||||
daisy_hw.PrintLine("scope.init failed");
|
||||
|
@ -188,18 +197,20 @@ main(void)
|
|||
scope.sample(s, read);
|
||||
|
||||
|
||||
// if (--load_tick == 0) {
|
||||
// load_tick = LOAD_METER_TICKS;
|
||||
// // get the current load (smoothed value and peak values)
|
||||
// const float avgLoad = load_meter.GetAvgCpuLoad();
|
||||
// const float maxLoad = load_meter.GetMaxCpuLoad();
|
||||
// const float minLoad = load_meter.GetMinCpuLoad();
|
||||
// // print it to the serial connection (as percentages)
|
||||
// daisy_hw.PrintLine("Processing Load %:");
|
||||
// daisy_hw.PrintLine("Max: " FLT_FMT3, FLT_VAR3(maxLoad * 100.0f));
|
||||
// daisy_hw.PrintLine("Avg: " FLT_FMT3, FLT_VAR3(avgLoad * 100.0f));
|
||||
// daisy_hw.PrintLine("Min: " FLT_FMT3, FLT_VAR3(minLoad * 100.0f));
|
||||
// }
|
||||
#ifdef AUDIOC_DEBUG
|
||||
if (--load_tick == 0) {
|
||||
load_tick = LOAD_METER_TICKS;
|
||||
// get the current load (smoothed value and peak values)
|
||||
const float avgLoad = load_meter.GetAvgCpuLoad();
|
||||
const float maxLoad = load_meter.GetMaxCpuLoad();
|
||||
const float minLoad = load_meter.GetMinCpuLoad();
|
||||
// print it to the serial connection (as percentages)
|
||||
daisy_hw.PrintLine("Processing Load %:");
|
||||
daisy_hw.PrintLine("Max: " FLT_FMT3, FLT_VAR3(maxLoad * 100.0f));
|
||||
daisy_hw.PrintLine("Avg: " FLT_FMT3, FLT_VAR3(avgLoad * 100.0f));
|
||||
daisy_hw.PrintLine("Min: " FLT_FMT3, FLT_VAR3(minLoad * 100.0f));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue