not too much needs to change
first the correct header file needs to be included
so change
#include <AudioCodec_Maple.h>
to
#include <AudioCodec.h>
also since there is only one mod being used
#define ADCS 2
should be
#define ADCS 1
and
AudioCodec_ADC(&mod0_value, &mod1_value);
should be
AudioCodec_ADC(&mod0_value);
and the memory is smaller so
#define BUFFER_SIZE 4096
becomes
#define BUFFER_SIZE 800
and you dont need this
SerialUSB.end();
that takes care of all basic maple vs arduino differences
now the processing speed differences
there is no hardware divide on arduino
so you can not use divide in any of the functions
unless you are dividing by a factor of 2
so the interrupt loop will look something like this
ISR(TIMER1_COMPA_vect, ISR_NAKED) {
AudioCodec_data(&left_in, &right_in, left_out, right_out);
uint temp1 = location + (mod0>>6);
if (temp >= BUFFER_SIZE) {
temp -= BUFFER_SIZE; // reset location
}
int temp2 = buffer[temp1];
buffer[location] = (left_in >> 5) - temp2;
right_out = left_out;
location++; // increment locations
if (location >= BUFFER_SIZE) {
location = 0; // reset location
}
AudioCodec_ADC(&mod0_value);
reti();
}
note the use of ISR instead of AudioCodec_interrupt
and the addition of reti(); at the end to return from the interrupt
i also got rid of the volume adjustment
that can easily be added back in if its not loud enough
and changed the rollover function for BUFER_SIZE
modulo takes forever to run