mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 16:41:02 +02:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
b42d093b4a
7 changed files with 64 additions and 11 deletions
|
@ -152,8 +152,8 @@ Application::Application(int& argc, char** argv) :
|
||||||
_packetCount(0),
|
_packetCount(0),
|
||||||
_packetsPerSecond(0),
|
_packetsPerSecond(0),
|
||||||
_bytesPerSecond(0),
|
_bytesPerSecond(0),
|
||||||
_bytesCount(0) {
|
_bytesCount(0)
|
||||||
|
{
|
||||||
gettimeofday(&_applicationStartupTime, NULL);
|
gettimeofday(&_applicationStartupTime, NULL);
|
||||||
printLog("Interface Startup:\n");
|
printLog("Interface Startup:\n");
|
||||||
|
|
||||||
|
@ -169,7 +169,9 @@ Application::Application(int& argc, char** argv) :
|
||||||
if (portStr) {
|
if (portStr) {
|
||||||
listenPort = atoi(portStr);
|
listenPort = atoi(portStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
AgentList::createInstance(AGENT_TYPE_AVATAR, listenPort);
|
AgentList::createInstance(AGENT_TYPE_AVATAR, listenPort);
|
||||||
|
|
||||||
_enableNetworkThread = !cmdOptionExists(argc, constArgv, "--nonblocking");
|
_enableNetworkThread = !cmdOptionExists(argc, constArgv, "--nonblocking");
|
||||||
if (!_enableNetworkThread) {
|
if (!_enableNetworkThread) {
|
||||||
AgentList::getInstance()->getAgentSocket()->setBlocking(false);
|
AgentList::getInstance()->getAgentSocket()->setBlocking(false);
|
||||||
|
|
|
@ -32,11 +32,15 @@ namespace { // everything in here only exists while compiling this .cpp file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Oscilloscope::Oscilloscope(int w, int h, bool isEnabled) :
|
Oscilloscope::Oscilloscope(int w, int h, bool isEnabled) :
|
||||||
_valWidth(w), _valHeight(h),
|
enabled(isEnabled),
|
||||||
_arrSamples(0l), _arrVertices(0l),
|
inputPaused(false),
|
||||||
_valLowpass(0.4f), _valDownsample(3),
|
_valWidth(w),
|
||||||
enabled(isEnabled), inputPaused(false) {
|
_valHeight(h),
|
||||||
|
_arrSamples(0l),
|
||||||
|
_arrVertices(0l),
|
||||||
|
_valLowpass(0.4f),
|
||||||
|
_valDownsample(3) {
|
||||||
|
|
||||||
// allocate enough space for the sample data and to turn it into
|
// allocate enough space for the sample data and to turn it into
|
||||||
// vertices and since they're all 'short', do so in one shot
|
// vertices and since they're all 'short', do so in one shot
|
||||||
|
|
|
@ -9,12 +9,16 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include "SharedUtil.h"
|
#include "SharedUtil.h"
|
||||||
|
#include "AgentList.h"
|
||||||
|
#include "AgentTypes.h"
|
||||||
|
#include "Agent.h"
|
||||||
#include "PacketHeaders.h"
|
#include "PacketHeaders.h"
|
||||||
|
|
||||||
#include "AudioInjectionManager.h"
|
#include "AudioInjectionManager.h"
|
||||||
|
|
||||||
UDPSocket* AudioInjectionManager::_injectorSocket = NULL;
|
UDPSocket* AudioInjectionManager::_injectorSocket = NULL;
|
||||||
sockaddr AudioInjectionManager::_destinationSocket;
|
sockaddr AudioInjectionManager::_destinationSocket;
|
||||||
|
bool AudioInjectionManager::_isDestinationSocketExplicit = false;
|
||||||
AudioInjector* AudioInjectionManager::_injectors[50] = {};
|
AudioInjector* AudioInjectionManager::_injectors[50] = {};
|
||||||
|
|
||||||
AudioInjector* AudioInjectionManager::injectorWithSamplesFromFile(const char* filename) {
|
AudioInjector* AudioInjectionManager::injectorWithSamplesFromFile(const char* filename) {
|
||||||
|
@ -39,9 +43,24 @@ AudioInjector* AudioInjectionManager::injectorWithCapacity(int capacity) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AudioInjectionManager::setDestinationSocket(sockaddr& destinationSocket) {
|
||||||
|
_destinationSocket = destinationSocket;
|
||||||
|
_isDestinationSocketExplicit = true;
|
||||||
|
}
|
||||||
|
|
||||||
void* AudioInjectionManager::injectAudioViaThread(void* args) {
|
void* AudioInjectionManager::injectAudioViaThread(void* args) {
|
||||||
AudioInjector* injector = (AudioInjector*) args;
|
AudioInjector* injector = (AudioInjector*) args;
|
||||||
|
|
||||||
|
// if we don't have an injectorSocket then grab the one from the agent list
|
||||||
|
if (!_injectorSocket) {
|
||||||
|
_injectorSocket = AgentList::getInstance()->getAgentSocket();
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we don't have an explicit destination socket then pull active socket for current audio mixer from agent list
|
||||||
|
if (!_isDestinationSocketExplicit) {
|
||||||
|
_destinationSocket = *AgentList::getInstance()->soloAgentOfType(AGENT_TYPE_AUDIO_MIXER)->getActiveSocket();
|
||||||
|
}
|
||||||
|
|
||||||
injector->injectAudio(_injectorSocket, &_destinationSocket);
|
injector->injectAudio(_injectorSocket, &_destinationSocket);
|
||||||
|
|
||||||
// if this an injector inside the injection manager's array we're responsible for deletion
|
// if this an injector inside the injection manager's array we're responsible for deletion
|
||||||
|
|
|
@ -24,12 +24,13 @@ public:
|
||||||
static void threadInjector(AudioInjector* injector);
|
static void threadInjector(AudioInjector* injector);
|
||||||
|
|
||||||
static void setInjectorSocket(UDPSocket* injectorSocket) { _injectorSocket = injectorSocket;}
|
static void setInjectorSocket(UDPSocket* injectorSocket) { _injectorSocket = injectorSocket;}
|
||||||
static void setDestinationSocket(sockaddr& destinationSocket) { _destinationSocket = destinationSocket; }
|
static void setDestinationSocket(sockaddr& destinationSocket);
|
||||||
private:
|
private:
|
||||||
static void* injectAudioViaThread(void* args);
|
static void* injectAudioViaThread(void* args);
|
||||||
|
|
||||||
static UDPSocket* _injectorSocket;
|
static UDPSocket* _injectorSocket;
|
||||||
static sockaddr _destinationSocket;
|
static sockaddr _destinationSocket;
|
||||||
|
static bool _isDestinationSocketExplicit;
|
||||||
static AudioInjector* _injectors[MAX_CONCURRENT_INJECTORS];
|
static AudioInjector* _injectors[MAX_CONCURRENT_INJECTORS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,34 @@ int unpackFloatAngleFromTwoByte(uint16_t* byteAnglePointer, float* destinationPo
|
||||||
return sizeof(uint16_t);
|
return sizeof(uint16_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AvatarData::AvatarData() :
|
||||||
|
_handPosition(0,0,0),
|
||||||
|
_bodyYaw(-90.0),
|
||||||
|
_bodyPitch(0.0),
|
||||||
|
_bodyRoll(0.0),
|
||||||
|
_headYaw(0),
|
||||||
|
_headPitch(0),
|
||||||
|
_headRoll(0),
|
||||||
|
_headLeanSideways(0),
|
||||||
|
_headLeanForward(0),
|
||||||
|
_audioLoudness(0),
|
||||||
|
_handState(0),
|
||||||
|
_cameraPosition(0,0,0),
|
||||||
|
_cameraDirection(0,0,0),
|
||||||
|
_cameraUp(0,0,0),
|
||||||
|
_cameraRight(0,0,0),
|
||||||
|
_cameraFov(0.0f),
|
||||||
|
_cameraAspectRatio(0.0f),
|
||||||
|
_cameraNearClip(0.0f),
|
||||||
|
_cameraFarClip(0.0f),
|
||||||
|
_keyState(NO_KEY_DOWN),
|
||||||
|
_wantResIn(false),
|
||||||
|
_wantColor(true),
|
||||||
|
_wantDelta(false)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
||||||
unsigned char* bufferStart = destinationBuffer;
|
unsigned char* bufferStart = destinationBuffer;
|
||||||
|
|
||||||
|
|
|
@ -67,10 +67,8 @@ public:
|
||||||
// Body Rotation
|
// Body Rotation
|
||||||
float getBodyYaw() const { return _bodyYaw; }
|
float getBodyYaw() const { return _bodyYaw; }
|
||||||
void setBodyYaw(float bodyYaw) { _bodyYaw = bodyYaw; }
|
void setBodyYaw(float bodyYaw) { _bodyYaw = bodyYaw; }
|
||||||
|
|
||||||
float getBodyPitch() const { return _bodyPitch; }
|
float getBodyPitch() const { return _bodyPitch; }
|
||||||
void setBodyPitch(float bodyPitch) { _bodyPitch = bodyPitch; }
|
void setBodyPitch(float bodyPitch) { _bodyPitch = bodyPitch; }
|
||||||
|
|
||||||
float getBodyRoll() const {return _bodyRoll; }
|
float getBodyRoll() const {return _bodyRoll; }
|
||||||
void setBodyRoll(float bodyRoll) { _bodyRoll = bodyRoll; }
|
void setBodyRoll(float bodyRoll) { _bodyRoll = bodyRoll; }
|
||||||
|
|
||||||
|
@ -139,7 +137,7 @@ protected:
|
||||||
// privatize the copy constructor and assignment operator so they cannot be called
|
// privatize the copy constructor and assignment operator so they cannot be called
|
||||||
AvatarData(const AvatarData&);
|
AvatarData(const AvatarData&);
|
||||||
AvatarData& operator= (const AvatarData&);
|
AvatarData& operator= (const AvatarData&);
|
||||||
|
|
||||||
glm::vec3 _position;
|
glm::vec3 _position;
|
||||||
glm::vec3 _handPosition;
|
glm::vec3 _handPosition;
|
||||||
glm::vec3 _lookatPosition;
|
glm::vec3 _lookatPosition;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
#include "AgentList.h"
|
#include "AgentList.h"
|
||||||
#include "AgentTypes.h"
|
#include "AgentTypes.h"
|
||||||
#include "PacketHeaders.h"
|
#include "PacketHeaders.h"
|
||||||
|
|
Loading…
Reference in a new issue