Simplify init function, add defaults for latency offset and buffer size. Remove redundant timer stuff from audio_dummy.c.

This commit is contained in:
Mke Brady
2015-06-01 21:38:56 +01:00
parent e91cddabed
commit 54250f7552
5 changed files with 22 additions and 23 deletions
+3 -17
View File
@@ -32,7 +32,7 @@
int Fs;
long long starttime, samples_played;
static int init(int argc, char **argv, config_t *cfgp) {
static int init(int argc, char **argv) {
return 0;
}
@@ -43,28 +43,14 @@ static void start(int sample_rate) {
Fs = sample_rate;
starttime = 0;
samples_played = 0;
printf("dummy audio output started at Fs=%d Hz\n", sample_rate);
debug(1,"dummy audio output started at Fs=%d Hz\n", sample_rate);
}
static void play(short buf[], int samples) {
struct timeval tv;
// this is all a bit expensive but it's long-term stable.
gettimeofday(&tv, NULL);
long long nowtime = tv.tv_usec + 1e6*tv.tv_sec;
if (!starttime)
starttime = nowtime;
samples_played += samples;
long long finishtime = starttime + samples_played * 1e6 / Fs;
usleep(finishtime - nowtime);
}
static void stop(void) {
printf("dummy audio stopped\n");
debug(1,"dummy audio stopped\n");
}
static void help(void) {