diff --git a/soundcube-firmware/soundcube-firmware.ino b/soundcube-firmware/soundcube-firmware.ino index 8989fdd..be87985 100644 --- a/soundcube-firmware/soundcube-firmware.ino +++ b/soundcube-firmware/soundcube-firmware.ino @@ -23,7 +23,7 @@ bool core1_disable_systick = true; #define UI_SAMPLERATE 22050 #define BUFFERSIZE 256 -#define NSTREAMS 16 +#define NSTREAMS 4 I2S i2s(INPUT_PULLUP); @@ -266,7 +266,11 @@ bool load_samples(){ for(int i = 0; i < NSTREAMS; i++){ stream[i].begin(); 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); if(SD.exists(filename)){ @@ -283,10 +287,30 @@ bool load_samples(){ Serial.print(" channels | "); Serial.print(stream[i].wavefile.blockalign); Serial.println(" bytes"); - //stream[i].wavefile.loop = true; } else { 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 { for(int k = 0; k < 3; k++){ digitalWrite(6, HIGH); diff --git a/soundcube-firmware/wavestream.h b/soundcube-firmware/wavestream.h index 3787f17..e7ffe10 100644 --- a/soundcube-firmware/wavestream.h +++ b/soundcube-firmware/wavestream.h @@ -214,6 +214,7 @@ class WaveStream{ //private: WaveFile wavefile; + uint32_t cuelist[16]; bool playing = false;