80bffc0fdd
Add Database class with SQLite fetch/fetchAlbum methods. Refactor PlaybackEngine (data callback, seek, getPosition, decoder lifecycle) and Player API (PlaybackEngine member, queue handling, PlayerLocal). Update Metadata::Track fields to include artist/title/album/trackNr/length.
57 lines
1.2 KiB
C++
57 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "../include/Metadata.h"
|
|
#include "../include/PlaybackEngine.h"
|
|
#include "../include/miniaudio.h"
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
using Queue = std::vector<Track>;
|
|
|
|
class Player {
|
|
public:
|
|
virtual ~Player ();
|
|
|
|
virtual void initPlayer ();
|
|
virtual void loadFile ( Track track );
|
|
|
|
// Transport Control
|
|
virtual void play ();
|
|
virtual void stop ();
|
|
virtual void pause ();
|
|
virtual void previous ();
|
|
virtual void next ();
|
|
|
|
virtual ma_uint64 getPlayheadPosition ();
|
|
virtual void setPlayheadPosition () const;
|
|
|
|
// get Metadat
|
|
virtual std::string &getArtist () const;
|
|
virtual std::string &getTitle () const;
|
|
virtual std::string &getAlbum () const;
|
|
virtual unsigned int getTrackNr () const;
|
|
|
|
// Player Queue
|
|
Queue getQueue () const;
|
|
Queue clearQueue ();
|
|
void addToQueue ( Track &track );
|
|
Queue rempveFromQueue ( Track &track );
|
|
Queue shuffleQueue ();
|
|
|
|
protected:
|
|
PlaybackEngine PE_;
|
|
Queue queue_;
|
|
|
|
private:
|
|
std::string artist_;
|
|
std::string title_;
|
|
std::string album_;
|
|
std::string trackNr_;
|
|
std::string filePath_;
|
|
|
|
unsigned int samplerate_ = 48000;
|
|
unsigned int channels_ = 2;
|
|
};
|