mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-10 15:19:21 +02:00
rewrite the AudioInjector to send an orientation quaternion instead of bearing
This commit is contained in:
parent
cd79339670
commit
7d3d8f8b43
4 changed files with 13 additions and 13 deletions
|
@ -207,7 +207,7 @@ int main(int argc, const char* argv[]) {
|
|||
glm::normalize(rotatedListenerPosition));
|
||||
|
||||
offAxisCoefficient = MAX_OFF_AXIS_ATTENUATION
|
||||
+ (OFF_AXIS_ATTENUATION_FORMULA_STEP * (fabsf(angleOfDelivery) / 90.0f));
|
||||
+ (OFF_AXIS_ATTENUATION_FORMULA_STEP * (angleOfDelivery / 90.0f));
|
||||
|
||||
float sinRatio = fabsf(sinf(glm::radians(bearingRelativeAngleToSource)));
|
||||
numSamplesDelay = PHASE_DELAY_AT_90 * sinRatio;
|
||||
|
|
|
@ -2353,7 +2353,7 @@ void Application::maybeEditVoxelUnderCursor() {
|
|||
AudioInjector* voxelInjector = AudioInjectionManager::injectorWithCapacity(11025);
|
||||
voxelInjector->setPosition(glm::vec3(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z));
|
||||
//_myAvatar.getPosition()
|
||||
voxelInjector->setBearing(-1 * _myAvatar.getAbsoluteHeadYaw());
|
||||
// voxelInjector->setBearing(-1 * _myAvatar.getAbsoluteHeadYaw());
|
||||
voxelInjector->setVolume (16 * pow (_mouseVoxel.s, 2) / .0000001); //255 is max, and also default value
|
||||
|
||||
/* for (int i = 0; i
|
||||
|
@ -2416,7 +2416,7 @@ void Application::deleteVoxelUnderCursor() {
|
|||
sendVoxelEditMessage(PACKET_HEADER_ERASE_VOXEL, _mouseVoxel);
|
||||
AudioInjector* voxelInjector = AudioInjectionManager::injectorWithCapacity(5000);
|
||||
voxelInjector->setPosition(glm::vec3(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z));
|
||||
voxelInjector->setBearing(0); //straight down the z axis
|
||||
// voxelInjector->setBearing(0); //straight down the z axis
|
||||
voxelInjector->setVolume (255); //255 is max, and also default value
|
||||
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
const int MAX_INJECTOR_VOLUME = 0xFF;
|
||||
|
||||
AudioInjector::AudioInjector(const char* filename) :
|
||||
_position(),
|
||||
_position(0.0f, 0.0f, 0.0f),
|
||||
_orientation(0.0f, 0.0f, 0.0f, 0.0f),
|
||||
_radius(0.0f),
|
||||
_bearing(0),
|
||||
_volume(MAX_INJECTOR_VOLUME),
|
||||
_indexOfNextSlot(0),
|
||||
_isInjectingAudio(false)
|
||||
|
@ -48,9 +48,9 @@ AudioInjector::AudioInjector(const char* filename) :
|
|||
|
||||
AudioInjector::AudioInjector(int maxNumSamples) :
|
||||
_numTotalSamples(maxNumSamples),
|
||||
_position(),
|
||||
_position(0.0f, 0.0f, 0.0f),
|
||||
_orientation(0.0f, 0.0f, 0.0f, 0.0f),
|
||||
_radius(0.0f),
|
||||
_bearing(0),
|
||||
_volume(MAX_INJECTOR_VOLUME),
|
||||
_indexOfNextSlot(0),
|
||||
_isInjectingAudio(false)
|
||||
|
@ -73,7 +73,7 @@ void AudioInjector::injectAudio(UDPSocket* injectorSocket, sockaddr* destination
|
|||
|
||||
// calculate the number of bytes required for additional data
|
||||
int leadingBytes = sizeof(PACKET_HEADER) + sizeof(INJECT_AUDIO_AT_POINT_COMMAND) + sizeof(_streamIdentifier)
|
||||
+ sizeof(_position) + sizeof(_bearing) + sizeof(_volume);
|
||||
+ sizeof(_position) + sizeof(_orientation) + sizeof(_volume);
|
||||
|
||||
if (_radius > 0) {
|
||||
// we'll need 4 extra bytes if the cube side length is being sent as well
|
||||
|
@ -104,8 +104,8 @@ void AudioInjector::injectAudio(UDPSocket* injectorSocket, sockaddr* destination
|
|||
*currentPacketPtr = _volume;
|
||||
currentPacketPtr++;
|
||||
|
||||
memcpy(currentPacketPtr, &_bearing, sizeof(_bearing));
|
||||
currentPacketPtr += sizeof(_bearing);
|
||||
memcpy(currentPacketPtr, &_orientation, sizeof(_orientation));
|
||||
currentPacketPtr += sizeof(_orientation);
|
||||
|
||||
gettimeofday(&startTime, NULL);
|
||||
int nextFrame = 0;
|
||||
|
|
|
@ -36,8 +36,8 @@ public:
|
|||
const glm::vec3& getPosition() const { return _position; }
|
||||
void setPosition(const glm::vec3& position) { _position = position; }
|
||||
|
||||
float getBearing() const { return _bearing; }
|
||||
void setBearing(float bearing) { _bearing = bearing; }
|
||||
const glm::quat& getOrientation() const { return _orientation; }
|
||||
void setOperation(const glm::quat& orientation) { _orientation = orientation; }
|
||||
|
||||
float getRadius() const { return _radius; }
|
||||
void setRadius(float radius) { _radius = radius; }
|
||||
|
@ -49,8 +49,8 @@ private:
|
|||
int16_t* _audioSampleArray;
|
||||
int _numTotalSamples;
|
||||
glm::vec3 _position;
|
||||
glm::quat _orientation;
|
||||
float _radius;
|
||||
float _bearing;
|
||||
unsigned char _volume;
|
||||
int _indexOfNextSlot;
|
||||
bool _isInjectingAudio;
|
||||
|
|
Loading…
Reference in a new issue