View Single Post
Old Feb 9th, 2008, 9:26 PM   #16
Brent
Highly Adaptive Penguin
 
Brent's Avatar
 
Join Date: May 2005
Location: United States
Posts: 252
Rep Power: 4 Brent is on a distinguished road
Re: Streaming Audio over network

Ok so this is what your saying Dark:

I create two variables, lets say StartIndex and EndIndex, and every time I add a buffer to the queue I increment these values. So it might look something like this:


c++ Syntax (Toggle Plain Text)
  1.  
  2. int StartIndex, EndIndex;
  3.  
  4. DWORD WINAPI FillOutput(LPVOID lpParameter)
  5. {
  6. char data[BUFFERSIZE];
  7. int addrlen=sizeof(sin),a;
  8.  
  9. while(threadEnd == false)
  10. {
  11. if(StartIndex <= MAX_BUFFERS && EndIndex <= MAX_BUFFERS)
  12. {
  13. for(a=0; a<=(MAX_BUFFERS-Out); a++)
  14. {
  15. recvfrom(client,data,sizeof(data),0,(struct sockaddr*)&sin,&addrlen);
  16. strcpy(OutQueue[a].data,data);
  17. Out++;
  18. }
  19. StartIndex++;
  20. EndIndex++;
  21. }
  22. }
  23.  
  24. return 0;
  25. }
Brent is offline   Reply With Quote