Guest User

Untitled

a guest
Nov 16th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. // Decode an chunk of samples from the queue
  2. void decoder::decode2(std::vector<short> &samples)
  3. {
  4. decoder::status = state::working;
  5.  
  6. // decode
  7. //std::cout << "[DECODER] Decoding [" << samples.size() << "] samples...\n\n";
  8.  
  9. // compile goertzelArray for all DTMF frequencies
  10. auto goertzelArray = processor::goertzelArray(samples);
  11.  
  12. // check if thresholdBroken goes from true to false
  13. if (true && false)
  14. {
  15. // extract indexes (row & column) of most prominent frequencies of previousGoertzel
  16. auto indexes = decoder::extractIndexes(goertzelArray);
  17.  
  18. // convert indexes to DTMF toneID
  19. auto toneID = decoder::extractToneID(indexes);
  20.  
  21. // callback
  22. if (toneID >= 0)
  23. {
  24. callback(toneID);
  25. }
  26. }
  27.  
  28. decoder::status = state::running;
  29. }
Add Comment
Please, Sign In to add comment