mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-08 20:47:08 +03:00
new cspot/bell
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h> // for uint32_t, uint8_t
|
||||
#include <functional> // for function
|
||||
#include <memory> // for shared_ptr, unique_ptr
|
||||
#include <string> // for string
|
||||
#include <variant> // for variant
|
||||
#include <vector> // for vector
|
||||
#include <stdint.h> // for uint32_t, uint8_t
|
||||
#include <functional> // for function
|
||||
#include <memory> // for shared_ptr, unique_ptr
|
||||
#include <string> // for string
|
||||
#include <variant> // for variant
|
||||
#include <vector> // for vector
|
||||
|
||||
#include "CDNTrackStream.h" // for CDNTrackStream, CDNTrackStream::Track...
|
||||
#include "PlaybackState.h" // for PlaybackState
|
||||
#include "CDNAudioFile.h" // for CDNTrackStream, CDNTrackStream::Track...
|
||||
#include "TrackQueue.h"
|
||||
#include "protobuf/spirc.pb.h" // for MessageType
|
||||
|
||||
namespace cspot {
|
||||
@@ -31,7 +31,8 @@ class SpircHandler {
|
||||
FLUSH,
|
||||
PLAYBACK_START
|
||||
};
|
||||
typedef std::variant<CDNTrackStream::TrackInfo, int, bool> EventData;
|
||||
|
||||
typedef std::variant<TrackInfo, int, bool> EventData;
|
||||
|
||||
struct Event {
|
||||
EventType eventType;
|
||||
@@ -47,36 +48,34 @@ class SpircHandler {
|
||||
|
||||
void setPause(bool pause);
|
||||
|
||||
void nextSong();
|
||||
void previousSong();
|
||||
|
||||
void nextSong();
|
||||
|
||||
void notifyAudioReachedPlayback();
|
||||
void updatePositionMs(uint32_t position);
|
||||
void setRemoteVolume(int volume);
|
||||
void loadTrackFromURI(const std::string& uri);
|
||||
std::shared_ptr<cspot::TrackQueue> getTrackQueue() { return trackQueue; }
|
||||
|
||||
void disconnect();
|
||||
|
||||
private:
|
||||
std::shared_ptr<cspot::Context> ctx;
|
||||
std::shared_ptr<cspot::TrackPlayer> trackPlayer;
|
||||
std::shared_ptr<cspot::TrackQueue> trackQueue;
|
||||
|
||||
EventHandler eventHandler = nullptr;
|
||||
|
||||
cspot::PlaybackState playbackState;
|
||||
CDNTrackStream::TrackInfo currentTrackInfo;
|
||||
|
||||
bool isTrackFresh = true;
|
||||
bool isRequestedFromLoad = false;
|
||||
bool isNextTrackPreloaded = false;
|
||||
uint32_t nextTrackPosition = 0;
|
||||
std::shared_ptr<cspot::PlaybackState> playbackState;
|
||||
|
||||
void sendCmd(MessageType typ);
|
||||
|
||||
void sendEvent(EventType type);
|
||||
void sendEvent(EventType type, EventData data);
|
||||
|
||||
void skipSong(TrackQueue::SkipDirection dir);
|
||||
void handleFrame(std::vector<uint8_t>& data);
|
||||
void notify();
|
||||
};
|
||||
} // namespace cspot
|
||||
} // namespace cspot
|
||||
|
||||
Reference in New Issue
Block a user