#include <SPI.h> | #include <SPI.h> | ||||
#include <Bounce.h> | #include <Bounce.h> | ||||
AudioToneSweep myEffect; | |||||
AudioSynthToneSweep myEffect; | |||||
AudioOutputI2S audioOutput; // audio shield: headphones & line-out | AudioOutputI2S audioOutput; // audio shield: headphones & line-out | ||||
// The tone sweep goes to left and right channels | // The tone sweep goes to left and right channels | ||||
Serial.println("setup done"); | Serial.println("setup done"); | ||||
if(!myEffect.begin(t_ampx,t_lox,t_hix,t_timex)) { | if(!myEffect.begin(t_ampx,t_lox,t_hix,t_timex)) { | ||||
Serial.println("AudioToneSweep - begin failed"); | |||||
Serial.println("AudioSynthToneSweep - begin failed"); | |||||
while(1); | while(1); | ||||
} | } | ||||
// wait for the sweep to end | // wait for the sweep to end | ||||
// and now reverse the sweep | // and now reverse the sweep | ||||
if(!myEffect.begin(t_ampx,t_hix,t_lox,t_timex)) { | if(!myEffect.begin(t_ampx,t_hix,t_lox,t_timex)) { | ||||
Serial.println("AudioToneSweep - begin failed"); | |||||
Serial.println("AudioSynthToneSweep - begin failed"); | |||||
while(1); | while(1); | ||||
} | } | ||||
// wait for the sweep to end | // wait for the sweep to end |
// Written by Pete (El Supremo) Feb 2014 | // Written by Pete (El Supremo) Feb 2014 | ||||
boolean AudioToneSweep::begin(short t_amp,int t_lo,int t_hi,float t_time) | |||||
boolean AudioSynthToneSweep::begin(short t_amp,int t_lo,int t_hi,float t_time) | |||||
{ | { | ||||
double tone_tmp; | double tone_tmp; | ||||
if(0) { | if(0) { | ||||
Serial.print("AudioToneSweep.begin(tone_amp = "); | |||||
Serial.print("AudioSynthToneSweep.begin(tone_amp = "); | |||||
Serial.print(t_amp); | Serial.print(t_amp); | ||||
Serial.print(", tone_lo = "); | Serial.print(", tone_lo = "); | ||||
Serial.print(t_lo); | Serial.print(t_lo); | ||||
unsigned char AudioToneSweep::busy(void) | |||||
unsigned char AudioSynthToneSweep::busy(void) | |||||
{ | { | ||||
return(sweep_busy); | return(sweep_busy); | ||||
} | } | ||||
int b_count = 0; | |||||
void AudioToneSweep::update(void) | |||||
static int b_count = 0; // TODO: what's this for? | |||||
void AudioSynthToneSweep::update(void) | |||||
{ | { | ||||
audio_block_t *block; | audio_block_t *block; | ||||
short *bp; | short *bp; |
// A u d i o T o n e S w e e p | // A u d i o T o n e S w e e p | ||||
// Written by Pete (El Supremo) Feb 2014 | // Written by Pete (El Supremo) Feb 2014 | ||||
class AudioToneSweep : public AudioStream | |||||
class AudioSynthToneSweep : public AudioStream | |||||
{ | { | ||||
public: | public: | ||||
AudioToneSweep(void) : | |||||
AudioSynthToneSweep(void) : | |||||
AudioStream(0,NULL), sweep_busy(0) | AudioStream(0,NULL), sweep_busy(0) | ||||
{ } | { } | ||||