Commit Graph

3452 Commits

Author SHA1 Message Date
David Reid cc2076055f Merge branch 'dev' into dev-0.12 2023-04-07 17:41:09 +10:00
David Reid 23345b47e8 Add support for volume smoothing to sounds.
Smoothing is disabled by default. To enable it, you must use
ma_sound_init_ex() and configure it via the volumeSmoothTimeInPCMFrames
member of ma_sound_config.

This commit also fixes a bug where ma_gainer is not properly applying
smoothing.
2023-04-07 17:34:33 +10:00
David Reid 58166e2267 API CHANGE: Updates to custom backends.
Custom backends must now use the `ma_device_backend_vtable` object to
define their callbacks. All of these functions are largely the same,
except they all now take a `void*` as their first parameter which
represents the user data pointer.

The ma_backend_callbacks parameter has been removed from onContextInit
which means you must now statically define your callbacks in the
ma_device_backend_vtable object that you pass into the context config.

The `custom` member of the context config has been replaced with a new
set of members to support the ability to plug in multiple vtables.
2023-04-01 12:06:52 +10:00
David Reid 68c8b8000e More scaffolding in preparation for the new backend vtable system.
With this commit, the device IO code is now using the new vtable
system, but each of the stock backends are still using the old
callbacks internally. There exists a compatibility wrapper vtable
which all stock backends are currently using. As stock backends migrate
over to the new system, the compatiblity vtable will be replaced with
the backend-specific vtable.
2023-04-01 10:47:38 +10:00
David Reid 35403d4b9c Set up some scaffolding for the new backend vtable system.
The new system is in preparation for improving the custom backend
system and making it more modular. The old system does not support
user data which make things a bit less flexible than it should be. In
addition, the old system does not make it easy to plug in multiple
custom backends.

The changes in this commit, and probably the next few, are just
scaffolding so that we don't have to break the build of every platform
as this is worked on.
2023-04-01 10:02:17 +10:00
David Reid fbb0f9dd72 Add support for a processing callbacks for sounds. 2023-04-01 08:51:20 +10:00
David Reid 203de65568 Add support for setting a callback for when a sound finishes loading. 2023-03-31 12:30:27 +10:00
David Reid 48b2986114 API CHANGE: Changes to the sound notification system.
* The pDoneFence parameter has been removed from ma_sound_init_*()
  and replaced with pNotifications which is of the type
  ma_sound_notifications. This object is where the pDoneFence is
  now located.
* ma_sound_set_end_callback() has been removed. The callback is now
  specified in the pNotifications object.
* The endCallback and pEndCallbackUserData members of ma_sound_config
  have been removed. You must now specify this in pNotifications.
2023-03-31 11:54:14 +10:00
David Reid ef5861acdb API CHANGE: Remove pDoneFence from ma_sound_config.
Use initNotifications instead.
2023-03-30 09:54:31 +10:00
David Reid 2bdad08247 API CHANGE: Remove the idea of a ma_node_graph being a node.
A node graph should not be considered a node because a node needs to
be owned by a node graph which means a node graph being a node would
create a cyclic dependency.
2023-03-30 09:09:56 +10:00
David Reid 5da18c3ca8 API CHANGE: Remove playback.name and capture.name from ma_device.
Use ma_device_get_name() instead.
2023-03-30 08:53:52 +10:00
David Reid 529e70c653 API CHANGE: Remove the onStop callback from ma_device.
Use onNotification instead.
2023-03-30 08:44:25 +10:00
David Reid ec1364d3a1 API CHANGE: Remove all ma_resource_manager_job* APIs.
Use `ma_job` instead. Anything that was previously named as
`ma_resource_manager_job*` is now named `ma_job*`.
2023-03-30 08:40:27 +10:00
David Reid 9c69d50468 API CHANGE: Update ma_audio_buffer_config_init() to take a sample rate. 2023-03-30 08:36:19 +10:00
David Reid 35a0c7b465 API CHANGE: Update ma_audio_buffer_ref_init() to accept a sample rate. 2023-03-30 08:33:56 +10:00
David Reid 8042a37822 API CHANGE: Update ma_sound_config_init().
This adds a `ma_engine*` parameter to the following functions:

  * ma_sound_config_init()
  * ma_sound_group_config_init()

The following functions have been removed (use the above functions
instead):

  * ma_sound_config_init_2()
  * ma_sound_group_config_init_2()
2023-03-30 08:31:27 +10:00
David Reid ac09b507ef API CHANGE: Remove the "wet" and "dry" parameters from the delay effect
The "dry" parameter was equivalent to pre-multiplying the input, and
the "wet" parameter was equivalent to multiplying the output. Do this
if you are needing to replicate the old functionality.

Public issue https://github.com/mackron/miniaudio/issues/548
2023-03-30 08:24:17 +10:00
David Reid 30c4b7130f API CHANGE: Remove ma_noise_set_type().
To change the noise type you need to create a new ma_noise object.
2023-03-30 08:14:09 +10:00
David Reid 83fa8f6147 API CHANGE: Remove ma_engine_get/set_time().
These are replaced with ma_engine_get/set_time_in_pcm_frames().
2023-03-30 08:11:09 +10:00
David Reid 9a7663496f Version 0.11.14 2023-03-29 07:52:40 +10:00
David Reid 249c7386ae PulseAudio: Use the channel map used when initializing the PA stream.
This is an attempt to work around an issue with PipeWire.
2023-03-28 19:53:21 +10:00
David Reid 2ce573d0d6 Try fixing a channel mapping related error with PipeWire. 2023-03-28 18:07:46 +10:00
David Reid 21cf0e38a8 Simply some platform detection macros. 2023-03-28 13:30:50 +10:00
David Reid 2944461a88 Fix compilation on Haiku. 2023-03-28 12:50:40 +10:00
David Reid 6ada2501e8 Update some flags to prevent some conflicts. 2023-03-27 09:52:25 +10:00
David Reid bf90b04a3f Try fixing a compilation error with MA_NO_DEVICE_IO.
Public issue https://github.com/mackron/miniaudio/issues/652
2023-03-26 19:23:28 +10:00
David Reid 15aa776955 Minor code rearrangement in preparation for some updates. 2023-03-26 18:42:50 +10:00
David Reid 4cd066807b Add an example for high- and low-level interop.
This example captures data from the microphone using the low-level API
and then plays back the data through the engine. The intermediary data
source is a ring buffer.
2023-03-25 12:08:11 +10:00
David Reid 8ce4857bcd Add support for using ma_pcm_rb as a data source. 2023-03-25 12:05:28 +10:00
David Reid 025afa464a Update dr_wav and c89atomic. 2023-03-25 10:23:49 +10:00
David Reid 58855d3d34 Fix some pedantic warnings when compiling with GCC. 2023-03-25 09:10:28 +10:00
David Reid 315087be30 Add MA_THREAD_DEFAULT_STACK_SIZE for threads. 2023-03-25 08:16:20 +10:00
David Reid 5fc5c4d4ed Add new functions for getting and setting the engine's global time.
* ma_engine_get_time_in_pcm_frames() (replaces ma_engine_get_time())
  * ma_engine_get_time_in_milliseconds()
  * ma_engine_set_time_in_pcm_frames() (replaces ma_engine_set_time())
  * ma_engine_set_time_in_milliseconds()

These changes are consistent with the naming of other time based
functions, eliminates ambiguity and just makes it clearer as to what
you're working with.

ma_engine_get_time() and ma_engine_set_time() have been deprecated.
2023-03-24 13:19:03 +10:00
David Reid d63a3894ad Typo. 2023-03-23 20:11:57 +10:00
David Reid 6b4f356b02 Update change history. 2023-03-23 10:46:15 +10:00
David Reid e1a3abe9e7 Fix a bug with ma_vfs_read().
This is not pre-initializing the variable that receives the number of
bytes read to 0 which can result in custom VFS implementations
returning an invalid value if they return early from an error or
whatnot.
2023-03-23 10:43:56 +10:00
David Reid fb9c18c705 Version 0.11.13 2023-03-23 07:33:23 +10:00
David Reid 7f077a1cd7 Update revision history. 2023-03-21 17:32:45 +10:00
David Reid 4c199f9164 Fix some compilation errors with the C++ build. 2023-03-21 13:56:43 +10:00
David Reid c5f47fe7f1 Fix a compilation error when WASAPI is disabled. 2023-03-21 11:01:41 +10:00
David Reid 206be60612 Update revision history. 2023-03-21 09:58:32 +10:00
David Reid 6d71ce4121 Fix compilation errors with WIN32_LEAN_AND_MEAN.
Public issue https://github.com/mackron/miniaudio/discussions/647
2023-03-21 09:53:24 +10:00
David Reid 0433ac9eca Fix some warnings. 2023-03-21 09:25:26 +10:00
David Reid 0a19c74417 Version 0.11.12 2023-03-19 20:58:13 +10:00
David Reid 17744f69c2 audio4: Try improving default channel and sample rate detection. 2023-03-19 20:07:05 +10:00
David Reid f9807bee71 Fix a bug with the DirectSound backend. 2023-03-18 21:41:07 +10:00
David Reid d027845659 Update copyright dates. 2023-03-18 16:29:38 +10:00
David Reid 0b9b382a53 Get DirectSound and WinMM backends compiling with Cosmopolitan.
Note that this does not currently work at runtime.
2023-03-18 12:39:56 +10:00
David Reid 9d3b59f0a9 Fix compilation errors with the WASAPI backend for Cosmopolitan. 2023-03-18 11:54:44 +10:00
David Reid 18b4ac2433 Fix Windows/Cosmopolitan build. 2023-03-18 10:03:54 +10:00