libsoundio vs PortAudio

Andrew Kelley edited this page Sep 19, 2015 · 13 revisions

Benefits of libsoundio over PortAudio:

  • Supports PulseAudio backend.
  • Supports Dummy backend, guaranteed to work even if computer has no sound card.
  • Built-in support for channel layouts. PortAudio supports channel layouts on some backends with platform-specific extensions.
  • Exposes both device id and friendly name. id you could save in a config file because it persists between devices becoming plugged and unplugged, while friendly name is suitable for exposing to users.
  • Callback function provides frame_count_min and frame_count_max to optimally leverage fixed-buffer backends such as JACK and CoreAudio, as well as flexible buffer backends such as ALSA and PulseAudio.
  • Errors are never dumped to stdio.
  • Ability to provide application and stream names which are used by JACK, PulseAudio, and WASAPI.
  • Meticulously checks all return codes and memory allocations and has a plan for every edge case. Meanwhile, PortAudio is a mess.
  • Ability to monitor devices and get an event when available devices change.
  • Ability to get an event when the backend is disconnected, for example when the JACK server or PulseAudio server shuts down.
  • In the documentation, every function that can return an error documents what error codes it can possibly return.
  • Written by a single person who has carefully read the documentation for every audio backend and understands the purpose of every line of code.

Benefits of PortAudio over libsoundio:

  • Supports ASIO backend. (See #23)
  • Supports DirectSound. Note that on Windows Vista and higher, DirectSound is an API wrapper that uses WASAPI under the hood.
  • Supports OSS, asihpi, wdmks, wmme. You are invited to file an issue if support for one of these backends would be beneficial to your use case.
  • Supports older versions of Windows than Windows 7.
  • Ability to open a stream simultaneously for input and output. (See #27)
  • Written by many people; the "hit by a bus factor" is higher.