mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 19:13:55 -07:00
SoundEngine overhaul
This commit is contained in:
parent
311536d1aa
commit
d6398477ae
16 changed files with 128 additions and 81 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue