Hi all,
I am trying to write some code on the daisypod.
I managed to wrangle the DSP effect “multieffect” examples and build something.
I have some JUCE code which is a nice chorus delay VST plugin I built. I am trying to port it over to the daisy.
I tried declaring a delay buffer(s) on the stack but looks like I ran out of memory so I tried the “heap”. I dont quite know how much memory the daisy pod has. This is a global variable
std::vector <float> mCircularBufferLeft(SR);
The audio callback looks like this :
void AudioCallback(AudioHandle::InterleavingInputBuffer in,
AudioHandle::InterleavingOutputBuffer out,
size_t size)
{
float outl, outr, inl, inr;
Controls();
//audio
for(size_t i = 0; i < size; i += 2)
{
inl = in[i];
inr = in[i + 1];
switch(mode)
{
case CHRDEL: GetReverbSample(outl, outr, inl, inr); break;
case DEL: GetDelaySample(outl, outr, inl, inr); break;
case COR: GetChorusSample(outl, outr, inl, inr); break;
case PHR: GetPhaserSample(outl, outr, inl, inr); break;
case OCT: GetOctaveSample(outl, outr, inl, inr); break;
case WAYLOCHORUS: GetWayloChorusSample(outl, outr, inl, inr); break;\
default: outl = outr = 0;
}
// left out
out[i] = outl;
// right out
out[i + 1] = outr;
}
I attempted to erase the buffer in the main function
int main(void)
{
// initialize pod hardware and oscillator daisysp module
float sample_rate;
float value = 0.0f;
fill(mCircularBufferLeft.begin(), mCircularBufferLeft.end(), value);
I am trying something very simple in the processing function just writing to the buffer and reading back.
void GetWayloChorusSample(float &outl, float &outr, float inl, float inr){
mCircularBufferLeft[mCircularBufferWriteHead] = inl;
mDelayReadHead = mCircularBufferWriteHead - 2000;
if (mDelayReadHead < 0){
mDelayReadHead += SR;
}
// // get the integer part of the read head
// int readHeadX = (int)mDelayReadHead;
// // get the part of the readHead after the decimal point
// float readHeadFloat = mDelayReadHead - readHeadX;
// // next integer sample position
// int readHeadX1 = readHeadX + 1;
//float delay_sample_Left = linInterp(mCircularBufferLeft[readHeadX], mCircularBufferLeft[readHeadX1], readHeadFloat);
float delay_sample_Left = mCircularBufferLeft[mDelayReadHead];
outl = drywet*inl + (1- drywet*delay_sample_Left);
outr = drywet*inr;
mCircularBufferWriteHead ++;
if (mCircularBufferWriteHead == SR){
mCircularBufferWriteHead = 0;
}
}
The code builds but dialing up that effect “case” crashes the machine.
I connected the debugger tool I purchased .
I have vscode and windows.
Pressing F5 it starts up in “debug” mode but crashes like this:
OpenOCD GDB Server Quit Unexpectedly. See gdb-server output for more details.
My launch json looks like this
{
"configurations": [
{
"configFiles": [
"interface/stlink.cfg",
"target/stm32h7x.cfg"
],
"cwd": "${workspaceFolder}",
"debuggerArgs": [
"-d",
"${workspaceRoot}"
],
"executable": "${workspaceRoot}/build/MultiEffect.elf",
"interface": "swd",
"name": "Cortex Debug",
"openOCDLaunchCommands": [
"init",
"reset init"
],
"preLaunchTask": "build_all_debug",
"preRestartCommands": [
"load",
"enable breakpoint",
"monitor reset"
],
"request": "launch",
"runToMain": true,
"servertype": "openocd",
"showDevDebugOutput": "both",
"svdFile": "${workspaceRoot}/.vscode/STM32H750x.svd",
"type": "cortex-debug"
}
],
"version": "0.2.0"
}
I tried editing the “showDevDebugOutput” which seemed to have a boolean true which the editor told me was not allowed .
Not sure what to do .
A longer look at the code and what I eventually want to try is here …
Thanks for your help and replies Sean