# HG changeset patch # User Giulio Moro # Date 1455382539 0 # Node ID 46bd63a509332389222cf1327b1bfc49a8ab8306 # Parent 0183185cab1bd2c42cbcacca470c7dbf16ea264d Fixed initialization of writePointer diff -r 0183185cab1b -r 46bd63a50933 core/NetworkSend.cpp --- a/core/NetworkSend.cpp Sat Feb 13 15:55:33 2016 +0000 +++ b/core/NetworkSend.cpp Sat Feb 13 16:55:39 2016 +0000 @@ -100,7 +100,9 @@ objAddrs.push_back(this);//TODO: this line should be in the constructor, but something weird happens if // an instance of NetworkSend is then declared globally: the constructor gets called, // and objAddrs.size()==1 but when you get to setup, objAddrs.size() has reverted back to 0, without - // any destructor being called in between ... + // any destructor being called in between ... Have a look here + // http://stackoverflow.com/questions/7542054/global-vector-emptying-itself-between-calls . + // and maybe use accessor function instead of global, as was done in #1374 #endif /* USE_JUCE */ cleanup(); int numSamples=blockSize*4>4*channel.bufferLength ? blockSize*4 : 4*channel.bufferLength; @@ -122,7 +124,7 @@ } if(channel.readyToBeSent==NULL || channel.doneOnTime==NULL) return; - channel.writePointer=0; + channel.writePointer=channel.headerLength; channel.writeBuffer=0; channel.readBuffer=0; setChannelNumber(aChannelNumber); @@ -144,7 +146,7 @@ channel.writeBuffer=0; // printf("WriteBuffer:%d\n", channel.writeBuffer); if(channel.doneOnTime[channel.writeBuffer]==false){ //check if this buffer's last sending has completed on time ... - printf("Network buffer underrun. timestamp: %d :-{\n", + printf("NetworkSend buffer underrun. timestamp: %d :-{\n", (int)channel.buffers[channel.writeBuffer][channel.headerTimestampIndex]); } channel.doneOnTime[channel.writeBuffer]=false; // ... and then reset the flag @@ -185,7 +187,7 @@ void NetworkSend::setChannelNumber(int aChannelNumber){ channel.channelNumber=aChannelNumber; - for(int n=0; n