forked from W4D/soundcube-firmware
ringbuffer changes, but still broken with multiple samples
This commit is contained in:
@ -77,7 +77,7 @@ class RingBuffer{
|
|||||||
counter -= 2;
|
counter -= 2;
|
||||||
rp2040.memcpyDMA(target, &buffer[read], 4);
|
rp2040.memcpyDMA(target, &buffer[read], 4);
|
||||||
read += 2;
|
read += 2;
|
||||||
if(read == bufferSize) read = 0;
|
if(read >= bufferSize) read = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -760,7 +760,7 @@ void loop(){
|
|||||||
// if(cnt == 16) cnt = 0;
|
// if(cnt == 16) cnt = 0;
|
||||||
if(streams_loaded) {
|
if(streams_loaded) {
|
||||||
for(int i = 0; i < NSTREAMS; i++){
|
for(int i = 0; i < NSTREAMS; i++){
|
||||||
stream[i].streamChunk();
|
stream[i].stream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// int16_t sample_l = 0;
|
// int16_t sample_l = 0;
|
||||||
|
|||||||
@ -109,8 +109,9 @@ struct WaveFile{
|
|||||||
bool readblockDMA128(){
|
bool readblockDMA128(){
|
||||||
void *bufferStart = buffer.getWritePointer();
|
void *bufferStart = buffer.getWritePointer();
|
||||||
|
|
||||||
file.read((uint8_t*)bufferStart, 128);
|
int adv = 128;
|
||||||
buffer.advance(128);
|
adv = file.read((uint8_t*)bufferStart, 128);
|
||||||
|
buffer.advance(adv);
|
||||||
|
|
||||||
if(!file.available() && loop) file.seek(44, SeekSet);
|
if(!file.available() && loop) file.seek(44, SeekSet);
|
||||||
if(!file.available() && !loop) {
|
if(!file.available() && !loop) {
|
||||||
@ -173,7 +174,7 @@ class WaveStream{
|
|||||||
|
|
||||||
void stream(){
|
void stream(){
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
while (!wavefile.buffer.isFull() && cnt < 128 && playing) {
|
while (!wavefile.buffer.isFull() && cnt < 128) {
|
||||||
bool ok = wavefile.readblockDMA();
|
bool ok = wavefile.readblockDMA();
|
||||||
if(!ok) playing = false;
|
if(!ok) playing = false;
|
||||||
cnt += 2;
|
cnt += 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user