This commit is contained in:
e2002
2022-10-14 11:00:49 +03:00
parent dbe0f32e14
commit 1c4b1dec6e
94 changed files with 5320 additions and 6613 deletions

51
yoRadio/src/core/player.h Normal file
View File

@@ -0,0 +1,51 @@
#ifndef player_h
#define player_h
#include "options.h"
#if I2S_DOUT!=255 || I2S_INTERNAL
#include "../audioI2S/AudioEx.h"
#else
#include "../audioVS1053/audioVS1053Ex.h"
#endif
enum audioMode_e { PLAYING, STOPPED };
struct audiorequest_t
{
uint16_t station;
int volume;
bool doSave;
};
class Player: public Audio {
private:
uint32_t volTicks; /* delayed volume save */
bool volTimer; /* delayed volume save */
public:
audioMode_e mode;
audiorequest_t request;
bool requestToStart;
void zeroRequest();
SemaphoreHandle_t playmutex=NULL;
public:
Player();
void init();
void loop();
void play(uint16_t stationId);
void stop(const char *nttl = NULL);
void prev();
void next();
void toggle();
void stepVol(bool up);
void setVol(byte volume, bool inside);
byte volToI2S(byte volume);
void stopInfo();
void setOutputPins(bool isPlaying);
};
extern Player player;
extern __attribute__((weak)) void player_on_start_play();
extern __attribute__((weak)) void player_on_stop_play();
extern __attribute__((weak)) void player_on_track_change();
extern __attribute__((weak)) void player_on_station_change();
#endif