mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 22:56:29 +02:00
Merge branch 'master' of github.com:Atlante45/hifi
This commit is contained in:
commit
88c8e5124e
7 changed files with 108 additions and 92 deletions
|
@ -105,7 +105,6 @@ public:
|
||||||
float getAudioOutputAverageMsecsUnplayed() const { return (float)_audioOutputMsecsUnplayedStats.getWindowAverage(); }
|
float getAudioOutputAverageMsecsUnplayed() const { return (float)_audioOutputMsecsUnplayedStats.getWindowAverage(); }
|
||||||
|
|
||||||
void setRecorder(RecorderPointer recorder) { _recorder = recorder; }
|
void setRecorder(RecorderPointer recorder) { _recorder = recorder; }
|
||||||
void setPlayer(PlayerPointer player) { _player = player; }
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void start();
|
void start();
|
||||||
|
@ -314,7 +313,6 @@ private:
|
||||||
AudioOutputIODevice _audioOutputIODevice;
|
AudioOutputIODevice _audioOutputIODevice;
|
||||||
|
|
||||||
WeakRecorderPointer _recorder;
|
WeakRecorderPointer _recorder;
|
||||||
WeakPlayerPointer _player;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -575,58 +575,6 @@ void MyAvatar::saveRecording(QString filename) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MyAvatar::isPlaying() {
|
|
||||||
if (!_player) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (QThread::currentThread() != thread()) {
|
|
||||||
bool result;
|
|
||||||
QMetaObject::invokeMethod(this, "isPlaying", Qt::BlockingQueuedConnection,
|
|
||||||
Q_RETURN_ARG(bool, result));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return _player && _player->isPlaying();
|
|
||||||
}
|
|
||||||
|
|
||||||
qint64 MyAvatar::playerElapsed() {
|
|
||||||
if (!_player) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (QThread::currentThread() != thread()) {
|
|
||||||
qint64 result;
|
|
||||||
QMetaObject::invokeMethod(this, "playerElapsed", Qt::BlockingQueuedConnection,
|
|
||||||
Q_RETURN_ARG(qint64, result));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return _player->elapsed();
|
|
||||||
}
|
|
||||||
|
|
||||||
qint64 MyAvatar::playerLength() {
|
|
||||||
if (!_player) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (QThread::currentThread() != thread()) {
|
|
||||||
qint64 result;
|
|
||||||
QMetaObject::invokeMethod(this, "playerLength", Qt::BlockingQueuedConnection,
|
|
||||||
Q_RETURN_ARG(qint64, result));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return _player->getRecording()->getLength();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyAvatar::loadRecording(QString filename) {
|
|
||||||
if (QThread::currentThread() != thread()) {
|
|
||||||
QMetaObject::invokeMethod(this, "loadRecording", Qt::BlockingQueuedConnection,
|
|
||||||
Q_ARG(QString, filename));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!_player) {
|
|
||||||
_player = PlayerPointer(new Player(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
_player->loadFromFile(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyAvatar::loadLastRecording() {
|
void MyAvatar::loadLastRecording() {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QMetaObject::invokeMethod(this, "loadLastRecording", Qt::BlockingQueuedConnection);
|
QMetaObject::invokeMethod(this, "loadLastRecording", Qt::BlockingQueuedConnection);
|
||||||
|
@ -643,32 +591,6 @@ void MyAvatar::loadLastRecording() {
|
||||||
_player->loadRecording(_recorder->getRecording());
|
_player->loadRecording(_recorder->getRecording());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::startPlaying() {
|
|
||||||
if (QThread::currentThread() != thread()) {
|
|
||||||
QMetaObject::invokeMethod(this, "startPlaying", Qt::BlockingQueuedConnection);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!_player) {
|
|
||||||
_player = PlayerPointer(new Player(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
Application::getInstance()->getAudio()->setPlayer(_player);
|
|
||||||
_player->startPlaying();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyAvatar::stopPlaying() {
|
|
||||||
if (!_player) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (QThread::currentThread() != thread()) {
|
|
||||||
QMetaObject::invokeMethod(this, "stopPlaying", Qt::BlockingQueuedConnection);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_player) {
|
|
||||||
_player->stopPlaying();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyAvatar::setLocalGravity(glm::vec3 gravity) {
|
void MyAvatar::setLocalGravity(glm::vec3 gravity) {
|
||||||
_motionBehaviors |= AVATAR_MOTION_OBEY_LOCAL_GRAVITY;
|
_motionBehaviors |= AVATAR_MOTION_OBEY_LOCAL_GRAVITY;
|
||||||
// Environmental and Local gravities are incompatible. Since Local is being set here
|
// Environmental and Local gravities are incompatible. Since Local is being set here
|
||||||
|
|
|
@ -176,15 +176,7 @@ public slots:
|
||||||
void startRecording();
|
void startRecording();
|
||||||
void stopRecording();
|
void stopRecording();
|
||||||
void saveRecording(QString filename);
|
void saveRecording(QString filename);
|
||||||
|
|
||||||
bool isPlaying();
|
|
||||||
qint64 playerElapsed();
|
|
||||||
qint64 playerLength();
|
|
||||||
void loadRecording(QString filename);
|
|
||||||
void loadLastRecording();
|
void loadLastRecording();
|
||||||
void startPlaying();
|
|
||||||
void stopPlaying();
|
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void transformChanged();
|
void transformChanged();
|
||||||
|
@ -224,7 +216,6 @@ private:
|
||||||
PhysicsSimulation _physicsSimulation;
|
PhysicsSimulation _physicsSimulation;
|
||||||
|
|
||||||
RecorderPointer _recorder;
|
RecorderPointer _recorder;
|
||||||
PlayerPointer _player;
|
|
||||||
|
|
||||||
// private methods
|
// private methods
|
||||||
float computeDistanceToFloor(const glm::vec3& startPoint);
|
float computeDistanceToFloor(const glm::vec3& startPoint);
|
||||||
|
|
|
@ -585,6 +585,94 @@ bool AvatarData::hasReferential() {
|
||||||
return _referential != NULL;
|
return _referential != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AvatarData::isPlaying() {
|
||||||
|
if (!_player) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
bool result;
|
||||||
|
QMetaObject::invokeMethod(this, "isPlaying", Qt::BlockingQueuedConnection,
|
||||||
|
Q_RETURN_ARG(bool, result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return _player && _player->isPlaying();
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 AvatarData::playerElapsed() {
|
||||||
|
if (!_player) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
qint64 result;
|
||||||
|
QMetaObject::invokeMethod(this, "playerElapsed", Qt::BlockingQueuedConnection,
|
||||||
|
Q_RETURN_ARG(qint64, result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return _player->elapsed();
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 AvatarData::playerLength() {
|
||||||
|
if (!_player) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
qint64 result;
|
||||||
|
QMetaObject::invokeMethod(this, "playerLength", Qt::BlockingQueuedConnection,
|
||||||
|
Q_RETURN_ARG(qint64, result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return _player->getRecording()->getLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvatarData::loadRecording(QString filename) {
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QMetaObject::invokeMethod(this, "loadRecording", Qt::BlockingQueuedConnection,
|
||||||
|
Q_ARG(QString, filename));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!_player) {
|
||||||
|
_player = PlayerPointer(new Player(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
_player->loadFromFile(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvatarData::startPlaying() {
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QMetaObject::invokeMethod(this, "startPlaying", Qt::BlockingQueuedConnection);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!_player) {
|
||||||
|
_player = PlayerPointer(new Player(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
_player->startPlaying();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvatarData::play() {
|
||||||
|
if (isPlaying()) {
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QMetaObject::invokeMethod(this, "play", Qt::BlockingQueuedConnection);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_player->play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvatarData::stopPlaying() {
|
||||||
|
if (!_player) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QMetaObject::invokeMethod(this, "stopPlaying", Qt::BlockingQueuedConnection);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_player) {
|
||||||
|
_player->stopPlaying();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AvatarData::changeReferential(Referential *ref) {
|
void AvatarData::changeReferential(Referential *ref) {
|
||||||
delete _referential;
|
delete _referential;
|
||||||
_referential = ref;
|
_referential = ref;
|
||||||
|
|
|
@ -49,6 +49,7 @@ typedef unsigned long long quint64;
|
||||||
|
|
||||||
#include <Node.h>
|
#include <Node.h>
|
||||||
|
|
||||||
|
#include "Recorder.h"
|
||||||
#include "Referential.h"
|
#include "Referential.h"
|
||||||
#include "HeadData.h"
|
#include "HeadData.h"
|
||||||
#include "HandData.h"
|
#include "HandData.h"
|
||||||
|
@ -298,6 +299,14 @@ public slots:
|
||||||
void setSessionUUID(const QUuid& sessionUUID) { _sessionUUID = sessionUUID; }
|
void setSessionUUID(const QUuid& sessionUUID) { _sessionUUID = sessionUUID; }
|
||||||
bool hasReferential();
|
bool hasReferential();
|
||||||
|
|
||||||
|
bool isPlaying();
|
||||||
|
qint64 playerElapsed();
|
||||||
|
qint64 playerLength();
|
||||||
|
void loadRecording(QString filename);
|
||||||
|
void startPlaying();
|
||||||
|
void play();
|
||||||
|
void stopPlaying();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QUuid _sessionUUID;
|
QUuid _sessionUUID;
|
||||||
glm::vec3 _position;
|
glm::vec3 _position;
|
||||||
|
@ -351,6 +360,8 @@ protected:
|
||||||
QWeakPointer<Node> _owningAvatarMixer;
|
QWeakPointer<Node> _owningAvatarMixer;
|
||||||
QElapsedTimer _lastUpdateTimer;
|
QElapsedTimer _lastUpdateTimer;
|
||||||
|
|
||||||
|
PlayerPointer _player;
|
||||||
|
|
||||||
/// Loads the joint indices, names from the FST file (if any)
|
/// Loads the joint indices, names from the FST file (if any)
|
||||||
virtual void updateJointMappings();
|
virtual void updateJointMappings();
|
||||||
void changeReferential(Referential* ref);
|
void changeReferential(Referential* ref);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
#include "AvatarData.h"
|
||||||
#include "Recorder.h"
|
#include "Recorder.h"
|
||||||
|
|
||||||
void RecordingFrame::setBlendshapeCoefficients(QVector<float> blendshapeCoefficients) {
|
void RecordingFrame::setBlendshapeCoefficients(QVector<float> blendshapeCoefficients) {
|
||||||
|
@ -281,7 +282,9 @@ void Player::play() {
|
||||||
_avatar->setTargetScale(_recording->getFrame(_currentFrame).getScale());
|
_avatar->setTargetScale(_recording->getFrame(_currentFrame).getScale());
|
||||||
_avatar->setJointRotations(_recording->getFrame(_currentFrame).getJointRotations());
|
_avatar->setJointRotations(_recording->getFrame(_currentFrame).getJointRotations());
|
||||||
HeadData* head = const_cast<HeadData*>(_avatar->getHeadData());
|
HeadData* head = const_cast<HeadData*>(_avatar->getHeadData());
|
||||||
head->setBlendshapeCoefficients(_recording->getFrame(_currentFrame).getBlendshapeCoefficients());
|
if (head) {
|
||||||
|
head->setBlendshapeCoefficients(_recording->getFrame(_currentFrame).getBlendshapeCoefficients());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_avatar->setPosition(_recording->getFrame(0).getTranslation() +
|
_avatar->setPosition(_recording->getFrame(0).getTranslation() +
|
||||||
_recording->getFrame(_currentFrame).getTranslation());
|
_recording->getFrame(_currentFrame).getTranslation());
|
||||||
|
@ -291,7 +294,10 @@ void Player::play() {
|
||||||
_recording->getFrame(_currentFrame).getScale());
|
_recording->getFrame(_currentFrame).getScale());
|
||||||
_avatar->setJointRotations(_recording->getFrame(_currentFrame).getJointRotations());
|
_avatar->setJointRotations(_recording->getFrame(_currentFrame).getJointRotations());
|
||||||
HeadData* head = const_cast<HeadData*>(_avatar->getHeadData());
|
HeadData* head = const_cast<HeadData*>(_avatar->getHeadData());
|
||||||
head->setBlendshapeCoefficients(_recording->getFrame(_currentFrame).getBlendshapeCoefficients());
|
if (head) {
|
||||||
|
|
||||||
|
head->setBlendshapeCoefficients(_recording->getFrame(_currentFrame).getBlendshapeCoefficients());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_options.setPosition(_avatar->getPosition());
|
_options.setPosition(_avatar->getPosition());
|
|
@ -23,10 +23,10 @@
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
|
|
||||||
#include <AudioInjector.h>
|
#include <AudioInjector.h>
|
||||||
#include <AvatarData.h>
|
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include <Sound.h>
|
#include <Sound.h>
|
||||||
|
|
||||||
|
class AvatarData;
|
||||||
class Recorder;
|
class Recorder;
|
||||||
class Recording;
|
class Recording;
|
||||||
class Player;
|
class Player;
|
Loading…
Reference in a new issue