Add groove player to stuff linked in. Add some vars to hold player events to watch for in event loop. Implement first version of vote picking algorithm.

This commit is contained in:
Kevin Whitaker
2017-01-31 22:06:58 -05:00
parent 83efc750eb
commit a38258a883
4 changed files with 106 additions and 8 deletions

View File

@@ -22,7 +22,7 @@
#include <Wt/Dbo/Session>
#include <Wt/Dbo/backend/Sqlite3>
#include <vector>
#include <list>
#include <thread>
#include "db/User.h"
#include "db/AudioTrack.h"
@@ -44,19 +44,28 @@ public:
GroovePlayer(GroovePlayer const&) = delete;
void operator=(GroovePlayer const&) = delete;
private:
enum PlayerEvents {NOTHING, GROOVE_NOWPLAYING, VOTING_ENDED, VOTE_CAST, PLAYING_PAUSED, PLAYING_RESUMED, SKIP_REQUESTED, SKIP_VOTE_CAST, SKIP_VOTING_ENDED};
GroovePlayer(std::string dbFile);
Wt::Dbo::backend::Sqlite3 sqliteConnection;
Wt::Dbo::Session sqlSession;
std::vector<AudioTrack*> requestQueue;
std::list<const AudioTrack*> requestQueue;
std::list<PlayerEvents> lastInternalEvents;
GroovePlaylistItem* currentItem;
std::thread* grooveEvents;
static void grooveEventLoop();
std::vector<AudioTrack*> getNextVoteBatch();
std::list<const AudioTrack*> getNextVoteBatch();
std::thread* grooveAudioScanner;
static void grooveAudioScannerLoop();
PlayerEvents getNextPlayerEvent();
static bool addFileToTrackDBIfTagged(std::filesystem::path file);
static void removeOrphanedTracks();
Wt::Dbo::ptr<AudioTrack> getCurrentTrack();
};
#endif // GROOVEPLAYER_H