Commit Graph

2342 Commits

Author SHA1 Message Date
David Reid 722089d928 Fix the duplex_effect example.
This had the naming of source and excite the wrong way around.
2021-01-24 09:00:43 +10:00
David Reid 9ab7866237 Minor changes to resource_manager_advanced example. 2021-01-22 09:32:54 +10:00
David Reid f194a8bb59 Fix a bug in the resource_manager_advanced example. 2021-01-22 09:29:28 +10:00
David Reid 8f494c411c Fix a bug where thread handles are not being freed. 2021-01-22 07:25:49 +10:00
David Reid 1b185878a1 Update the resource_manager_advanced example. 2021-01-22 07:19:01 +10:00
David Reid 81a3b5d01f Update c89atomic. 2021-01-20 19:44:02 +10:00
David Reid a389b65a75 Fix some bugs with notifications. 2021-01-20 19:43:18 +10:00
David Reid 776d7ddd91 Fix compilation errors with the C++ build. 2021-01-19 19:22:52 +10:00
David Reid d8c2135e0b Update to latest version of c89atomic. 2021-01-19 19:22:30 +10:00
David Reid ef9099a6f2 Bug fix an update documentation. 2021-01-18 21:42:56 +10:00
David Reid 53512c39b7 Version 0.10.31 2021-01-17 21:40:01 +10:00
David Reid da42dfcd4b Add support for wide strings (wchar_t) to the engine. 2021-01-17 21:20:11 +10:00
David Reid 3eb0f400e6 Add support for wide strings (wchar_t) to the resource manager. 2021-01-17 21:11:21 +10:00
David Reid 71b06a8908 Add some wchar_t string functions.
This is in preparation for some work coming to the upcoming resource
manager.
2021-01-17 20:35:09 +10:00
David Reid 045fd9e732 Update dr_libs. 2021-01-17 20:28:57 +10:00
David Reid 361983f770 Update the resource manager example to work with Emscripten. 2021-01-17 18:51:44 +10:00
David Reid 30b55db681 Fix a bug with looping streaming sounds. 2021-01-17 18:38:17 +10:00
David Reid 13126b4ddf Fix a bug with the resource manager.
This was not setting the NON_BLOCKING flag correctly when NO_THREADING
is set.
2021-01-17 18:18:14 +10:00
David Reid dc0ca7072b Add support for running the resource manager without a job thread.
This is useful for platforms that do not have support for threading or
programs that do not want to use an extra thread for resource
management and would rather process jobs manually.

When configuring the resource manager to not use threading, the
MA_RESOURCE_MANAGER_FLAG_NO_THREADING flag must be set in the config.
This implicitly enables the MA_RESOURCE_MANAGER_FLAG_NON_BLOCKING flag
because it requires programs to manually call
ma_resource_manager_process_next_job(), and since it's assumed that
won't ever be called from another thread, you'd never want that to be
blocking.

This sets up a framework for getting the resource manager working with
Emscripten.
2021-01-17 13:41:09 +10:00
David Reid 9e6042f698 Remove loop detection code for now.
This needs a rethink. My test is no longer looping. Needs further
investigation.
2021-01-17 10:29:09 +10:00
David Reid dd52456571 Start using the onGetRequiredInputFrameCount callback for nodes.
This is an optional callback and is used by miniaudio as a hint to help
it determine how many input frames to read at a time. Without this,
miniaudio needs to guess how many frames to read, and in certain
situations may end up overestimating. This callback is only useful for
nodes that process input and output frames at different rates, i.e.
nodes that perform resampling.
2021-01-17 09:10:38 +10:00
David Reid c85993ccf4 Scale the volume up a bit for the vocoder example. 2021-01-16 21:54:08 +10:00
David Reid c4a07387f6 Get the bus order correct on the vocoder example. 2021-01-16 21:41:02 +10:00
David Reid ec077e7974 Fix some warnings with GCC. 2021-01-16 21:15:38 +10:00
David Reid 306922e024 Clarification to the duplex_effect example. 2021-01-16 20:40:53 +10:00
David Reid 2e22affe38 Update ma_audio_buffer_ref_init() to take a buffer.
This saves a mandatory call to ma_audio_buffer_ref_set_data(). With
this change, an ma_audio_buffer_ref_init() call is all that is required
to initialize a usable data source.
2021-01-16 20:36:19 +10:00
David Reid 6a8d450e87 Add some documentation for ma_vocoder_node. 2021-01-16 20:13:57 +10:00
David Reid 6c4bdaf7e0 Add vocoder node and duplex example. 2021-01-16 19:48:12 +10:00
David Reid 7c22845925 Rename ma_audio_buffer_ref_reset() to ma_audio_buffer_ref_set_data(). 2021-01-16 18:28:08 +10:00
David Reid d3d98ee3a2 Add ma_audio_buffer_ref.
This is a data source whose backing data is an application-controlled
pointer. No data is copied. It's a way of efficiently wrapping a raw
buffer and using it as a data source.
2021-01-16 17:51:50 +10:00
David Reid aeb51a8eeb Simplify ma_node_config_init(). 2021-01-16 15:56:30 +10:00
David Reid 9a1885ebdc Revert the recent metadata functionality.
Change of mind on how this should work.
2021-01-16 15:05:26 +10:00
David Reid 9c7431ab91 Add support for metadata for nodes.
This is useful for retrieving information about some aspect of the
node. A good example is human readable names associated with the node
and it's input and output buses. This is useful for user interfaces
where a brief description of the node such as "Low Pass Filter" can be
drawn on the screen. It's also useful for buses to be named, such as
the source/carrier and excite/modulator on a vocoder effect which would
also need to be visible on a UI.
2021-01-16 14:06:24 +10:00
David Reid 85580a4c0a Minor grammar fix. 2021-01-15 22:48:35 +10:00
David Reid 0c435ae844 Add a TODO. 2021-01-15 22:47:23 +10:00
David Reid 13e03e4169 Some improvements to the processing of nodes.
The following flags can now be associated with nodes via the vtable:

  * MA_NODE_FLAG_PASSTHROUGH
  * MA_NODE_FLAG_CONTINUOUS_PROCESSING
  * MA_NODE_FLAG_ALLOW_NULL_INPUT
  * MA_NODE_FLAG_DIFFERENT_PROCESSING_RATES

See commit changes for a description of these flags.
2021-01-15 22:37:04 +10:00
David Reid 916c1b8a5f Changes to node processing callbacks.
* The simplified callback has been removed.
  * The `globalTime` parameter has been removed from the callback.
  * The order of input and output frames and counts has been swapped to
    be consistent with ma_data_converter_process_pcm_frames(), etc.
2021-01-15 19:44:36 +10:00
David Reid 2b761c3c7f Update revision history. 2021-01-14 20:24:07 +10:00
David Reid 1ac06d44b3 Fix documentation on new backend enabling macros.
Public issue https://github.com/mackron/miniaudio/issues/260
2021-01-14 19:57:26 +10:00
David Reid 422ef79240 Add support for enabling only specific backends at compile time.
This enables the ability to explicitly enable only the backends a
program is interested in. Essentially it's the reverse of the pre-
existing method whereby instead of disabling backends, all backends are
disabled by default, and then specific backends are enabled. Example:

    #define MA_ENABLE_ONLY_SPECIFIC_BACKENDS
    #define MA_ENABLE_WASAPI /* Only care about WASAPI on Windows. */
    #define MA_ENABLE_ALSA   /* Only care about ALSA on Linux. */

Note that even if MA_ENABLE_* is used, the backend will still only be
enabled if the compilation environment and target platform actually
supports it. You can therefore use the MA_ENABLE_* options without
needing to worry about platform detection.

Public issue https://github.com/mackron/miniaudio/issues/260
2021-01-14 19:54:12 +10:00
David Reid b16f74bf6b Update revision history. 2021-01-14 19:06:35 +10:00
David Reid 88fc453f5f Add the MA_ATOMIC annotation.
Variables are marked with this annotation to make it clear that access
to the variable should be done through atomics.

I've also review the use of volatile in this commit.

Public issue https://github.com/mackron/miniaudio/issues/259
2021-01-14 19:05:10 +10:00
David Reid 687e9e5502 Fix a bug in the node graph relating to attaching and detaching nodes.
This was setting the previous pointer of newly attached nodes to NULL
instead of a pointer to the dummy head node. This then results in the
dummy head node never being updated when the node is detached which in
turn results in an uninitialized node being dereferenced.
2021-01-14 17:23:48 +10:00
David Reid 416ead6e35 Properly fix a bug with volume of output buses. 2021-01-14 17:08:14 +10:00
David Reid 63df16a2df Add some safety checks when reading from data sources. 2021-01-13 22:44:08 +10:00
David Reid 7a8ff122bc Fix a bug with the application of output bus volume. 2021-01-13 22:20:38 +10:00
David Reid fa416d323b Fix a bug when reading from a node with no attachments.
This would try reading from an uninitialized buffer thereby resulting
in a bad audio glitch. This does two things to fix the problem:

  1) When there are no input nodes attached to an input bus, nothing is
     read and 0 will be returned for the frames read variable.

  2) The buffer is silenced by default.

This fixes a bug with ma_engine where it would glitch in the moment
just after the engine is initialized and before a sound or group is
attached.
2021-01-13 22:03:09 +10:00
David Reid 14c5b35b8a Make the read counter for loop detection per output bus. 2021-01-13 21:18:07 +10:00
David Reid e6c2e4441b No longer force fixed sized updates from ma_engine.
This is no longer necessary and just introduces unnecessary latency and
inefficiency due to extra data movement.
2021-01-12 22:16:49 +10:00
David Reid 3f7cf70619 Reimplement ma_engine_play_sound(). 2021-01-12 21:37:45 +10:00