sd_i2s+sd_vs_v4
This commit is contained in:
@@ -10,11 +10,12 @@
|
|||||||
<title>ёRadio - Player</title>
|
<title>ёRadio - Player</title>
|
||||||
<style> </style>
|
<style> </style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="%MODE%">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="logo"></div>
|
<div class="logo"></div>
|
||||||
<div id="navbar">
|
<div id="navbar">
|
||||||
<div class="playerbytton navbutton" id="playlistbutton" data-name="playlist"></div>
|
<div class="playerbytton navbutton" id="playlistbutton" data-name="playlist"></div>
|
||||||
|
<div class="playerbytton navbutton" id="sdbutton" data-name="sdcard"></div>
|
||||||
<div class="playerbytton navbutton" id="settingsbutton" data-name="settings"></div>
|
<div class="playerbytton navbutton" id="settingsbutton" data-name="settings"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="playerwrap">
|
<div class="playerwrap">
|
||||||
@@ -55,7 +56,17 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="volnav">
|
||||||
<input type="range" id="volrange" class="slider" name="volume" data-slaveid="volinfo" min="0" max="254" value="0">
|
<input type="range" id="volrange" class="slider" name="volume" data-slaveid="volinfo" min="0" max="254" value="0">
|
||||||
|
</div>
|
||||||
|
<div id="sdnav" class="hidden">
|
||||||
|
<div id="sdposvals">
|
||||||
|
<div id="sdposvalscurrent">0:00</div>
|
||||||
|
<div id="snuffle" class="playerbytton active" data-name="snuffle"></div>
|
||||||
|
<div id="sdposvalsend">0:00</div>
|
||||||
|
</div>
|
||||||
|
<input type="range" id="sdpos" class="slider" name="sdpos" min="0" max="254" value="0">
|
||||||
|
</div>
|
||||||
<div class="infowrap">
|
<div class="infowrap">
|
||||||
<div class="infoitem">volume: <span id="volinfo">0</span></div>
|
<div class="infoitem">volume: <span id="volinfo">0</span></div>
|
||||||
<div class="infoitem" id="bitinfo">bitrate: 0kBit</div>
|
<div class="infoitem" id="bitinfo">bitrate: 0kBit</div>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -2464,7 +2464,7 @@ uint32_t Audio::getFilePos(){
|
|||||||
bool Audio::setFilePos(uint32_t pos){
|
bool Audio::setFilePos(uint32_t pos){
|
||||||
if (!audiofile) return false;
|
if (!audiofile) return false;
|
||||||
cardLock(true);
|
cardLock(true);
|
||||||
uint32_t s = audiofile.seek(pos);
|
bool s = audiofile.seek(pos);
|
||||||
cardLock(false);
|
cardLock(false);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -413,6 +413,13 @@ void NetServer::onWsMessage(void *arg, uint8_t *data, size_t len, uint8_t client
|
|||||||
byte v = atoi(val);
|
byte v = atoi(val);
|
||||||
player.setVol(v, false);
|
player.setVol(v, false);
|
||||||
}
|
}
|
||||||
|
if (strcmp(cmd, "sdpos") == 0) {
|
||||||
|
if (config.store.play_mode==PM_SDCARD){
|
||||||
|
//byte v = atoi(val);
|
||||||
|
player.play(config.store.lastStation, atoi(val));
|
||||||
|
//Serial.printf("player.setFilePos(%d)\t******************************************\n", v);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (strcmp(cmd, "balance") == 0) {
|
if (strcmp(cmd, "balance") == 0) {
|
||||||
int8_t valb = atoi(val);
|
int8_t valb = atoi(val);
|
||||||
player.setBalance(valb);
|
player.setBalance(valb);
|
||||||
@@ -587,6 +594,7 @@ void NetServer::requestOnChange(requestType_e request, uint8_t clientId) {
|
|||||||
case TITLE: sprintf (buf, "{\"meta\": \"%s\"}", config.station.title); if (player.requestToStart) { telnet.info(); player.requestToStart = false; } else { telnet.printf("##CLI.META#: %s\n> ", config.station.title); } break;
|
case TITLE: sprintf (buf, "{\"meta\": \"%s\"}", config.station.title); if (player.requestToStart) { telnet.info(); player.requestToStart = false; } else { telnet.printf("##CLI.META#: %s\n> ", config.station.title); } break;
|
||||||
case VOLUME: sprintf (buf, "{\"vol\": %d}", config.store.volume); break;
|
case VOLUME: sprintf (buf, "{\"vol\": %d}", config.store.volume); break;
|
||||||
case NRSSI: sprintf (buf, "{\"rssi\": %d}", rssi); rssi = 255; break;
|
case NRSSI: sprintf (buf, "{\"rssi\": %d}", rssi); rssi = 255; break;
|
||||||
|
case SDPOS: sprintf (buf, "{\"sdpos\": %d,\"sdend\": %d,\"sdtpos\": %d,\"sdtend\": %d}", player.getFilePos(), player.getFileSize(), 0, 0); break;
|
||||||
case BITRATE: sprintf (buf, "{\"bitrate\": %d}", config.station.bitrate); break;
|
case BITRATE: sprintf (buf, "{\"bitrate\": %d}", config.station.bitrate); break;
|
||||||
case MODE: sprintf (buf, "{\"mode\": \"%s\"}", player.mode == PLAYING ? "playing" : "stopped"); break;
|
case MODE: sprintf (buf, "{\"mode\": \"%s\"}", player.mode == PLAYING ? "playing" : "stopped"); break;
|
||||||
case EQUALIZER: sprintf (buf, "{\"bass\": %d, \"middle\": %d, \"trebble\": %d}", config.store.bass, config.store.middle, config.store.trebble); break;
|
case EQUALIZER: sprintf (buf, "{\"bass\": %d, \"middle\": %d, \"trebble\": %d}", config.store.bass, config.store.middle, config.store.trebble); break;
|
||||||
@@ -603,6 +611,13 @@ void NetServer::requestOnChange(requestType_e request, uint8_t clientId) {
|
|||||||
|
|
||||||
String processor(const String& var) { // %Templates%
|
String processor(const String& var) { // %Templates%
|
||||||
if (var == "VERSION") return YOVERSION;
|
if (var == "VERSION") return YOVERSION;
|
||||||
|
if (var == "MODE") {
|
||||||
|
if(config.store.play_mode==PM_SDCARD) {
|
||||||
|
return "modescard";
|
||||||
|
}else{
|
||||||
|
return "modeweb";
|
||||||
|
}
|
||||||
|
}
|
||||||
return String();
|
return String();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include "ESPAsyncWebServer.h"
|
#include "ESPAsyncWebServer.h"
|
||||||
#include "AsyncUDP.h"
|
#include "AsyncUDP.h"
|
||||||
|
|
||||||
enum requestType_e : uint8_t { PLAYLIST=1, STATION=2, ITEM=3, TITLE=4, VOLUME=5, NRSSI=6, BITRATE=7, MODE=8, EQUALIZER=9, BALANCE=10, PLAYLISTSAVED=11, GETMODE=12, GETINDEX=13, GETACTIVE=14, GETSYSTEM=15, GETSCREEN=16, GETTIMEZONE=17, GETWEATHER=18, GETCONTROLS=19, DSPON=20 };
|
enum requestType_e : uint8_t { PLAYLIST=1, STATION=2, ITEM=3, TITLE=4, VOLUME=5, NRSSI=6, BITRATE=7, MODE=8, EQUALIZER=9, BALANCE=10, PLAYLISTSAVED=11, GETMODE=12, GETINDEX=13, GETACTIVE=14, GETSYSTEM=15, GETSCREEN=16, GETTIMEZONE=17, GETWEATHER=18, GETCONTROLS=19, DSPON=20, SDPOS=21 };
|
||||||
enum import_e : uint8_t { IMDONE=0, IMPL=1, IMWIFI=2 };
|
enum import_e : uint8_t { IMDONE=0, IMPL=1, IMWIFI=2 };
|
||||||
|
|
||||||
class NetServer {
|
class NetServer {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "telnet.h"
|
#include "telnet.h"
|
||||||
#include "netserver.h"
|
#include "netserver.h"
|
||||||
|
#include "player.h"
|
||||||
|
|
||||||
Network network;
|
Network network;
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ void ticks() {
|
|||||||
mktime(&network.timeinfo);
|
mktime(&network.timeinfo);
|
||||||
display.putRequest(CLOCK);
|
display.putRequest(CLOCK);
|
||||||
}
|
}
|
||||||
|
if(player.isRunning() && config.store.play_mode==PM_SDCARD) netserver.requestOnChange(SDPOS, 0);
|
||||||
if(divrssi) {
|
if(divrssi) {
|
||||||
int rs = WiFi.RSSI();
|
int rs = WiFi.RSSI();
|
||||||
netserver.setRSSI(rs);
|
netserver.setRSSI(rs);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef options_h
|
#ifndef options_h
|
||||||
#define options_h
|
#define options_h
|
||||||
|
|
||||||
#define YOVERSION "0.8.813"
|
#define YOVERSION "0.8.816"
|
||||||
|
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
DO NOT EDIT THIS FILE.
|
DO NOT EDIT THIS FILE.
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ void Player::setOutputPins(bool isPlaying) {
|
|||||||
if(MUTE_PIN!=255) digitalWrite(MUTE_PIN, isPlaying?!MUTE_VAL:MUTE_VAL);
|
if(MUTE_PIN!=255) digitalWrite(MUTE_PIN, isPlaying?!MUTE_VAL:MUTE_VAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::play(uint16_t stationId) {
|
void Player::play(uint16_t stationId, uint32_t filePos) {
|
||||||
display.putRequest(PSTOP);
|
display.putRequest(PSTOP);
|
||||||
setDefaults();
|
setDefaults();
|
||||||
setOutputPins(false);
|
setOutputPins(false);
|
||||||
@@ -136,7 +136,7 @@ void Player::play(uint16_t stationId) {
|
|||||||
display.putRequest(NEWSTATION);
|
display.putRequest(NEWSTATION);
|
||||||
netserver.requestOnChange(STATION, 0);
|
netserver.requestOnChange(STATION, 0);
|
||||||
telnet.printf("##CLI.NAMESET#: %d %s\n", config.store.lastStation, config.station.name);
|
telnet.printf("##CLI.NAMESET#: %d %s\n", config.store.lastStation, config.station.name);
|
||||||
if (config.store.play_mode==PM_WEB?connecttohost(config.station.url):connecttoFS(SD,config.station.url)) {
|
if (config.store.play_mode==PM_WEB?connecttohost(config.station.url):connecttoFS(SD,config.station.url,filePos)) {
|
||||||
mode = PLAYING;
|
mode = PLAYING;
|
||||||
config.setTitle("");
|
config.setTitle("");
|
||||||
netserver.requestOnChange(TITLE, 0);
|
netserver.requestOnChange(TITLE, 0);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class Player: public Audio {
|
|||||||
Player();
|
Player();
|
||||||
void init();
|
void init();
|
||||||
void loop();
|
void loop();
|
||||||
void play(uint16_t stationId);
|
void play(uint16_t stationId, uint32_t filePos=0);
|
||||||
void stop(const char *nttl = NULL);
|
void stop(const char *nttl = NULL);
|
||||||
void prev();
|
void prev();
|
||||||
void next();
|
void next();
|
||||||
|
|||||||
Reference in New Issue
Block a user