45 lines
1.6 KiB
C++
45 lines
1.6 KiB
C++
//**********************************************************************************************************
|
|
//* audioI2S-- I2S audiodecoder for ESP32, internal DAC example *
|
|
//**********************************************************************************************************
|
|
//
|
|
// Sep.09/2022
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS" FOR PRIVATE USE ONLY, IT IS NOT FOR COMMERCIAL USE IN WHOLE OR PART OR CONCEPT.
|
|
// FOR PERSONAL USE IT IS SUPPLIED WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR
|
|
// OR COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
|
|
//
|
|
|
|
#include "Arduino.h"
|
|
#include "WiFiMulti.h"
|
|
#include "Audio.h"
|
|
|
|
Audio audio(true, I2S_DAC_CHANNEL_BOTH_EN);
|
|
WiFiMulti wifiMulti;
|
|
String ssid = "xxxxx";
|
|
String password = "xxxxx";
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
WiFi.mode(WIFI_STA);
|
|
wifiMulti.addAP(ssid.c_str(), password.c_str());
|
|
wifiMulti.run();
|
|
if(WiFi.status() != WL_CONNECTED){
|
|
WiFi.disconnect(true);
|
|
wifiMulti.run();
|
|
}
|
|
audio.setVolume(12); // 0...21
|
|
|
|
audio.connecttohost("http://mp3.ffh.de/radioffh/hqlivestream.mp3"); // 128k mp3
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
audio.loop();
|
|
}
|
|
|
|
void audio_info(const char *info){
|
|
Serial.print("info "); Serial.println(info);
|
|
}
|