Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. clock_t t1;
  2. while (audioPeriodCounter * 2 * pocetchannel < pocetoperaci * 5) // nvm proc je tu ta *2, chanely uz jednou pouzivam, idk proc tam je ta *2 a vubec jestli je to *2 nebo * channels
  3. {
  4. t1 = clock();
  5.  
  6. //std::cout << audioPeriodCounter;
  7. ts3Functions.processCustomCaptureData("customWaveDeviceId", buffer + ((captureAudioOffset * pocetchannel) / 5), (freq / 5));
  8.  
  9. //if (captureAudioOffset * pocetchannel / 10 + freq / 10 > maxread) //nvm jestli se podminka vzdy triggerne prvni idk, takto by to tam dole v tsfci nemelo cist dal
  10. //{
  11. //std::cout << "wtf" << captureAudioOffset * pocetchannel + freq << " asdasdasd " << maxread << std::endl;
  12. // std::this_thread::sleep_for(std::chrono::nanoseconds(10000000));
  13. // break;
  14. //}
  15. //std::cout << "FIXED";
  16.  
  17.  
  18.  
  19. audioPeriodCounter++;
  20. captureAudioOffset = audioPeriodCounter*freq;
  21. auto volume = std::thread(lambda, freq, buffer, captureAudioOffset);
  22. volume.detach();
  23. //lambda(freq, buffer, captureAudioOffset);
  24. //std::cout << (float)t2-(float)t1 << std::endl;
  25. //(((double)clock()-t1)/CLOCKS_PER_SEC)
  26. std::unique_lock<std::mutex> lk(stopm);
  27. double hodnota = (((double)clock()-(double)t1)/CLOCKS_PER_SEC)*1000000000;
  28. int number = 200000000 - hodnota;
  29. if (stopcv.wait_for(lk, std::chrono::nanoseconds(number), [] {return stoprequest.load(); }) == true)
  30. {
  31. std::this_thread::sleep_for(std::chrono::nanoseconds(250000000));
  32. break;
  33. }
  34.  
  35.  
  36. //std::this_thread::sleep_for(std::chrono::nanoseconds(200000000));
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement