Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Jeffrey Ventrella 2013-05-20 14:36:13 -07:00
commit b42d093b4a
7 changed files with 64 additions and 11 deletions

View file

@ -152,8 +152,8 @@ Application::Application(int& argc, char** argv) :
_packetCount(0),
_packetsPerSecond(0),
_bytesPerSecond(0),
_bytesCount(0) {
_bytesCount(0)
{
gettimeofday(&_applicationStartupTime, NULL);
printLog("Interface Startup:\n");
@ -169,7 +169,9 @@ Application::Application(int& argc, char** argv) :
if (portStr) {
listenPort = atoi(portStr);
}
AgentList::createInstance(AGENT_TYPE_AVATAR, listenPort);
_enableNetworkThread = !cmdOptionExists(argc, constArgv, "--nonblocking");
if (!_enableNetworkThread) {
AgentList::getInstance()->getAgentSocket()->setBlocking(false);

View file

@ -32,11 +32,15 @@ namespace { // everything in here only exists while compiling this .cpp file
}
Oscilloscope::Oscilloscope(int w, int h, bool isEnabled) :
_valWidth(w), _valHeight(h),
_arrSamples(0l), _arrVertices(0l),
_valLowpass(0.4f), _valDownsample(3),
enabled(isEnabled), inputPaused(false) {
Oscilloscope::Oscilloscope(int w, int h, bool isEnabled) :
enabled(isEnabled),
inputPaused(false),
_valWidth(w),
_valHeight(h),
_arrSamples(0l),
_arrVertices(0l),
_valLowpass(0.4f),
_valDownsample(3) {
// allocate enough space for the sample data and to turn it into
// vertices and since they're all 'short', do so in one shot

View file

@ -9,12 +9,16 @@
#include <sys/time.h>
#include "SharedUtil.h"
#include "AgentList.h"
#include "AgentTypes.h"
#include "Agent.h"
#include "PacketHeaders.h"
#include "AudioInjectionManager.h"
UDPSocket* AudioInjectionManager::_injectorSocket = NULL;
sockaddr AudioInjectionManager::_destinationSocket;
bool AudioInjectionManager::_isDestinationSocketExplicit = false;
AudioInjector* AudioInjectionManager::_injectors[50] = {};
AudioInjector* AudioInjectionManager::injectorWithSamplesFromFile(const char* filename) {
@ -39,9 +43,24 @@ AudioInjector* AudioInjectionManager::injectorWithCapacity(int capacity) {
return NULL;
}
void AudioInjectionManager::setDestinationSocket(sockaddr& destinationSocket) {
_destinationSocket = destinationSocket;
_isDestinationSocketExplicit = true;
}
void* AudioInjectionManager::injectAudioViaThread(void* 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);
// if this an injector inside the injection manager's array we're responsible for deletion

View file

@ -24,12 +24,13 @@ public:
static void threadInjector(AudioInjector* injector);
static void setInjectorSocket(UDPSocket* injectorSocket) { _injectorSocket = injectorSocket;}
static void setDestinationSocket(sockaddr& destinationSocket) { _destinationSocket = destinationSocket; }
static void setDestinationSocket(sockaddr& destinationSocket);
private:
static void* injectAudioViaThread(void* args);
static UDPSocket* _injectorSocket;
static sockaddr _destinationSocket;
static bool _isDestinationSocketExplicit;
static AudioInjector* _injectors[MAX_CONCURRENT_INJECTORS];
};

View file

@ -33,6 +33,34 @@ int unpackFloatAngleFromTwoByte(uint16_t* byteAnglePointer, float* destinationPo
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) {
unsigned char* bufferStart = destinationBuffer;

View file

@ -67,10 +67,8 @@ public:
// Body Rotation
float getBodyYaw() const { return _bodyYaw; }
void setBodyYaw(float bodyYaw) { _bodyYaw = bodyYaw; }
float getBodyPitch() const { return _bodyPitch; }
void setBodyPitch(float bodyPitch) { _bodyPitch = bodyPitch; }
float getBodyRoll() const {return _bodyRoll; }
void setBodyRoll(float bodyRoll) { _bodyRoll = bodyRoll; }
@ -139,7 +137,7 @@ protected:
// privatize the copy constructor and assignment operator so they cannot be called
AvatarData(const AvatarData&);
AvatarData& operator= (const AvatarData&);
glm::vec3 _position;
glm::vec3 _handPosition;
glm::vec3 _lookatPosition;

View file

@ -10,6 +10,7 @@
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include "AgentList.h"
#include "AgentTypes.h"
#include "PacketHeaders.h"