X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fdemo%2Fdemo.c;h=26887c44b245be7af45b6ee2ada7a49400604d73;hb=bbc42811d0c29e37e449d38d897b8e9cecdc8ba3;hp=36ead58901d517e8ed3fa306008d5e82966a4af4;hpb=8249889dfa871a45d57a6f513d4a1a5751673558;p=libsigrok.git diff --git a/src/hardware/demo/demo.c b/src/hardware/demo/demo.c index 36ead589..26887c44 100644 --- a/src/hardware/demo/demo.c +++ b/src/hardware/demo/demo.c @@ -218,14 +218,14 @@ static void generate_analog_pattern(struct analog_gen *ag, uint64_t sample_rate) /* Make sure the number of samples we put out is an integer * multiple of our period size */ /* FIXME we actually need only one period. A ringbuffer would be - * usefull here.*/ + * useful here. */ while (num_samples % ANALOG_SAMPLES_PER_PERIOD != 0) num_samples--; for (i = 0; i < num_samples; i++) { t = (double) i / (double) sample_rate; ag->pattern_data[i] = ag->amplitude * - sin(2 * M_PI * frequency * t); + sin(2 * G_PI * frequency * t); } ag->num_samples = num_samples; @@ -238,8 +238,8 @@ static void generate_analog_pattern(struct analog_gen *ag, uint64_t sample_rate) for (i = 0; i < num_samples; i++) { t = (double) i / (double) sample_rate; - ag->pattern_data[i] = (2 * ag->amplitude / M_PI) * - asin(sin(2 * M_PI * frequency * t)); + ag->pattern_data[i] = (2 * ag->amplitude / G_PI) * + asin(sin(2 * G_PI * frequency * t)); } ag->num_samples = num_samples; @@ -757,7 +757,7 @@ static int prepare_data(int fd, int revents, void *cb_data) /* How many samples should we have sent by now? */ time = g_get_monotonic_time(); elapsed = time - devc->starttime; - expected_samplenum = elapsed * devc->cur_samplerate / 1000000; + expected_samplenum = elapsed * devc->cur_samplerate / (1000 * 1000); /* But never more than the limit, if there is one. */ if (!devc->continuous)