Commit Graph

415 Commits

Author SHA1 Message Date
David Reid 0e8a19eef2 Decouple fader, spatializer and panner from ma_effect. 2021-01-12 20:35:30 +10:00
David Reid 56e0e62497 Add support for disabling pitching.
This provides an optimization by allowing processing to bypass the
resampler. Audio data needs to pass through the resampler even for the
case where pitch=1 because it needs to update internal buffers which if
it didn't do, would result in a glitch when moving away from 1.

In practice most sounds won't require individual pitch control, however
in the interest in being consistent with miniaudio's philosophy of
things "Just Working", pitching is enabled by default. Pitching can be
disabled with MA_SOUND_FLAG_DISABLE_PITCH in ma_sound_init_*() and
ma_sound_group_init().
2021-01-12 20:33:53 +10:00
David Reid b5c0f6f6d3 Remove ma_engine_effect.
This is the first step towards decoupling the ma_effect API from the
engine for the eventual removal.

This also fixes bugs regarding channel conversion when processing an
engine node.
2021-01-12 20:09:05 +10:00
David Reid ff22dc3c87 Fix a bug when trying to play a sound with inconsistent channel counts.
This bug happens when the channel count of the data source does not
match the channel count of the engine.
2021-01-12 17:22:44 +10:00
David Reid 400aaf582d Rename ma_sound_set_start/stop_delay() to ma_sound_set_start/stop_time()
This is mainly for consistency with the node API, but also because it
more clearly indicates that it's an absolute time rather than a delay
which sounds more like a relative time.
2021-01-12 16:23:27 +10:00
David Reid d5b25502c1 Migrate start and stop delays to the node graph system.
This changes ma_sound_set_start/stop_delay() to take an absolute time
in frames based on the global clock. Previously these took a relative
time in milliseconds. To use a relative time, add it to the value
returned by ma_engine_get_time(). To use milliseconds, use a standard
sample rate to milliseconds conversion.
2021-01-12 12:40:22 +10:00
David Reid 369fb6fd8f Some small improvements to the resource manager.
These changes are in preparation for fixing some issues relating to
retrieval of channel counts from data sources. The problem relates to
the asynchronous nature of the resource manager and how data sources
may be in the middle of loading when trying to initialize a sound which
results in the channel count not yet being available. The channel count
is necessary in order for the engine to be able to convert the data
source to the channel count of the final output.
2021-01-10 22:38:00 +10:00
David Reid 085728fdcd Remove ma_mixer. 2021-01-10 20:47:22 +10:00
David Reid 66a20f0a87 Remove the old mixing code from ma_engine. 2021-01-10 20:39:36 +10:00
David Reid d72b6f1dca Begin work on integrating the engine with the routing system.
This commit has known issues which will be fixed in the next commits.
2021-01-10 19:48:24 +10:00
David Reid 8da4b4fa8b Add support for timing operations to the node graph system.
This is needed for scheduling frame-exact starting and stopping of
nodes, in addition to any kind of time-based effects required by custom
nodes, such as fading.
2021-01-10 10:56:44 +10:00
David Reid 554c505f9c Work in progress on integrating ma_engine with the routing system.
This is not fully functional as of this commit.
2021-01-09 15:18:46 +10:00
David Reid 3e8a9ec040 Remove the ability to configure the engine's sample format.
The sample format is now always 32-bit floating point. This was done
for simplicity and practicality.
2021-01-09 09:15:26 +10:00
David Reid 72bc5bc043 Update ma_node_output_bus_set_volume() to allow amplification. 2021-01-07 20:44:38 +10:00
David Reid c394348d9a Remove ma_sound_set_effect() and ma_sound_group_set_effect().
Effects will now be implemented by plugging effect nodes into the node
graph at the appropriate location.
2021-01-07 20:43:31 +10:00
David Reid afcb46dbb1 Fix a typo. 2021-01-06 22:11:02 +10:00
David Reid d580e3043f Remove some unnecessary atomics. 2021-01-06 22:06:25 +10:00
David Reid 9f62d69669 Update documentation. 2021-01-06 22:04:39 +10:00
David Reid 79845b5ec6 Update documentation. 2021-01-06 21:27:41 +10:00
David Reid fb1e61cb06 Add ma_node_detach_all_output_buses(). 2021-01-06 21:19:55 +10:00
David Reid fb336f54e3 Make ma_node_detach() private and rename to ma_node_detach_full(). 2021-01-06 21:17:02 +10:00
David Reid bb0e486d95 Simplify node attachment APIs.
With this change, attachment and detachment of a node's output bus is
now consistent:

  * ma_node_attach_output_bus()
  * ma_node_detach_output_bus()

The old function that allowed you to attach the other way around has
been removed as the caller can easily do that themselves by swapping
the order of parameters.
2021-01-06 21:10:42 +10:00
David Reid 4f96309cbf Add experimental loop detection to the routing system. 2021-01-06 19:06:39 +10:00
David Reid c540366921 Improve performance of ma_node_uninit().
This changes the way ma_node_uninit() waits for the audio thread. Now,
instead of waiting for the *entire* graph to complete, it only waits
for it's local processing to complete.
2021-01-05 22:21:56 +10:00
David Reid 61c6e5b12a Typos. 2021-01-03 22:32:52 +10:00
David Reid 02f78d7787 Make channel counts per-bus rather than per-node.
This makes it possible to give individual input and output buses unique
channel counts which might be useful for specific kinds of effects.
2021-01-03 21:44:18 +10:00
David Reid c8e1438b11 Stop pre-converting input channel counts to output channel counts. 2021-01-03 21:03:47 +10:00
David Reid f6c563e523 Merge the new routing infrastructure into miniaudio_engine. 2021-01-03 18:41:40 +10:00
David Reid 1dcdd44088 Fix some errors with the C++ build. 2021-01-03 18:07:17 +10:00
Elias Ku 475d6f1296 Fix issue #252 2020-12-28 14:54:37 +03:00
David Reid 0e45b95e04 Rearrange some function parameters in miniaudio_engine. 2020-12-26 18:04:33 +10:00
David Reid 8095b9bcfb Whitespace. 2020-12-19 21:28:05 +10:00
David Reid ab8d87be23 Clean up some multithreading bugs due to incorrect use of atomics.
Public issue https://github.com/mackron/miniaudio/issues/237
2020-12-19 13:20:34 +10:00
David Reid c07411dde2 Fix a bug in period size calculation. 2020-12-08 07:41:00 +10:00
Eduardo Bart e76283822a Fix sound seek in miniaudio engine 2020-12-05 16:24:11 -03:00
David Reid 8d580793f7 Fix a bug reported by MSVC's static analysis. 2020-12-03 21:00:56 +10:00
David Reid dedcba2a3b Fix a bug when registering audio data with the resource manager. 2020-12-03 20:49:59 +10:00
David Reid 0f9355cf1b Fix a bug when an async data buffer fails to load. 2020-12-03 20:35:22 +10:00
David Reid b3bc6723ae Merge branch 'dev' of https://github.com/mackron/miniaudio into dev 2020-12-03 17:44:56 +10:00
David Reid 4ebfb458c9 Fix some dead store warnings. 2020-12-03 17:44:49 +10:00
Eduardo Bart f943647b35 Add ma_sound_set_pan_mode to miniaudio engine 2020-12-02 10:49:47 -03:00
David Reid dc0b3288be Remove some unnecessary volatile qualifiers. 2020-11-28 11:11:15 +10:00
David Reid e10c34bc62 Try fixing a warning when compiling with GCC as C++. 2020-11-28 11:03:08 +10:00
David Reid d4add63b43 Silence some unused function warnings. 2020-11-28 10:40:51 +10:00
David Reid f400ccec8e Update c89atomic and fix some warnings. 2020-11-28 10:39:53 +10:00
David Reid 0ef7381f75 Silence some unused function warnings. 2020-11-28 10:05:02 +10:00
David Reid d98e37984d Silence some warnings. 2020-11-28 09:54:51 +10:00
David Reid e7940394b2 Fix some bugs with trying to access uninitialized variables. 2020-11-28 08:00:31 +10:00
David Reid 42611ca64c Fix a bug in the high level API when no pre-defined context is used. 2020-11-23 17:56:04 +10:00
David Reid f8c748870f Remove the use of bitfields in the public section of miniaudio_engine. 2020-11-23 17:38:44 +10:00