Without the cast non integer frequencies weren't possible (e.g. with a sampling
frequency of 50Hz we would end up with a signal frequency of 2Hz instead of
2.5Hz). The result were signals which had an incorrect number of samples per
period.
BugLink: http://sigrok.org/bugzilla/show_bug.cgi?id=297
break;
case PATTERN_SINE:
- frequency = sample_rate / ANALOG_SAMPLES_PER_PERIOD;
+ frequency = (double) sample_rate / ANALOG_SAMPLES_PER_PERIOD;
/* Make sure the number of samples we put out is an integer
* multiple of our period size */
break;
case PATTERN_TRIANGLE:
- frequency = sample_rate / ANALOG_SAMPLES_PER_PERIOD;
+ frequency = (double) sample_rate / ANALOG_SAMPLES_PER_PERIOD;
while (num_samples % ANALOG_SAMPLES_PER_PERIOD != 0)
num_samples--;
break;
case PATTERN_SAWTOOTH:
- frequency = sample_rate / ANALOG_SAMPLES_PER_PERIOD;
+ frequency = (double) sample_rate / ANALOG_SAMPLES_PER_PERIOD;
while (num_samples % ANALOG_SAMPLES_PER_PERIOD != 0)
num_samples--;