fix i2s audio

This commit is contained in:
gemu2015 2021-02-04 10:42:05 +01:00
parent 62c95122f2
commit 12954aea68
2 changed files with 3 additions and 5 deletions

View File

@ -197,8 +197,8 @@ bool AudioOutputI2S::ConsumeSample(int16_t sample[2])
// Deprecated. Use i2s_write
// return i2s_write_bytes((i2s_port_t)portNo, (const char*)&s32, sizeof(uint32_t), 0);
size_t bytes_written;
return (ESP_OK == i2s_write((i2s_port_t)portNo, (const char*)&s32, sizeof(uint32_t), &bytes_written, 0));
// return bytes_written;
i2s_write((i2s_port_t)portNo, (const char*)&s32, sizeof(uint32_t), &bytes_written, 0);
return bytes_written;
#else
uint32_t s32 = ((Amplify(ms[RIGHTCHANNEL]))<<16) | (Amplify(ms[LEFTCHANNEL]) & 0xffff);
return i2s_write_sample_nb(s32); // If we can't store it, return false. OTW true
@ -225,5 +225,3 @@ bool AudioOutputI2S::stop()
#endif
return true;
}

View File

@ -99,7 +99,7 @@ bool AudioOutputI2SNoDAC::ConsumeSample(int16_t sample[2])
// Deprecated. Use i2s_write
// if (!i2s_write_bytes((i2s_port_t)portNo, (const char *)dsBuff, sizeof(uint32_t) * (oversample/32), 0))
size_t bytes_written;
if (ESP_OK != i2s_write((i2s_port_t)portNo, (const char *)dsBuff, sizeof(uint32_t) * (oversample/32), &bytes_written, 0))
if (!i2s_write((i2s_port_t)portNo, (const char *)dsBuff, sizeof(uint32_t) * (oversample/32), &bytes_written, 0))
return false;
#else
if (!i2s_write_sample_nb(dsBuff[0])) return false; // No room at the inn