|
@@ -25,18 +25,37 @@
|
|
|
*
|
|
|
* SdWav3 : sample ambiance -> mix2 -> Rout & RMS2
|
|
|
*/
|
|
|
+//// GUItool: begin automatically generated code
|
|
|
+//AudioPlaySdWav LoopPlayer; //xy=152,429 LOOP
|
|
|
+//AudioPlaySdWav PresencePlayer; //xy=153,217 PRESENCE
|
|
|
+//AudioPlaySdWav WaitPlayer; //xy=155,307 WAIT
|
|
|
+//AudioMixer4 mixer1; //xy=572,215
|
|
|
+//AudioMixer4 mixer2; //xy=579,344
|
|
|
+//AudioAnalyzeRMS rms1; //xy=875,315
|
|
|
+//AudioOutputI2S i2s1; //xy=876,225
|
|
|
+//AudioAnalyzeRMS rms2; //xy=876,365
|
|
|
+//AudioConnection patchCord1(LoopPlayer, 0, mixer2, 0);
|
|
|
+//AudioConnection patchCord2(PresencePlayer, 0, mixer1, 0);
|
|
|
+//AudioConnection patchCord3(WaitPlayer, 0, mixer1, 1);
|
|
|
+//AudioConnection patchCord4(mixer1, 0, i2s1, 0);
|
|
|
+//AudioConnection patchCord5(mixer1, rms1);
|
|
|
+//AudioConnection patchCord6(mixer2, 0, i2s1, 1);
|
|
|
+//AudioConnection patchCord7(mixer2, rms2);
|
|
|
+//AudioControlSGTL5000 sgtl5000_1; //xy=573,537
|
|
|
+//// GUItool: end automatically generated code
|
|
|
+
|
|
|
+
|
|
|
// GUItool: begin automatically generated code
|
|
|
-AudioPlaySdWav LoopPlayer; //xy=152,429 LOOP
|
|
|
-AudioPlaySdWav PresencePlayer; //xy=153,217 PRESENCE
|
|
|
-AudioPlaySdWav WaitPlayer; //xy=155,307 WAIT
|
|
|
+AudioPlaySdWav LoopPlayer; //xy=153,217
|
|
|
+AudioPlaySdWav PresencePlayer; //xy=155,307
|
|
|
AudioMixer4 mixer1; //xy=572,215
|
|
|
AudioMixer4 mixer2; //xy=579,344
|
|
|
AudioAnalyzeRMS rms1; //xy=875,315
|
|
|
AudioOutputI2S i2s1; //xy=876,225
|
|
|
AudioAnalyzeRMS rms2; //xy=876,365
|
|
|
-AudioConnection patchCord1(LoopPlayer, 0, mixer2, 0);
|
|
|
-AudioConnection patchCord2(PresencePlayer, 0, mixer1, 0);
|
|
|
-AudioConnection patchCord3(WaitPlayer, 0, mixer1, 1);
|
|
|
+AudioConnection patchCord1(PresencePlayer, 0, mixer1, 0);
|
|
|
+AudioConnection patchCord2(LoopPlayer, 0, mixer1, 1);
|
|
|
+AudioConnection patchCord3(LoopPlayer, 1, mixer2, 0);
|
|
|
AudioConnection patchCord4(mixer1, 0, i2s1, 0);
|
|
|
AudioConnection patchCord5(mixer1, rms1);
|
|
|
AudioConnection patchCord6(mixer2, 0, i2s1, 1);
|
|
@@ -52,7 +71,7 @@ Metro checkUDP = Metro(1000);
|
|
|
Metro checkESPserial = Metro(50);
|
|
|
Metro sendRMS = Metro(50);
|
|
|
|
|
|
-#define LOOP_WAV "LOOP.WAV"
|
|
|
+#define LOOP_WAV "LOOP2.WAV"
|
|
|
#define PRESENCE_WAV "PRESENCE.WAV"
|
|
|
#define WAIT_WAV "WAIT.WAV"
|
|
|
|
|
@@ -128,7 +147,7 @@ void setup() {
|
|
|
configFile.close();
|
|
|
Serial.println("Playing LOOP and WAIT file");
|
|
|
LoopPlayer.play(LOOP_WAV);
|
|
|
- WaitPlayer.play(WAIT_WAV);
|
|
|
+ //WaitPlayer.play(WAIT_WAV);
|
|
|
|
|
|
// A brief delay for the library read WAV info
|
|
|
delay(10);
|
|
@@ -260,8 +279,8 @@ void loop() {
|
|
|
// A brief delay for the library read WAV info
|
|
|
delay(10);
|
|
|
// also restarts WAIT file
|
|
|
- WaitPlayer.play(WAIT_WAV);
|
|
|
- delay(10);
|
|
|
+// WaitPlayer.play(WAIT_WAV);
|
|
|
+// delay(10);
|
|
|
}
|
|
|
if (presence) {
|
|
|
LastPresence = millis() ;
|
|
@@ -269,12 +288,12 @@ void loop() {
|
|
|
PresencePlayer.play(PRESENCE_WAV);
|
|
|
delay(10);
|
|
|
}
|
|
|
- if ( (millis() - LastPresence > WAIT_TIME) && !WaitPlayer.isPlaying() && !PresencePlayer.isPlaying()) {
|
|
|
-
|
|
|
- mixer1.gain (1, 1.0);
|
|
|
- Serial.println("Fading up wait file");
|
|
|
- delay(10);
|
|
|
- }
|
|
|
+// if ( (millis() - LastPresence > WAIT_TIME) && !WaitPlayer.isPlaying() && !PresencePlayer.isPlaying()) {
|
|
|
+//
|
|
|
+// mixer1.gain (1, 1.0);
|
|
|
+// Serial.println("Fading up wait file");
|
|
|
+// delay(10);
|
|
|
+// }
|
|
|
|
|
|
|
|
|
}
|
|
@@ -323,7 +342,7 @@ void Presence() {
|
|
|
|
|
|
if (!PresencePlayer.isPlaying()) {
|
|
|
//stop WAIT_WAV if playing
|
|
|
- if (WaitPlayer.isPlaying()) {
|
|
|
+ if (1){//WaitPlayer.isPlaying()) {
|
|
|
//fade out WaitPlayer
|
|
|
Serial.println("Fade out Wait file");
|
|
|
for (float fadeRamp ; fadeRamp < 100 ; fadeRamp++ ) {
|