Use Glib::usleep in DummyAudioBackend rather than ::usleep
This commit is contained in:
parent
b565357bf4
commit
6bf8249b4b
@ -20,6 +20,8 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
|
|
||||||
|
#include <glibmm.h>
|
||||||
|
|
||||||
#include "dummy_audiobackend.h"
|
#include "dummy_audiobackend.h"
|
||||||
#include "pbd/error.h"
|
#include "pbd/error.h"
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
@ -302,7 +304,7 @@ DummyAudioBackend::_start (bool /*for_latency_measurement*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int timeout = 5000;
|
int timeout = 5000;
|
||||||
while (!_running && --timeout > 0) { usleep (1000); }
|
while (!_running && --timeout > 0) { Glib::usleep (1000); }
|
||||||
|
|
||||||
if (timeout == 0 || !_running) {
|
if (timeout == 0 || !_running) {
|
||||||
PBD::error << _("DummyAudioBackend: failed to start process thread.") << endmsg;
|
PBD::error << _("DummyAudioBackend: failed to start process thread.") << endmsg;
|
||||||
@ -992,13 +994,13 @@ DummyAudioBackend::main_process_thread ()
|
|||||||
const int nomial_time = 1000000 * _samples_per_period / _samplerate;
|
const int nomial_time = 1000000 * _samples_per_period / _samplerate;
|
||||||
_dsp_load = elapsed_time / (float) nomial_time;
|
_dsp_load = elapsed_time / (float) nomial_time;
|
||||||
if (elapsed_time < nomial_time) {
|
if (elapsed_time < nomial_time) {
|
||||||
::usleep (nomial_time - elapsed_time);
|
Glib::usleep (nomial_time - elapsed_time);
|
||||||
} else {
|
} else {
|
||||||
::usleep (100); // don't hog cpu
|
Glib::usleep (100); // don't hog cpu
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_dsp_load = 1.0;
|
_dsp_load = 1.0;
|
||||||
::usleep (100); // don't hog cpu
|
Glib::usleep (100); // don't hog cpu
|
||||||
}
|
}
|
||||||
::gettimeofday (&clock1, NULL);
|
::gettimeofday (&clock1, NULL);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user