WASAPI: get period duration for raw devices

This commit is contained in:
Andrew Kelley 2015-08-13 10:18:27 -07:00
parent 9a06d22608
commit e82c3e89da
3 changed files with 11 additions and 6 deletions

View file

@ -251,8 +251,6 @@ view `coverage/index.html` in a browser.
0. implement WASAPI (Windows) backend, get examples working
- list devices
- raw mode
- period duration
- watching
- sine wave
- microphone

View file

@ -364,9 +364,12 @@ struct SoundIoDevice {
double buffer_duration_current;
// Period duration in seconds. After this much time passes, write_callback
// is called. If values are unknown, they are set to 0.0. These values are
// meaningless for PulseAudio and CoreAudio. For JACK, buffer duration and
// period duration are the same.
// is called. If values are unknown, they are set to 0.0.
// For PulseAudio and CoreAudio, these values are meaningless.
// For JACK, buffer duration and period duration are the same.
// For WASAPI, `period_duration_max` is unknown for raw devices, so a
// reasonable max of 4.0 is used. You may check that the current backend is
// WASAPI and ignore the max value for raw devices.
double period_duration_min;
double period_duration_max;
double period_duration_current;

View file

@ -650,7 +650,11 @@ static int refresh_devices(SoundIoPrivate *si) {
return SoundIoErrorOpeningDevice;
}
rd.device_shared->period_duration_current = from_reference_time(default_device_period);
rd.device_shared->period_duration_min = from_reference_time(min_device_period);
rd.device_shared->period_duration_min = rd.device_shared->period_duration_current;
rd.device_shared->period_duration_max = rd.device_shared->period_duration_current;
rd.device_raw->period_duration_min = from_reference_time(min_device_period);
rd.device_raw->period_duration_max = 4.0;
if (rd.endpoint)