SoundEngine overhaul

This commit is contained in:
Jeff 2015-08-26 15:04:53 -04:00
parent 311536d1aa
commit d6398477ae
16 changed files with 128 additions and 81 deletions

View file

@ -4,6 +4,10 @@
#include <QObject>
#include <QMap>
#include <QDateTime>
#include <QStringList>
#if QT_VERSION > 0x050000
#include <QMediaPlayer>
#endif
class QAudioOutput;
class QBuffer;
@ -11,25 +15,22 @@ class QBuffer;
class SoundEngine : public QObject {
Q_OBJECT
private:
void playSound(const QString &fileName);
QMap<QString, QByteArray> audioData;
QMap<QString, QByteArray> audioCache;
QBuffer *inputBuffer;
QAudioOutput *audio;
QDateTime lastTapPlayed;
QDateTime lastEndStepPlayed;
QDateTime lastAttackStepPlayed;
bool enabled;
QStringList fileNames;
#if QT_VERSION > 0x050000
QMap<QString, QMediaPlayer*> audioData;
#endif
private slots:
void cacheData();
void soundEnabledChanged();
public:
SoundEngine(QObject *parent = 0);
public slots:
void endStep();
void tap();
void playerJoined();
void attack();
void playSound(QString fileName);
};
extern SoundEngine *soundEngine;
#endif