6 Commits
4 changed files with 17 additions and 10 deletions

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@
"type": "git",
"url": "https://github.com/earlephilhower/ESP8266Audio"
},
"version": "1.9.1",
"version": "1.9.3",
"homepage": "https://github.com/earlephilhower/ESP8266Audio",
"frameworks": "Arduino",
"examples": [
+1 -1
View File
@@ -1,5 +1,5 @@
name=ESP8266Audio
version=1.9.1
version=1.9.3
author=Earle F. Philhower, III
maintainer=Earle F. Philhower, III
sentence=Audio file and I2S sound playing routines for ESP8266, ESP32, and Raspberry Pi Pico RP2040
+7 -4
View File
@@ -21,9 +21,7 @@
#include <Arduino.h>
#ifdef ESP32
#include "driver/i2s.h"
#elif defined(ESP8266)
#include <i2s.h>
#elif defined(ARDUINO_ARCH_RP2040)
#elif defined(ARDUINO_ARCH_RP2040) || defined(ESP8266)
#include <I2S.h>
#endif
#include "AudioOutputI2S.h"
@@ -271,7 +269,12 @@ bool AudioOutputI2S::ConsumeSample(int16_t sample[2])
{
s32 = ((Amplify(ms[RIGHTCHANNEL])) << 16) | (Amplify(ms[LEFTCHANNEL]) & 0xffff);
}
return i2s_write_bytes((i2s_port_t)portNo, (const char *)&s32, sizeof(uint32_t), 0);
//"i2s_write_bytes" has been removed in the ESP32 Arduino 2.0.0, use "i2s_write" instead.
// return i2s_write_bytes((i2s_port_t)portNo, (const char *)&s32, sizeof(uint32_t), 0);
size_t i2s_bytes_written;
i2s_write((i2s_port_t)portNo, (const char*)&s32, sizeof(uint32_t), &i2s_bytes_written, 0);
return i2s_bytes_written;
#elif defined(ESP8266)
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
+8 -4
View File
@@ -21,9 +21,7 @@
#include <Arduino.h>
#ifdef ESP32
#include "driver/i2s.h"
#elif defined(ESP8266)
#include <i2s.h>
#elif defined(ARDUINO_ARCH_RP2040)
#elif defined(ARDUINO_ARCH_RP2040) || defined(ESP8266)
#include <I2S.h>
#endif
#include "AudioOutputI2SNoDAC.h"
@@ -97,8 +95,14 @@ bool AudioOutputI2SNoDAC::ConsumeSample(int16_t sample[2])
// Either send complete pulse stream or nothing
#ifdef ESP32
if (!i2s_write_bytes((i2s_port_t)portNo, (const char *)dsBuff, sizeof(uint32_t) * (oversample/32), 0))
//"i2s_write_bytes" has been removed in the ESP32 Arduino 2.0.0, use "i2s_write" instead.
// if (!i2s_write_bytes((i2s_port_t)portNo, (const char *)dsBuff, sizeof(uint32_t) * (oversample/32), 0))
size_t i2s_bytes_written;
i2s_write((i2s_port_t)portNo, (const char *)dsBuff, sizeof(uint32_t) * (oversample/32), &i2s_bytes_written, 0);
if (!i2s_bytes_written){
return false;
}
#elif defined(ESP8266)
if (!i2s_write_sample_nb(dsBuff[0])) return false; // No room at the inn
// At this point we've sent in first of possibly 8 32-bits, need to send