4
0
mirror of https://github.com/QuasarApp/SoundBand.git synced 2025-05-02 01:59:34 +00:00

40 lines
540 B
C++
Raw Normal View History

2017-12-13 22:40:29 +03:00
#include "player.h"
#include <stdio.h>
#include "exaptions.h"
#include <QFile>
#include <QDir>
2017-12-14 10:47:50 +03:00
Player::Player(const QString &bufferFile, QObject *parent, Flags flags):
2017-12-13 22:40:29 +03:00
QMediaPlayer(parent, flags)
{
buffer = bufferFile;
2018-01-09 22:14:54 +03:00
bufferVolume = 0;
2017-12-13 22:40:29 +03:00
}
2018-01-14 15:29:42 +03:00
void Player::syncBegin(){
2017-12-13 22:40:29 +03:00
2018-01-09 22:14:54 +03:00
bufferVolume = volume();
setVolume(0);
2017-12-17 14:27:21 +03:00
2018-01-09 22:14:54 +03:00
play();
2017-12-17 14:27:21 +03:00
2017-12-13 22:40:29 +03:00
}
2018-01-14 15:29:42 +03:00
void Player::syncEnd(){
2018-01-09 22:14:54 +03:00
2018-01-14 15:29:42 +03:00
if(bufferVolume){
setVolume(bufferVolume);
bufferVolume = 0;
2017-12-17 14:27:21 +03:00
}
2018-01-09 22:14:54 +03:00
}
2017-12-17 14:27:21 +03:00
2018-01-09 22:14:54 +03:00
bool Player::isSynced()const{
return !bufferVolume;
2017-12-17 14:27:21 +03:00
}
2017-12-13 22:40:29 +03:00
Player::~Player(){
}