PaulStoffregen 8 роки тому
джерело
коміт
a1975344d0
2 змінених файлів з 77 додано та 0 видалено
  1. +21
    -0
      examples/HardwareTesting/PassThroughUSB/PassThroughUSB.ino
  2. +56
    -0
      examples/HardwareTesting/WavFilePlayerUSB/WavFilePlayerUSB.ino

+ 21
- 0
examples/HardwareTesting/PassThroughUSB/PassThroughUSB.ino Переглянути файл

@@ -0,0 +1,21 @@
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

AudioInputUSB usb1; //xy=200,69
AudioOutputI2S i2s1; //xy=365,94
AudioConnection patchCord1(usb1, 0, i2s1, 0);
AudioConnection patchCord2(usb1, 1, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=302,184

void setup() {
AudioMemory(12);
sgtl5000_1.enable();
sgtl5000_1.volume(0.6);
}

void loop() {
// TODO: make PC's volume setting control the SGTL5000 volume...
}

+ 56
- 0
examples/HardwareTesting/WavFilePlayerUSB/WavFilePlayerUSB.ino Переглянути файл

@@ -0,0 +1,56 @@
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

AudioPlaySdWav playWav1;
AudioOutputUSB audioOutput;
AudioOutputAnalog dac;
AudioConnection patchCord1(playWav1, 0, audioOutput, 0);
AudioConnection patchCord2(playWav1, 1, audioOutput, 1);
AudioConnection patchCord3(playWav1, 0, dac, 0);

// Use these with the audio adaptor board
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14

void setup() {
Serial.begin(9600);

// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(20);

SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
// stop here, but print a message repetitively
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}
}

void playFile(const char *filename)
{
playWav1.play(filename);
// A brief delay for the library read WAV info
delay(5);
// Simply wait for the file to finish playing.
while (playWav1.isPlaying()) {
}
}

void loop() {
playFile("SDTEST1.WAV"); // filenames are always uppercase 8.3 format
delay(500);
playFile("SDTEST2.WAV");
delay(500);
playFile("SDTEST3.WAV");
delay(500);
playFile("SDTEST4.WAV");
delay(1500);
}

Завантаження…
Відмінити
Зберегти