jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.9KB

  1. /*
  2. Copyright (C) 2001 Paul Davis
  3. Copyright (C) 2004-2008 Grame
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. JackEngine.cpp
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. */
  17. #ifdef WIN32
  18. #pragma warning (disable : 4786)
  19. #endif
  20. #include "JackFreewheelDriver.h"
  21. #include "JackEngineControl.h"
  22. #include "JackEngine.h"
  23. namespace Jack
  24. {
  25. int JackFreewheelDriver::Process()
  26. {
  27. if (fIsMaster) {
  28. jack_log("JackFreewheelDriver::Process master %lld", fEngineControl->fTimeOutUsecs);
  29. fLastWaitUst = GetMicroSeconds();
  30. fEngine->Process(fLastWaitUst);
  31. fGraphManager->ResumeRefNum(fClientControl, fSynchroTable); // Signal all clients
  32. if (fGraphManager->SuspendRefNum(fClientControl, fSynchroTable, 10 * 1000000) < 0) // Wait for all clients to finish for 10 sec
  33. jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error");
  34. } else {
  35. fGraphManager->ResumeRefNum(fClientControl, fSynchroTable); // Signal all clients
  36. if (fEngineControl->fSyncMode) {
  37. if (fGraphManager->SuspendRefNum(fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0) {
  38. jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error");
  39. return -1;
  40. }
  41. }
  42. }
  43. return 0;
  44. }
  45. } // end of namespace