mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 16:23:39 +02:00
More setting handles
This commit is contained in:
parent
f254591c88
commit
8d37f5ae00
11 changed files with 154 additions and 19 deletions
|
@ -10,9 +10,10 @@
|
|||
//
|
||||
|
||||
#include <cstring>
|
||||
#include <math.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <CoreAudio/AudioHardware.h>
|
||||
|
@ -28,29 +29,35 @@
|
|||
#include <VersionHelpers.h>
|
||||
#endif
|
||||
|
||||
#include <AudioConstants.h>
|
||||
|
||||
#include <QtCore/QBuffer>
|
||||
#include <QtMultimedia/QAudioInput>
|
||||
#include <QtMultimedia/QAudioOutput>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <AudioConstants.h>
|
||||
#include <AudioInjector.h>
|
||||
#include <NodeList.h>
|
||||
#include <PacketHeaders.h>
|
||||
|
||||
#include <PositionalAudioStream.h>
|
||||
|
||||
#include <Settings.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <UUID.h>
|
||||
|
||||
#include "Application.h"
|
||||
|
||||
#include "Audio.h"
|
||||
|
||||
static const int RECEIVED_AUDIO_STREAM_CAPACITY_FRAMES = 100;
|
||||
|
||||
namespace SettingHandles {
|
||||
const SettingHandle<bool> audioOutputStarveDetectionEnabled("audioOutputStarveDetectionEnabled",
|
||||
DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_ENABLED);
|
||||
const SettingHandle<int> audioOutputStarveDetectionThreshold("audioOutputStarveDetectionThreshold",
|
||||
DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_THRESHOLD);
|
||||
const SettingHandle<int> audioOutputStarveDetectionPeriod("audioOutputStarveDetectionPeriod",
|
||||
DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_PERIOD);
|
||||
const SettingHandle<int> audioOutputBufferSize("audioOutputBufferSize",
|
||||
DEFAULT_MAX_FRAMES_OVER_DESIRED);
|
||||
}
|
||||
|
||||
Audio::Audio() :
|
||||
AbstractAudioInterface(),
|
||||
_audioInput(NULL),
|
||||
|
@ -1114,3 +1121,28 @@ qint64 Audio::AudioOutputIODevice::readData(char * data, qint64 maxSize) {
|
|||
|
||||
return bytesWritten;
|
||||
}
|
||||
|
||||
void Audio::loadSettings() {
|
||||
_receivedAudioStream.loadSettings();
|
||||
|
||||
setOutputStarveDetectionEnabled(SettingHandles::audioOutputStarveDetectionEnabled.get());
|
||||
setOutputStarveDetectionThreshold(SettingHandles::audioOutputStarveDetectionThreshold.get());
|
||||
setOutputStarveDetectionPeriod(SettingHandles::audioOutputStarveDetectionPeriod.get());
|
||||
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "setOutputBufferSize",
|
||||
Q_ARG(int, SettingHandles::audioOutputBufferSize.get()));
|
||||
} else {
|
||||
setOutputBufferSize(SettingHandles::audioOutputBufferSize.get());
|
||||
}
|
||||
}
|
||||
|
||||
void Audio::saveSettings() {
|
||||
_receivedAudioStream.saveSettings();
|
||||
|
||||
SettingHandles::audioOutputStarveDetectionEnabled.set(getOutputStarveDetectionEnabled());
|
||||
SettingHandles::audioOutputStarveDetectionThreshold.set(getOutputStarveDetectionThreshold());
|
||||
SettingHandles::audioOutputStarveDetectionPeriod.set(getOutputStarveDetectionPeriod());
|
||||
SettingHandles::audioOutputBufferSize.set(getOutputBufferSize());
|
||||
}
|
||||
|
||||
|
|
|
@ -173,6 +173,9 @@ public slots:
|
|||
|
||||
void outputNotify();
|
||||
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
|
||||
private slots:
|
||||
void audioMuteToggled();
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <GLMHelpers.h>
|
||||
#include <PerfStat.h>
|
||||
#include <Settings.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "Faceshift.h"
|
||||
|
@ -28,6 +29,11 @@ using namespace std;
|
|||
const quint16 FACESHIFT_PORT = 33433;
|
||||
float STARTING_FACESHIFT_FRAME_TIME = 0.033f;
|
||||
|
||||
namespace SettingHandles {
|
||||
const SettingHandle<float> faceshiftEyeDeflection("faceshiftEyeDeflection", DEFAULT_FACESHIFT_EYE_DEFLECTION);
|
||||
const SettingHandle<QString> faceshiftHostname("faceshiftHostname", DEFAULT_FACESHIFT_HOSTNAME);
|
||||
}
|
||||
|
||||
Faceshift::Faceshift() :
|
||||
_tcpEnabled(true),
|
||||
_tcpRetryCount(0),
|
||||
|
@ -67,6 +73,9 @@ Faceshift::Faceshift() :
|
|||
|
||||
_udpSocket.bind(FACESHIFT_PORT);
|
||||
#endif
|
||||
|
||||
_eyeDeflection = SettingHandles::faceshiftEyeDeflection.get();
|
||||
_hostname = SettingHandles::faceshiftHostname.get();
|
||||
}
|
||||
|
||||
void Faceshift::init() {
|
||||
|
@ -310,3 +319,13 @@ void Faceshift::receive(const QByteArray& buffer) {
|
|||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Faceshift::setEyeDeflection(float faceshiftEyeDeflection) {
|
||||
_eyeDeflection = faceshiftEyeDeflection;
|
||||
SettingHandles::faceshiftEyeDeflection.set(_eyeDeflection);
|
||||
}
|
||||
|
||||
void Faceshift::setHostname(const QString& hostname) {
|
||||
_hostname = hostname;
|
||||
SettingHandles::faceshiftHostname.set(_hostname);
|
||||
}
|
||||
|
|
|
@ -63,10 +63,10 @@ public:
|
|||
float getMouthSmileRight() const { return getBlendshapeCoefficient(_mouthSmileRightIndex); }
|
||||
|
||||
float getEyeDeflection() const { return _eyeDeflection; }
|
||||
void setEyeDeflection(float faceshiftEyeDeflection) { _eyeDeflection = faceshiftEyeDeflection; }
|
||||
void setEyeDeflection(float faceshiftEyeDeflection);
|
||||
|
||||
const QString& getHostname() const { return _hostname; }
|
||||
void setHostname(const QString& hostname) { _hostname = hostname; }
|
||||
void setHostname(const QString& hostname);
|
||||
|
||||
void update();
|
||||
void reset();
|
||||
|
|
|
@ -11,11 +11,27 @@
|
|||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <Settings.h>
|
||||
|
||||
#include "InboundAudioStream.h"
|
||||
#include "PacketHeaders.h"
|
||||
|
||||
const int STARVE_HISTORY_CAPACITY = 50;
|
||||
|
||||
namespace SettingHandles {
|
||||
const SettingHandle<bool> dynamicJitterBuffers("dynamicJitterBuffers", DEFAULT_DYNAMIC_JITTER_BUFFERS);
|
||||
const SettingHandle<int> maxFramesOverDesired("maxFramesOverDesired", DEFAULT_MAX_FRAMES_OVER_DESIRED);
|
||||
const SettingHandle<int> staticDesiredJitterBufferFrames("staticDesiredJitterBufferFrames",
|
||||
DEFAULT_STATIC_DESIRED_JITTER_BUFFER_FRAMES);
|
||||
const SettingHandle<bool> useStDevForJitterCalc("useStDevForJitterCalc", DEFAULT_USE_STDEV_FOR_JITTER_CALC);
|
||||
const SettingHandle<int> windowStarveThreshold("windowStarveThreshold", DEFAULT_WINDOW_STARVE_THRESHOLD);
|
||||
const SettingHandle<int> windowSecondsForDesiredCalcOnTooManyStarves("windowSecondsForDesiredCalcOnTooManyStarves",
|
||||
DEFAULT_WINDOW_SECONDS_FOR_DESIRED_CALC_ON_TOO_MANY_STARVES);
|
||||
const SettingHandle<int> windowSecondsForDesiredReduction("windowSecondsForDesiredReduction",
|
||||
DEFAULT_WINDOW_SECONDS_FOR_DESIRED_REDUCTION);
|
||||
const SettingHandle<bool> repetitionWithFade("repetitionWithFade", DEFAULT_REPETITION_WITH_FADE);
|
||||
}
|
||||
|
||||
InboundAudioStream::InboundAudioStream(int numFrameSamples, int numFramesCapacity, const Settings& settings) :
|
||||
_ringBuffer(numFrameSamples, false, numFramesCapacity),
|
||||
_lastPopSucceeded(false),
|
||||
|
@ -500,3 +516,28 @@ float calculateRepeatedFrameFadeFactor(int indexOfRepeat) {
|
|||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void InboundAudioStream::loadSettings() {
|
||||
setDynamicJitterBuffers(SettingHandles::dynamicJitterBuffers.get());
|
||||
setMaxFramesOverDesired(SettingHandles::maxFramesOverDesired.get());
|
||||
setStaticDesiredJitterBufferFrames(SettingHandles::staticDesiredJitterBufferFrames.get());
|
||||
setUseStDevForJitterCalc(SettingHandles::useStDevForJitterCalc.get());
|
||||
setWindowStarveThreshold(SettingHandles::windowStarveThreshold.get());
|
||||
setWindowSecondsForDesiredCalcOnTooManyStarves(SettingHandles::windowSecondsForDesiredCalcOnTooManyStarves.get());
|
||||
setWindowSecondsForDesiredReduction(SettingHandles::windowSecondsForDesiredReduction.get());
|
||||
setRepetitionWithFade(SettingHandles::repetitionWithFade.get());
|
||||
}
|
||||
|
||||
void InboundAudioStream::saveSettings() {
|
||||
SettingHandles::dynamicJitterBuffers.set(getDynamicJitterBuffers());
|
||||
SettingHandles::maxFramesOverDesired.set(getMaxFramesOverDesired());
|
||||
SettingHandles::staticDesiredJitterBufferFrames.set(getDesiredJitterBufferFrames());
|
||||
SettingHandles::useStDevForJitterCalc.set(getUseStDevForJitterCalc());
|
||||
SettingHandles::windowStarveThreshold.set(getWindowStarveThreshold());
|
||||
SettingHandles::windowSecondsForDesiredCalcOnTooManyStarves.set(getWindowSecondsForDesiredCalcOnTooManyStarves());
|
||||
SettingHandles::windowSecondsForDesiredReduction.set(getWindowSecondsForDesiredReduction());
|
||||
SettingHandles::repetitionWithFade.set(getRepetitionWithFade());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -126,6 +126,8 @@ public:
|
|||
void setWindowSecondsForDesiredReduction(int windowSecondsForDesiredReduction);
|
||||
void setRepetitionWithFade(bool repetitionWithFade) { _repetitionWithFade = repetitionWithFade; }
|
||||
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
|
||||
virtual AudioStreamStats getAudioStreamStats() const;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ AddressManager::AddressManager() :
|
|||
_positionGetter(NULL),
|
||||
_orientationGetter(NULL)
|
||||
{
|
||||
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, this, &AddressManager::storeCurrentAddress);
|
||||
}
|
||||
|
||||
bool AddressManager::isConnected() {
|
||||
|
|
|
@ -9,12 +9,27 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <PacketHeaders.h>
|
||||
#include <GLMHelpers.h>
|
||||
#include <PacketHeaders.h>
|
||||
#include <Settings.h>
|
||||
|
||||
#include "OctreeConstants.h"
|
||||
#include "OctreeQuery.h"
|
||||
|
||||
namespace SettingHandles {
|
||||
const SettingHandle<int> maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS);
|
||||
}
|
||||
|
||||
OctreeQuery::OctreeQuery() {
|
||||
_maxOctreePPS = SettingHandles::maxOctreePacketsPerSecond.get();
|
||||
}
|
||||
|
||||
void OctreeQuery::setMaxOctreePacketsPerSecond(int maxOctreePPS) {
|
||||
_maxOctreePPS = maxOctreePPS;
|
||||
SettingHandles::maxOctreePacketsPerSecond.set(_maxOctreePPS);
|
||||
}
|
||||
|
||||
|
||||
int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) {
|
||||
unsigned char* bufferStart = destinationBuffer;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class OctreeQuery : public NodeData {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OctreeQuery() {}
|
||||
OctreeQuery();
|
||||
virtual ~OctreeQuery() {}
|
||||
|
||||
int getBroadcastData(unsigned char* destinationBuffer);
|
||||
|
@ -86,7 +86,7 @@ public slots:
|
|||
void setWantDelta(bool wantDelta) { _wantDelta = wantDelta; }
|
||||
void setWantOcclusionCulling(bool wantOcclusionCulling) { _wantOcclusionCulling = wantOcclusionCulling; }
|
||||
void setWantCompression(bool wantCompression) { _wantCompression = wantCompression; }
|
||||
void setMaxOctreePacketsPerSecond(int maxOctreePPS) { _maxOctreePPS = maxOctreePPS; }
|
||||
void setMaxOctreePacketsPerSecond(int maxOctreePPS);
|
||||
void setOctreeSizeScale(float octreeSizeScale) { _octreeElementSizeScale = octreeSizeScale; }
|
||||
void setBoundaryLevelAdjust(int boundaryLevelAdjust) { _boundaryLevelAdjust = boundaryLevelAdjust; }
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include <Settings.h>
|
||||
|
||||
#include "GeometryUtil.h"
|
||||
#include "SharedUtil.h"
|
||||
#include "ViewFrustum.h"
|
||||
|
@ -24,11 +26,30 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
namespace SettingHandles {
|
||||
const SettingHandle<float> fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES);
|
||||
const SettingHandle<float> realWorldFieldOfView("realWorldFieldOfView", DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES);
|
||||
}
|
||||
|
||||
ViewFrustum::ViewFrustum() {
|
||||
_fieldOfView = SettingHandles::fieldOfView.get();
|
||||
_realWorldFieldOfView = SettingHandles::realWorldFieldOfView.get();
|
||||
}
|
||||
|
||||
void ViewFrustum::setOrientation(const glm::quat& orientationAsQuaternion) {
|
||||
_orientation = orientationAsQuaternion;
|
||||
_right = glm::vec3(orientationAsQuaternion * glm::vec4(IDENTITY_RIGHT, 0.0f));
|
||||
_up = glm::vec3(orientationAsQuaternion * glm::vec4(IDENTITY_UP, 0.0f));
|
||||
_direction = glm::vec3(orientationAsQuaternion * glm::vec4(IDENTITY_FRONT, 0.0f));
|
||||
_right = glm::vec3(orientationAsQuaternion * glm::vec4(IDENTITY_RIGHT, 0.0f));
|
||||
_up = glm::vec3(orientationAsQuaternion * glm::vec4(IDENTITY_UP, 0.0f));
|
||||
_direction = glm::vec3(orientationAsQuaternion * glm::vec4(IDENTITY_FRONT, 0.0f));
|
||||
}
|
||||
|
||||
void ViewFrustum::setFieldOfView(float f) {
|
||||
_fieldOfView = f;
|
||||
SettingHandles::fieldOfView.set(f);
|
||||
}
|
||||
void ViewFrustum::setRealWorldFieldOfView(float realWorldFieldOfView) {
|
||||
_realWorldFieldOfView = realWorldFieldOfView;
|
||||
SettingHandles::realWorldFieldOfView.set(realWorldFieldOfView);
|
||||
}
|
||||
|
||||
// ViewFrustum::calculateViewFrustum()
|
||||
|
|
|
@ -34,6 +34,8 @@ const float DEFAULT_FAR_CLIP = TREE_SCALE;
|
|||
|
||||
class ViewFrustum {
|
||||
public:
|
||||
ViewFrustum();
|
||||
|
||||
// setters for camera attributes
|
||||
void setPosition(const glm::vec3& p) { _position = p; _positionVoxelScale = (p / (float)TREE_SCALE); }
|
||||
void setOrientation(const glm::quat& orientationAsQuaternion);
|
||||
|
@ -50,8 +52,8 @@ public:
|
|||
void setOrthographic(bool orthographic) { _orthographic = orthographic; }
|
||||
void setWidth(float width) { _width = width; }
|
||||
void setHeight(float height) { _height = height; }
|
||||
void setFieldOfView(float f) { _fieldOfView = f; }
|
||||
void setRealWorldFieldOfView(float realWorldFieldOfView) { _realWorldFieldOfView = realWorldFieldOfView; }
|
||||
void setFieldOfView(float f);
|
||||
void setRealWorldFieldOfView(float realWorldFieldOfView);
|
||||
void setAspectRatio(float a) { _aspectRatio = a; }
|
||||
void setNearClip(float n) { _nearClip = n; }
|
||||
void setFarClip(float f) { _farClip = f; }
|
||||
|
|
Loading…
Reference in a new issue