forked from W4D/soundcube-firmware
Compare commits
1 Commits
sampler
...
sampler-si
| Author | SHA1 | Date | |
|---|---|---|---|
| 962c299e80 |
@ -23,7 +23,7 @@ bool core1_disable_systick = true;
|
|||||||
#define UI_SAMPLERATE 22050
|
#define UI_SAMPLERATE 22050
|
||||||
|
|
||||||
#define BUFFERSIZE 256
|
#define BUFFERSIZE 256
|
||||||
#define NSTREAMS 16
|
#define NSTREAMS 4
|
||||||
|
|
||||||
I2S i2s(INPUT_PULLUP);
|
I2S i2s(INPUT_PULLUP);
|
||||||
|
|
||||||
@ -266,7 +266,11 @@ bool load_samples(){
|
|||||||
for(int i = 0; i < NSTREAMS; i++){
|
for(int i = 0; i < NSTREAMS; i++){
|
||||||
stream[i].begin();
|
stream[i].begin();
|
||||||
char filename[64];
|
char filename[64];
|
||||||
sprintf(filename, "/sound/%s/%s", config.boxid.c_str(), config.sampleFiles[i].c_str());
|
sprintf(filename, "/sound/%s/%s.wav", config.boxid.c_str(), config.boxid.c_str());
|
||||||
|
|
||||||
|
char cuelist_filename[64];
|
||||||
|
sprintf(cuelist_filename, "/sound/%s/%s.cue", config.boxid.c_str(), config.boxid.c_str());
|
||||||
|
|
||||||
Serial.println(filename);
|
Serial.println(filename);
|
||||||
|
|
||||||
if(SD.exists(filename)){
|
if(SD.exists(filename)){
|
||||||
@ -283,10 +287,30 @@ bool load_samples(){
|
|||||||
Serial.print(" channels | ");
|
Serial.print(" channels | ");
|
||||||
Serial.print(stream[i].wavefile.blockalign);
|
Serial.print(stream[i].wavefile.blockalign);
|
||||||
Serial.println(" bytes");
|
Serial.println(" bytes");
|
||||||
//stream[i].wavefile.loop = true;
|
|
||||||
} else {
|
} else {
|
||||||
Serial.println("file loading error");
|
Serial.println("file loading error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(SD.exists(cuelist_filename)){
|
||||||
|
uint32_t cues[16];
|
||||||
|
char tempcues[4];
|
||||||
|
File cuelist = SD.open(cuelist_filename);
|
||||||
|
int i = 0;
|
||||||
|
int k = 0;
|
||||||
|
while(cuelist.available()){
|
||||||
|
tempcues[i] = cuelist.read();
|
||||||
|
if(c == "\n" || c == "\r"){
|
||||||
|
memcpy(stream.cuelist[k], tempcues[0], 4);
|
||||||
|
for(int j = 0; j < 4; j++){
|
||||||
|
tempcues[j] = 0;
|
||||||
|
}
|
||||||
|
i = 0;
|
||||||
|
k++;
|
||||||
|
} else {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for(int k = 0; k < 3; k++){
|
for(int k = 0; k < 3; k++){
|
||||||
digitalWrite(6, HIGH);
|
digitalWrite(6, HIGH);
|
||||||
|
|||||||
@ -214,6 +214,7 @@ class WaveStream{
|
|||||||
//private:
|
//private:
|
||||||
|
|
||||||
WaveFile wavefile;
|
WaveFile wavefile;
|
||||||
|
uint32_t cuelist[16];
|
||||||
|
|
||||||
bool playing = false;
|
bool playing = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user