Merge pull request #1085 from birarda/master

fix UNIX build buster for starfield, audio-mixer crash
This commit is contained in:
Stephen Birarda 2013-10-18 09:40:46 -07:00
commit c59e0f336d
2 changed files with 5 additions and 7 deletions

View file

@ -171,7 +171,8 @@ void AudioMixer::run() {
// loop through all other nodes that have sufficient audio to mix // loop through all other nodes that have sufficient audio to mix
for (NodeList::iterator otherNode = nodeList->begin(); otherNode != nodeList->end(); otherNode++) { for (NodeList::iterator otherNode = nodeList->begin(); otherNode != nodeList->end(); otherNode++) {
if (((PositionalAudioRingBuffer*) otherNode->getLinkedData())->willBeAddedToMix() if (otherNode->getLinkedData()
&& ((PositionalAudioRingBuffer*) otherNode->getLinkedData())->willBeAddedToMix()
&& (otherNode != node || (otherNode == node && nodeRingBuffer->shouldLoopbackForNode()))) { && (otherNode != node || (otherNode == node && nodeRingBuffer->shouldLoopbackForNode()))) {
PositionalAudioRingBuffer* otherNodeBuffer = (PositionalAudioRingBuffer*) otherNode->getLinkedData(); PositionalAudioRingBuffer* otherNodeBuffer = (PositionalAudioRingBuffer*) otherNode->getLinkedData();
// based on our listen mode we will do this mixing... // based on our listen mode we will do this mixing...
@ -339,7 +340,7 @@ void AudioMixer::run() {
} }
memcpy(clientPacket + numBytesPacketHeader, clientSamples, sizeof(clientSamples)); memcpy(clientPacket + numBytesPacketHeader, clientSamples, sizeof(clientSamples));
nodeList->getNodeSocket()->send(node->getPublicSocket(), clientPacket, sizeof(clientPacket)); nodeList->getNodeSocket()->send(node->getActiveSocket(), clientPacket, sizeof(clientPacket));
} }
} }

View file

@ -12,10 +12,10 @@
#include "starfield/Config.h" #include "starfield/Config.h"
namespace starfield { namespace starfield {
const float LOG2 = 1.4426950408889634;
class Tiling { class Tiling {
public: public:
Tiling(unsigned tileResolution) : _tileResolution(tileResolution), _rcpSlice(tileResolution / Radians::twicePi()) { Tiling(unsigned tileResolution) : _tileResolution(tileResolution), _rcpSlice(tileResolution / Radians::twicePi()) {
_nBits = ceil(log(getTileCount()) * LOG2); } _nBits = ceil(log(getTileCount()) * LOG2); }
@ -39,10 +39,7 @@ namespace starfield {
unsigned _tileResolution; unsigned _tileResolution;
float _rcpSlice; float _rcpSlice;
unsigned _nBits; unsigned _nBits;
const float LOG2 = 1.4426950408889634;
}; };
} }
#endif #endif