removed _isPaused

This commit is contained in:
Atlante45 2014-09-25 19:32:57 -07:00
parent cf925120ca
commit cf453a8953
2 changed files with 8 additions and 13 deletions

View file

@ -19,10 +19,10 @@
Player::Player(AvatarData* avatar) : Player::Player(AvatarData* avatar) :
_recording(new Recording()), _recording(new Recording()),
_pausedFrame(-1),
_timerOffset(0), _timerOffset(0),
_avatar(avatar), _avatar(avatar),
_audioThread(NULL), _audioThread(NULL),
_isPaused(false),
_playFromCurrentPosition(true), _playFromCurrentPosition(true),
_loop(false), _loop(false),
_useAttachments(true), _useAttachments(true),
@ -40,7 +40,7 @@ bool Player::isPlaying() const {
} }
bool Player::isPaused() const { bool Player::isPaused() const {
return _isPaused; return (_pausedFrame != -1);
} }
qint64 Player::elapsed() const { qint64 Player::elapsed() const {
@ -58,7 +58,7 @@ void Player::startPlaying() {
return; return;
} }
if (!_isPaused) { if (!isPaused()) {
_currentContext.globalTimestamp = usecTimestampNow(); _currentContext.globalTimestamp = usecTimestampNow();
_currentContext.domain = NodeList::getInstance()->getDomainHandler().getHostname(); _currentContext.domain = NodeList::getInstance()->getDomainHandler().getHostname();
_currentContext.position = _avatar->getPosition(); _currentContext.position = _avatar->getPosition();
@ -118,9 +118,9 @@ void Player::startPlaying() {
qDebug() << "Recorder::startPlaying(): Unpause"; qDebug() << "Recorder::startPlaying(): Unpause";
setupAudioThread(); setupAudioThread();
_timer.start(); _timer.start();
_isPaused = false;
setCurrentFrame(_pausedFrame); setCurrentFrame(_pausedFrame);
_pausedFrame = -1;
} }
} }
@ -128,7 +128,7 @@ void Player::stopPlaying() {
if (!isPlaying()) { if (!isPlaying()) {
return; return;
} }
_isPaused = false; _pausedFrame = -1;
_timer.invalidate(); _timer.invalidate();
cleanupAudioThread(); cleanupAudioThread();
_avatar->clearJointsData(); _avatar->clearJointsData();
@ -157,7 +157,6 @@ void Player::pausePlayer() {
_timer.invalidate(); _timer.invalidate();
cleanupAudioThread(); cleanupAudioThread();
_isPaused = true;
_pausedFrame = _currentFrame; _pausedFrame = _currentFrame;
qDebug() << "Recorder::pausePlayer()"; qDebug() << "Recorder::pausePlayer()";
} }
@ -200,12 +199,12 @@ void Player::loadFromFile(const QString& file) {
} }
readRecordingFromFile(_recording, file); readRecordingFromFile(_recording, file);
_isPaused = false; _pausedFrame = -1;
} }
void Player::loadRecording(RecordingPointer recording) { void Player::loadRecording(RecordingPointer recording) {
_recording = recording; _recording = recording;
_isPaused = false; _pausedFrame = -1;
} }
void Player::play() { void Player::play() {
@ -262,7 +261,6 @@ void Player::setCurrentFrame(int currentFrame) {
_timer.start(); _timer.start();
setAudionInjectorPosition(); setAudionInjectorPosition();
} else { } else {
_isPaused = true;
_pausedFrame = currentFrame; _pausedFrame = currentFrame;
} }
} }
@ -308,7 +306,6 @@ void Player::setCurrentTime(qint64 currentTime) {
_timer.start(); _timer.start();
setAudionInjectorPosition(); setAudionInjectorPosition();
} else { } else {
_isPaused = true;
_pausedFrame = lowestBound; _pausedFrame = lowestBound;
} }
} }

View file

@ -64,6 +64,7 @@ private:
QElapsedTimer _timer; QElapsedTimer _timer;
RecordingPointer _recording; RecordingPointer _recording;
int _currentFrame; int _currentFrame;
int _pausedFrame;
qint64 _timerOffset; qint64 _timerOffset;
QSharedPointer<AudioInjector> _injector; QSharedPointer<AudioInjector> _injector;
@ -72,9 +73,6 @@ private:
AvatarData* _avatar; AvatarData* _avatar;
QThread* _audioThread; QThread* _audioThread;
bool _isPaused;
int _pausedFrame;
RecordingContext _currentContext; RecordingContext _currentContext;
bool _playFromCurrentPosition; bool _playFromCurrentPosition;
bool _loop; bool _loop;