Commit Graph

4598 Commits

Author SHA1 Message Date
David Reid 3debb4a20f ALSA: Add some missing snd_pcm_state_t values. 2026-01-11 07:23:14 +10:00
David Reid c4c484794b ALSA: Add a timeout to poll().
I don't trust there won't be edge cases that result in this getting
stuck forever.
2026-01-11 07:22:44 +10:00
David Reid adce75cba6 Show device IDs in the deviceio test. 2026-01-11 07:06:23 +10:00
David Reid 660d5f6f9e ASLA: Fall back to NAME for the device description when DESC is empty. 2026-01-10 13:39:59 +10:00
David Reid 96c4b105b0 ALSA: Use more descriptive error messages. 2026-01-10 13:07:10 +10:00
David Reid 9a4318997b ALSA: Whitespace.
This was off by one space and it was annoying me!
2026-01-10 12:45:30 +10:00
David Reid 280c118dfd ALSA: Try improving native channel count detection heuristics. 2026-01-10 12:41:19 +10:00
David Reid 999c16d834 Merge branch 'dev' into dev-0.12 2026-01-10 12:14:40 +10:00
David Reid 88776cedb7 Whitespace. 2026-01-10 08:49:12 +10:00
spevnev e00cee2af1 Cast tv_sec to 64-bit int before converting 2026-01-10 08:47:03 +10:00
David Reid 760765ec93 ALSA: Use SND_PCM_NONBLOCK when enumerating devices. 2026-01-10 08:10:21 +10:00
David Reid fb132046d4 Add command line switches for periods and period sizes to deviceio test. 2026-01-09 19:21:24 +10:00
David Reid 4bed03a65e Fix a bug in ma_prev_power_of_2(). 2026-01-09 18:51:02 +10:00
David Reid e9eccf49a3 ALSA: Improvements buffer size negotiation.
This makes it so period sizes are a power of 2, which in turns makes it
so the value set by `snd_pcm_sw_params_set_avail_min()` is also a power
of 2. This is inline with a suggestion by the ALSA documentation, and
seems to have an actual positive impact in practice with my testing as
well.
2026-01-09 15:37:05 +10:00
David Reid 46adfae3bb Update the deviceio test with a few more command line switches. 2026-01-09 13:38:49 +10:00
David Reid 948967dcbb ALSA: Change to device enumeration.
In order to get detailed information about a device, that is supported
formats, channels and sample rates, the PCM needs to be opened. This
can fail sometimes, in which case enumeration would previously just not
enumerate the device.

This is OK, but it creates issues. The first is that the enumerated
devices will not be consistent with what's reported by `aplay`. The
other is that when a hardware device is opened, iteration will not
include that device because it'll be opened in exclusive mode. This
creates a practical issue when trying to get the name of an already
opened device.

This commit makes it so that these devices will still be enumerated,
only they'll be missing detailed format, channels and rate information.
2026-01-09 13:38:07 +10:00
David Reid 224a4c9d3a ALSA: Fix a crash when failing to initialize a device. 2026-01-09 13:24:32 +10:00
David Reid 4e28636ed8 Update deviceio test to allow explicit channel count selection. 2026-01-09 13:23:27 +10:00
David Reid 25dcbcb9cd ALSA: Changes to start/stop behaviour for playback devices.
* A start threshold is no longer used meaning an explicit call to
  snd_pcm_start() is required, which was happening already anyway.

* The stop threshold is no longer used.

* Stopping the playback side of device now drains it.

* Starting a device will now pre-fill the playback side with silence
  before starting it which should hopefully avoid an immediate xrun.
2026-01-09 12:55:03 +10:00
David Reid e1058d1eea ALSA: Simplify device enumeration.
This removes the old useVerboseDeviceEnumeration context config option.
2026-01-09 06:17:44 +10:00
David Reid 0b4a861d94 ALSA: Experiment with snd_pcm_link(). 2026-01-08 17:41:58 +10:00
David Reid 597654dcf6 Refactoring to the ALSA backend.
This is intended to address the following issues:

  - Stepping the device now correctly polls both the capture and
    playback side in one call in duplex mode. Prior to this commit it
    would wait separately for each side which was totally incorrect.

  - The initialization process has been simplified and made more robust
    when trying to initialize the default device.

More work still to be done.
2026-01-08 17:20:00 +10:00
David Reid 0129fa3b2a ALSA: Fix a bug where a default device is not detected properly. 2026-01-08 10:52:37 +10:00
David Reid e4a6c348d5 ALSA: Try making channel selection a bit more robust.
Public issues
https://github.com/mackron/miniaudio/issues/775
https://github.com/mackron/miniaudio/issues/945
2026-01-08 09:56:40 +10:00
David Reid 01fe5fe416 Merge branch 'dev' into dev-0.12 2026-01-07 18:20:48 +10:00
David Reid 5ef2e1ec57 Update fs. 2026-01-07 18:19:59 +10:00
David Reid ee8a65bed9 Update dr_libs. 2026-01-07 18:13:08 +10:00
David Reid 44b847fbf8 Update fs. 2026-01-07 18:10:39 +10:00
David Reid ca6361db5e PipeWire: Fix a bug with channel map negotiation. 2026-01-07 16:57:31 +10:00
David Reid 3b0391ad44 Silence an assigned-but-not-used warning. 2026-01-07 16:43:49 +10:00
David Reid 61f1f8b457 Tighten up ma_context_get_backend_info(). 2026-01-07 16:37:59 +10:00
David Reid 5095548174 Merge branch 'dev' into dev-0.12 2026-01-07 15:37:03 +10:00
David Reid 5f3de510b2 Make ma_is_spatial_channel_position() a bit more robust.
This makes it less error prone when new channel positions are added to
the enum.
2026-01-07 12:36:18 +10:00
David Reid 53116ad6da Minor change to an enum to make it less error prone. 2026-01-07 12:31:03 +10:00
David Reid b83869eb09 Update the spatializer to require a listener when processing. 2026-01-07 12:24:30 +10:00
David Reid bedfd053cb Fix a bug in the gainer where a null pointer can be offset. 2026-01-07 12:13:18 +10:00
David Reid 32cc6d53cd Fix a possible null pointer dereference. 2026-01-07 12:08:20 +10:00
David Reid bd26454c26 Fix a possible null pointer dereference. 2026-01-07 12:07:25 +10:00
David Reid d791c16d8d Remove some redundant error checks. 2026-01-07 12:05:57 +10:00
David Reid 86d5f669e4 PipeWire: Comment out an unused function. 2026-01-07 11:10:21 +10:00
David Reid 4d9a66289d Merge branch 'dev' into dev-0.12 2026-01-07 10:33:30 +10:00
David Reid 8c4535c6c5 Fix a bug with sound node processing. 2026-01-07 10:33:13 +10:00
David Reid 4bd8eb0aa0 WASAPI: Handle AUDCLNT_E_DEVICE_INVALIDATED.
When this is detected the device will be reinitialized. If this fails
the device will be put into an errored state and will become unusable.
2026-01-07 10:23:39 +10:00
David Reid 882d7329f9 Add getter functions for backend vtables. 2026-01-07 09:22:43 +10:00
David Reid fd74d344c7 Merge branch 'dev' into dev-0.12 2026-01-06 19:32:41 +10:00
David Reid 27d2d6ac87 Add support for custom resamplers to sounds.
Public issue https://github.com/mackron/miniaudio/issues/965
2026-01-06 19:25:32 +10:00
David Reid 919a01ae4a Use ma_resampler instead of ma_linear_resampler for sound nodes.
This is infrastructure work for supporting custom resamplers for the
pitching and Doppler effects for sounds.

Public issue https://github.com/mackron/miniaudio/issues/965
2026-01-06 18:37:05 +10:00
David Reid 065e6eadb5 Minor code rearrangement. 2026-01-06 18:18:16 +10:00
caturria 962d11b4ce Resource manager can now have a custom resampler. 2026-01-06 18:13:57 +10:00
David Reid 5f3fc86f89 Merge branch 'dev' into dev-0.12 2026-01-06 16:29:55 +10:00