giuliomoro@111: //scope.cpp giuliomoro@112: #include giuliomoro@111: giuliomoro@111: #define BUILD_FOR_UDPRECEIVE_PLUGIN giuliomoro@111: #define NETWORK_AUDIO_BUFFER_SIZE 302 giuliomoro@111: giuliomoro@111: //initialize the static members of NetworkSend giuliomoro@111: bool NetworkSend::staticConstructed=false; giuliomoro@111: std::vector NetworkSend::objAddrs(0); giuliomoro@116: AuxiliaryTask NetworkSend::sendDataTask=NULL; giuliomoro@111: giuliomoro@111: void transmitAudio(){ giuliomoro@111: NetworkSend::sendAllData(); giuliomoro@111: } giuliomoro@111: giuliomoro@111: void NetworkSend::sendAllData(){ giuliomoro@111: for(unsigned int n=0; nsendData(); giuliomoro@111: } giuliomoro@111: } giuliomoro@111: giuliomoro@111: void NetworkSend::staticConstructor(){ giuliomoro@111: if(staticConstructed==true) giuliomoro@111: return; giuliomoro@111: staticConstructed=true; giuliomoro@116: sendDataTask = BeagleRT_createAuxiliaryTask(transmitAudio, 95, "sendDataTask"); //TODO: allow variable priority giuliomoro@111: }; giuliomoro@111: giuliomoro@111: NetworkSend::NetworkSend() giuliomoro@111: { giuliomoro@111: sampleCount = 0; giuliomoro@111: channel.doneOnTime=true; giuliomoro@111: channel.index=channel.headerLength; //leave space for the heading message (channel, timestamp) giuliomoro@111: channel.activeBuffer=0; giuliomoro@111: channel.readyToBeSent=false; giuliomoro@111: } giuliomoro@116: giuliomoro@111: NetworkSend::~NetworkSend(){ giuliomoro@111: for(unsigned int n=0; n=getNumChannels()) //TODO: assert this giuliomoro@111: return; giuliomoro@111: channels[channel].log(value); giuliomoro@111: } giuliomoro@111: giuliomoro@111: void Scope::setup(){ giuliomoro@111: setup(44100, 9999, "127.0.0.1"); giuliomoro@111: } giuliomoro@111: giuliomoro@111: void Scope::setup(float sampleRate, int aPort, const char* aServer){ giuliomoro@111: for(int n=0; n