summaryrefslogtreecommitdiffstats
path: root/src/mixer/playerinfo.h
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2016-01-10 20:01:27 +0100
committerDaniel Schürmann <daschuer@mixxx.org>2016-01-10 20:01:27 +0100
commit26309cda4530f62f4561e55cb7b489ffdf64a2ba (patch)
tree40f774a5cd6705482efb662132ccafff70d8545d /src/mixer/playerinfo.h
parenta5213da5b2b7eef213625d8778971e070675e926 (diff)
parentb2e8f90b07634e7f6a6836eebdc99121f41a9726 (diff)
Merge remote-tracking branch 'upstream/master' into ContrlObjectSlaveDirect
Conflicts: src/dlgprefshoutcast.cpp src/dlgprefshoutcast.h
Diffstat (limited to 'src/mixer/playerinfo.h')
-rw-r--r--src/mixer/playerinfo.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/mixer/playerinfo.h b/src/mixer/playerinfo.h
new file mode 100644
index 0000000000..ce822a89bc
--- /dev/null
+++ b/src/mixer/playerinfo.h
@@ -0,0 +1,81 @@
+/***************************************************************************
+ playerinfo.h - Helper class to have easy access
+ to a lot of data (singleton)
+ -------------------
+ copyright : (C) 2007 by Wesley Stessens
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef MIXER_PLAYERINFO_H
+#define MIXER_PLAYERINFO_H
+
+#include <QObject>
+#include <QMutex>
+#include <QMap>
+#include <QTimerEvent>
+
+#include "controlobjectslave.h"
+#include "trackinfoobject.h"
+
+class PlayerInfo : public QObject {
+ Q_OBJECT
+ public:
+ static PlayerInfo& instance();
+ static void destroy();
+ TrackPointer getTrackInfo(const QString& group);
+ void setTrackInfo(const QString& group, const TrackPointer& trackInfoObj);
+ TrackPointer getCurrentPlayingTrack();
+ QMap<QString, TrackPointer> getLoadedTracks();
+ bool isTrackLoaded(const TrackPointer& pTrack) const;
+ bool isFileLoaded(const QString& track_location) const;
+
+ signals:
+ void currentPlayingDeckChanged(int deck);
+ void currentPlayingTrackChanged(TrackPointer pTrack);
+ void trackLoaded(QString group, TrackPointer pTrack);
+ void trackUnloaded(QString group, TrackPointer pTrack);
+
+ private:
+ class DeckControls {
+ public:
+ DeckControls(QString& group)
+ : m_play(group, "play"),
+ m_pregain(group, "pregain"),
+ m_volume(group, "volume"),
+ m_orientation(group, "orientation") {
+ }
+
+ ControlObjectSlave m_play;
+ ControlObjectSlave m_pregain;
+ ControlObjectSlave m_volume;
+ ControlObjectSlave m_orientation;
+ };
+
+ void clearControlCache();
+ void timerEvent(QTimerEvent* pTimerEvent);
+ void updateCurrentPlayingDeck();
+ int getCurrentPlayingDeck();
+ DeckControls* getDeckControls(int i);
+
+ PlayerInfo();
+ virtual ~PlayerInfo();
+
+ mutable QMutex m_mutex;
+ ControlObjectSlave* m_pCOxfader;
+ // QMap is faster than QHash for small count of elements < 50
+ QMap<QString, TrackPointer> m_loadedTrackMap;
+ int m_currentlyPlayingDeck;
+ QList<DeckControls*> m_deckControlList;
+
+ static PlayerInfo* m_pPlayerinfo;
+};
+
+#endif /* MIXER_PLAYERINFO_H */