Commit Graph

2319 Commits

Author SHA1 Message Date
David Reid d46e19fb47 PulseAudio: Attempt to fix a deadlock.
Public issues
  https://github.com/mackron/miniaudio/issues/877
  https://github.com/mackron/miniaudio/issues/881
2024-08-05 09:21:23 +10:00
David Reid dc423daa41 Silence some GCC warnings.
This is from c89atomic which has been fixed upstream.
2024-08-04 09:08:27 +10:00
David Reid 5d827878f2 Rename a variable for consistency. 2024-08-04 08:35:05 +10:00
Timo Schwarzer d87230b4bd Allow setting the channel map that is requested from PulseAudio 2024-08-04 08:35:05 +10:00
raduetsya e1328d9d8a Fix an always-false warning 2024-07-27 10:51:44 +10:00
David Reid 8036ac3781 WASAPI: Fix a crash when changing devices. 2024-07-14 07:16:43 +10:00
Matthieu Bouron fc45d8ca06 AAudio: Fix ma_device_get_info() implementation 2024-06-08 12:51:59 +10:00
David Reid 1c15cf6502 WASAPI: Fix a regression where incorrect device info is retrieved. 2024-05-14 07:48:53 +10:00
David Reid 196289592a WASAPI: Fix a bug with loopback device info retrieval. 2024-05-12 08:40:19 +10:00
David Reid 1b35118e31 AAudio: Potential fix for a failed assertion.
Public issue https://github.com/mackron/miniaudio/issues/833
2024-04-29 08:52:12 +10:00
RainRat 88436b25ef Update miniaudio.h
fix typos
2024-04-28 15:17:11 +10:00
David Reid afb121e2ce Update c89atomic. 2024-04-28 15:12:08 +10:00
David Reid 855628f15f Update dr_wav. 2024-04-28 14:55:42 +10:00
David Reid 9091cbd016 Core Audio: Try fixing a compilation error.
Public issue https://github.com/mackron/miniaudio/issues/841
2024-04-28 13:58:11 +10:00
David Reid e82703482b Fix a minor declaration inconsistency. 2024-04-28 12:59:52 +10:00
Sergey Fedorov 6700c7ecc7 miniaudio.h: fix for macOS 2024-04-26 07:23:10 +10:00
RainRat 3ba0595c6a fix typos 2024-04-11 12:40:39 +10:00
David Reid f7ad7772d1 ALSA: Try making the handling of poll() a bit more robust.
Public issue https://github.com/mackron/miniaudio/issues/836.
2024-04-07 14:38:09 +10:00
David Reid f760d05c51 API CHANGE: Rename a variable.
This renames `defaultVolumeSmoothTimeInPCMFrames` in `ma_engine_config`
to `defaultVolumeSmoothTimeInFrames` in order to make it consistent
with other variables in the same structure.
2024-03-01 10:56:28 +10:00
David Reid ff9225a878 API CHANGE: Rename a variable.
This renames `gainSmoothTimeInFrames` in `ma_engine_config` to
`spatializationVolumeSmoothTimeInFrames` in order to make it more clear
that it specifically affects spatialization.
2024-03-01 10:49:40 +10:00
David Reid 2c59b302e5 Merge branch 'dev' into dev-0.12 2024-03-01 10:13:29 +10:00
David Reid 0eb86ea1da Fix a bug where sounds loaded with MA_SOUND_FLAG_DECODE do not loop. 2024-03-01 09:59:44 +10:00
David Reid 0262d89ea9 Changes to ma_audio_buffer_ref and ma_audio_buffer.
This updates read_pcm_frames() to return a result code, and to output
the number of frames read through an output parameter.
2024-03-01 09:36:17 +10:00
David Reid 5a0d1ad433 Merge branch 'dev' into dev-0.12 2024-03-01 08:37:16 +10:00
RainRat 030b9554c2 fix typos 2024-03-01 08:35:45 +10:00
David Reid c0be89b016 Remove a deprecated config variable.
This removes `isLooping` from these configs:

  * ma_sound_config
  * ma_resource_manager_data_source_config

The new way to set the initial looping state for these objects is to
use a flag:

  * MA_SOUND_FLAG_LOOPING or
  * MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_LOOPING

The motivation for this change is that it allows the initial looping
state to be set without needing `ma_sound_init_ex()` and
`ma_sound_config`.
2024-03-01 08:33:24 +10:00
David Reid 7c90311f5d Fix some const errors and add ma_decoder_get_encoding_format(). 2024-03-01 07:57:13 +10:00
David Reid 61ec4b17c6 Update docs and add support for backend-specific userdata for decoders. 2024-03-01 07:06:54 +10:00
David Reid 2eb6f4eda2 Clean up. 2024-02-29 21:13:45 +10:00
David Reid 4fc86eb190 Add helper functions for retrieving encoding format from an extension.
This adds the following functions:

  * ma_encoding_format_from_path()
  * ma_encoding_format_from_path_w()

You can use these to pass into ma_decoder_config to skip over decoding
backends that don't support the given file extension.
2024-02-29 21:07:35 +10:00
David Reid ff0a53fa6f Implement onGetEncodingFormat for libvorbis and libopus decoders. 2024-02-29 20:45:19 +10:00
David Reid 99c5a9c629 Big simplification decoder initialization.
With this change, there are now new prioritization rules when deciding
which backend to attempt to load from.

  * Backends are iterated in the order they are defined in the config.

  * If the encoding format is set to ma_encoding_format_unknown, all
    backends will be attempted in regular prioritization order.

  * If the encoding format is set to something other than
    ma_encoding_format_unknown, that is a specific format is being
    requested, only backends that report support for that format or
    ma_encoding_format_unknown will attempted.

  * File extensions are no longer used as a hint for prioritization.
    The encoding format in ma_decoder_config should be used to
    accelerate backend selection instead.
2024-02-29 20:29:42 +10:00
David Reid 7d8e8526bc Define stock decoding vtables to null when disabled at compile time. 2024-02-29 16:09:06 +10:00
David Reid 05756ff605 Fix a typo. 2024-02-29 16:00:21 +10:00
David Reid 9a6eefd4a8 Rename some variables in preparation for changes to decoding backends. 2024-02-29 15:35:37 +10:00
David Reid ce848a353d Expose stock decoding backend vtables.
This is in preparation for supporting more flexible decoding backend
prioritization.
2024-02-29 14:59:31 +10:00
David Reid e290104179 Merge branch 'dev' into dev-0.12 2024-02-29 14:39:51 +10:00
David Reid c6d8b591f6 Remove some leftover experimental code. 2024-02-29 14:39:36 +10:00
David Reid 521b6571f3 Fix compilation errors. 2024-02-29 14:38:41 +10:00
David Reid 5888bfadca Merge branch 'dev' into dev-0.12 2024-02-29 14:35:46 +10:00
David Reid 63e1900db8 Update documentation. 2024-02-29 10:50:06 +10:00
David Reid 29da9b789c Add new init flags for sounds and resource managed data sources.
This adds the following flags:

  * MA_SOUND_FLAG_LOOPING
  * MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_LOOPING

These can be used to initialize sounds and resource managed data
sources to loop by default. This is the recommended way to enable
looping for streams. The `isLooping` config option in
`ma_sound_config` and `ma_resource_manager_data_source_config` has been
deprecated. If you are using those, you should switch to the new flag
or else you'll get compiler errors when upgrading to a future version.
2024-02-29 10:25:02 +10:00
David Reid b454e7f14b PulseAudio: Try fixing a channel mapping bug.
Public issue https://github.com/mackron/miniaudio/issues/811
2024-02-28 18:40:35 +10:00
David Reid d36a2ef651 Minor cleanup. 2024-02-28 17:16:50 +10:00
David Reid 9aa6e035bb Memory improvements to node processing.
When processing a node, miniaudio will read into a temporary buffer
before mixing input attachments. This commit removes the per-node heap
allocation and replaces it with a per-graph stack. This should result
in less memory usage at larger scales, but at the expense of slightly
more usage at smaller scales.

The size of the stack can be configured via ma_node_graph_config. If
ma_engine is being used, it can be done via ma_engine_config.
2024-02-27 17:05:56 +10:00
David Reid 7a8ebd7f4d Update to node processing.
Previously, processing a node would involve a temporary buffer
allocated on the stack. Because this was fixed size, it would result in
processing being sub-divided into chunks in order to avoid overflowing
that buffer. This becomes an issue when a node needs to have a known
processing size. An example might be some kind of effect that requires
processing be in powers of two.

With this commit, the `processingSizeInFrames` variable in
`ma_node_graph_config` can be used to make it so processing always
happens in fixed sized chunks. In this situations, it's recommended you
always call `ma_node_graph_read_pcm_frames()` with a frame count of a
multiple of `processingSizeInFrames`.

The allocation strategy used here is not optimal and will be improved
in future commits. It currently allocates a buffer per-node, but since
the data contained within it is transient in nature, it should be
possible to use a global fixed sized stack that supports allocating a
variable amount of space within the stack buffer.
2024-02-27 15:31:17 +10:00
David Reid e32cc9ff83 Update dr_wav and dr_mp3. 2024-02-27 08:27:05 +10:00
David Reid babd7fb00f Forward declare ma_semaphore API. 2024-02-25 09:50:42 +10:00
David Reid f01ce432be Merge branch 'dev' into dev-0.12 2024-02-25 09:37:21 +10:00
David Reid f20ab8a9ee Web: Increase the default stack size for the AudioWorklets thread. 2024-02-08 15:26:41 +10:00