Skip to content

Commit

Permalink
Change the default ASIO buffer size from 20 ms to 40 ms.
Browse files Browse the repository at this point in the history
DirectSound is unable to achieve a read cursor granularity lower
than ~30 ms on the input side, which means the default 20 ms buffer
size simply cannot work properly with the default backend.

Fixes #29 #30.
  • Loading branch information
dechamps committed Dec 6, 2018
1 parent 8eb53c8 commit 1f50263
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ bufferSizeSamples = 480 # 10 ms at 48 kHz
```

The default behaviour is to advertise minimum, preferred and maximum buffer
sizes of 1 ms, 20 ms and 1 s, respectively. The resulting sizes in samples are
sizes of 1 ms, 40 ms and 1 s, respectively. The resulting sizes in samples are
computed based on whatever sample rate the driver is set to when the application
enquires.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The default settings are as follows:
- DirectSound [backend][BACKENDS]
- Uses the Windows default recording and playback audio devices
- 32-bit float sample type
- 20 ms "preferred" buffer size
- 40 ms "preferred" buffer size

All of the above can be customized using a [configuration file][CONFIGURATION].

Expand Down
2 changes: 1 addition & 1 deletion src/FlexASIO/flexasio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ namespace flexasio {
Log() << "Calculating default buffer size based on " << sampleRate << " Hz sample rate";
*minSize = long(sampleRate * 0.001); // 1 ms, there's basically no chance we'll get glitch-free streaming below this
*maxSize = long(sampleRate); // 1 second, more would be silly
*preferredSize = long(sampleRate * 0.02); // typical - 20 ms
*preferredSize = long(sampleRate * 0.04); // 40 ms - see https://github.com/dechamps/FlexASIO/issues/29
*granularity = 1; // Don't care
}
Log() << "Returning: min buffer size " << *minSize << ", max buffer size " << *maxSize << ", preferred buffer size " << *preferredSize << ", granularity " << *granularity;
Expand Down

0 comments on commit 1f50263

Please sign in to comment.