This repository has been archived on 2024-06-03. You can view files and clone it, but cannot push or open issues or pull requests.
shared-libraries/ScStwLibraries/headers/scstwsoundplayer.h

42 lines
862 B
C
Raw Normal View History

#ifndef SCSTWSTARTSOUNDPLAYER_H
#define SCSTWSTARTSOUNDPLAYER_H
#include <QObject>
#include <QFile>
#include <QAudioOutput>
#include <QDebug>
#include <QEventLoop>
#include <QTimer>
#include <QDateTime>
class ScStwSoundPlayer : public QObject
{
Q_OBJECT
public:
explicit ScStwSoundPlayer(QObject *parent = nullptr);
private:
QMap<int, QFile*> soundFiles;
QFile *falseStartSoundFile;
QAudioOutput *audioOutput;
QEventLoop *waitLoop;
QTimer *waitTimer;
int currentlyPlayingAction;
public slots:
bool play(int action, double volume, double *timeOfStop = nullptr);
bool cancel(double volume);
bool waitForSoundFinish(double *timeOfStop = nullptr);
//int interrupt();
private slots:
void handleStateChanged(QAudio::State newState);
signals:
void playbackStarted();
};
#endif // SCSTWSTARTSOUNDPLAYER_H