The first problem is that you've got two definitions of setup()
Code:
void setup() {
// put your setup code here, to run once:
//six more lines from magazine
void setup() {
You've also got two loop functions, the Audio library declarations are in the wrong place, plus a few other errors.
I've fixed it up so that it should compile now:
Code:
//firt three lines from magazine
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioPlayMemory playMem3; //xy=269,225
AudioPlayMemory playMem1; //xy=289,373
AudioPlayMemory playMem2; //xy=293,297
AudioMixer4 mixer1; //xy=742,272
AudioOutputI2S Audio_Board_Output; //xy=1031,274
AudioConnection patchCord1(playMem3, 0, mixer1, 0);
AudioConnection patchCord2(playMem1, 0, mixer1, 3);
AudioConnection patchCord3(playMem2, 0, mixer1, 1);
AudioConnection patchCord4(mixer1, 0, Audio_Board_Output, 0);
AudioConnection patchCord5(mixer1, 0, Audio_Board_Output, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=591,435
// GUItool: end automatically generated code
#include "AudioSampleKick.h"
boolean previousKickButtonStatus = false;
unsigned long previousKickTime = 0;
//six more lines from magazine
void setup()
{
AudioMemory(10);
sgtl5000_1.enable();
sgtl5000_1.volume(0.5);
pinMode(2, INPUT_PULLUP);
}
void loop()
{
boolean newKickButtonStatus = !digitalRead(2);
if(newKickButtonStatus !=
previousKickButtonStatus && millis() >
previousKickTime + 30) {
if(newKickButtonStatus) playMem1.play(AudioSampleKick);
previousKickButtonStatus = newKickButtonStatus;
previousKickTime = millis();
}
}
Pete