got it working, just a small bug left
This commit is contained in:
parent
4ade3a5f00
commit
f3a619decc
7 changed files with 356 additions and 178 deletions
|
@ -7,7 +7,7 @@
|
|||
using namespace daisy;
|
||||
using namespace daisysp;
|
||||
|
||||
#define DMA_AREA_SIZE (3*(1 << 16))
|
||||
#define DMA_AREA_SIZE (1 << 12)
|
||||
#define SCOPE_RING_BUF_SIZE 1024
|
||||
#define AUDIO_BLOCK_SIZE 2
|
||||
|
||||
|
@ -32,14 +32,14 @@ Switch kick, snare;
|
|||
|
||||
RingBuffer<float, SCOPE_RING_BUF_SIZE> scope_in;
|
||||
|
||||
static void
|
||||
void
|
||||
audio_cb(AudioHandle::InputBuffer in,
|
||||
AudioHandle::OutputBuffer out, size_t sz)
|
||||
{
|
||||
float osc_out, noise_out, snr_env_out, kck_env_out;
|
||||
float sig[AUDIO_BLOCK_SIZE];
|
||||
|
||||
load_meter.OnBlockStart();
|
||||
// load_meter.OnBlockStart();
|
||||
//Get rid of any bouncing
|
||||
snare.Debounce();
|
||||
kick.Debounce();
|
||||
|
@ -81,15 +81,15 @@ audio_cb(AudioHandle::InputBuffer in,
|
|||
sig[i] = .5 * noise_out + .5 * osc_out;
|
||||
}
|
||||
|
||||
/* write to output */
|
||||
for (size_t i = 0; i < sz; i++) {
|
||||
out[0][i] = sig[i];
|
||||
out[1][i] = sig[i];
|
||||
|
||||
}
|
||||
|
||||
scope_in.Overwrite(sig, sz);
|
||||
|
||||
load_meter.OnBlockEnd();
|
||||
// load_meter.OnBlockEnd();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -137,20 +137,20 @@ setup_drums(void)
|
|||
}
|
||||
|
||||
|
||||
#define LOAD_METER_TICKS (1 << 16)
|
||||
#define LOAD_METER_TICKS (1 << 20)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
size_t read;
|
||||
float s[AUDIO_BLOCK_SIZE];
|
||||
int load_tick;
|
||||
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;
|
||||
//load_meter.Init(daisy_hw.AudioSampleRate(), daisy_hw.AudioBlockSize());
|
||||
//load_tick = LOAD_METER_TICKS;
|
||||
|
||||
if (scope.init(dma_area, sizeof(dma_area)) == -1)
|
||||
daisy_hw.PrintLine("scope.init failed");
|
||||
|
@ -175,6 +175,9 @@ main(void)
|
|||
case osclsk_scope::osc_state::SAMPLE_DONE:
|
||||
scope.render_block();
|
||||
break;
|
||||
case osclsk_scope::osc_state::RENDER:
|
||||
scope.render_block();
|
||||
break;
|
||||
case osclsk_scope::osc_state::RENDER_DONE:
|
||||
scope.prep();
|
||||
break;
|
||||
|
@ -185,18 +188,18 @@ main(void)
|
|||
break;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
// 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));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue