Add shutdown path for audio layer. Add basic event loop after setting up groove objects. Fix race condition bug by not setting path first.

This commit is contained in:
Kevin Whitaker
2017-02-03 00:29:30 -05:00
parent 685d1828ad
commit 9b2783238e
3 changed files with 28 additions and 3 deletions

View File

@@ -37,18 +37,20 @@ class GroovePlayerMgr
public:
static std::filesystem::path musicScanDir;
static GroovePlayerMgr* getInstance() {
musicScanDir = std::filesystem::current_path()/"music";
static GroovePlayerMgr instance("music.db");
musicScanDir = std::filesystem::path("music");
return &instance;
};
GroovePlayerMgr ( GroovePlayerMgr const&) = delete;
GroovePlayerMgr ( GroovePlayerMgr const&) = delete;
void operator=( GroovePlayerMgr const&) = delete;
void shutdown();
private:
enum PlayerEvents {NOTHING, GROOVE_NOWPLAYING, VOTING_ENDED, VOTE_CAST, PLAYING_PAUSED, PLAYING_RESUMED, SKIP_REQUESTED, SKIP_VOTE_CAST, SKIP_VOTING_ENDED, ADMIN_FORCE_SKIP};
GroovePlayerMgr (std::string dbFile);
Wt::Dbo::backend::Sqlite3 sqliteConnection;
Wt::Dbo::Session sqlSession;
bool continueEventLoop = true;
std::list<const AudioTrack*> requestQueue;
std::list<PlayerEvents> lastInternalEvents;