Commit Graph

2661 Commits

Author SHA1 Message Date
David Reid cc6ef11076 Clean up some old matrix code. 2021-07-04 13:42:43 +10:00
David Reid a99eac9f22 Use rectangular channel mixing instead of shuffling mode.
This fixes an issue where excess channels are not heard when the sound
source has more channels than the listener.
2021-07-04 13:37:16 +10:00
David Reid 2d8b0633a4 Fix some channel mapping bugs. 2021-07-04 13:35:29 +10:00
David Reid 35ce972bd3 Make sure heap layouts are aligned properly. 2021-07-04 11:53:21 +10:00
David Reid ebaa74d608 Improvements to channel conversion during spatialization.
This commit also fixes a bug where panning is incorrectly getting
applied to non-directional channels, such as mono and LFE channels.
2021-07-04 11:37:50 +10:00
David Reid 072efc6f8b Minor updates to channel mapping. 2021-07-04 11:36:24 +10:00
David Reid 81d720e09f Version 0.10.36 2021-07-03 20:29:03 +10:00
David Reid 204169285b Revert an earlier change. 2021-07-03 20:24:17 +10:00
David Reid b6387eb241 Add support for heap preallocation to nodes. 2021-07-03 19:33:45 +10:00
David Reid 5928aa9930 Add support for pre-allocation to engine nodes. 2021-07-03 18:51:17 +10:00
David Reid bf1b518357 Experimental work on a new memory allocation model.
This is work towards using the heap for storing per-channel data so we
can get rid of upper channel count limit and remove MA_MAX_CHANNELS or
at the very least stop MA_MAX_CHANNELS from affecting overall memory
usage.
2021-07-03 18:00:26 +10:00
David Reid 5af250cfea Add support for passing in a NULL channel map to the converter. 2021-07-03 17:34:21 +10:00
David Reid 8d00d9f5fa Add some error checking to ma_node_init(). 2021-07-03 14:22:42 +10:00
David Reid 366aa4346e Relax restrictions on the maximum input and output buses for nodes.
Previously this was restricted to 2 input buses and 2 output buses, but
this has been lifted to 254. When the number exceeds 2, internal data
structures will be allocated on the heap, otherwise they'll use a local
array contained within the ma_node structure.

This commit changes the node configuration. Previously there was a
fixed sized array for specifying the channel counts for each bus. This
array must now be defined outside of the config by the caller. The
following config variables have been renamed:

  * inputChannels > pInputChannels
  * outputChannels > pOutputChannels

This commit also adds the ability to configure input and output bus
counts on a per-instance basis rather than via the node vtable. To do
this, set the bus count in the vtable to MA_NODE_BUS_COUNT_UNKNOWN.
This will tell miniaudio to look at the node config to determine the
bus count rather than the vtable. It's an error to specify this in the
node config if the vtable specifies anything other than
MA_NODE_BUS_COUNT_UNKNOWN.
2021-07-03 12:40:13 +10:00
David Reid db7a3dfd23 Update stb_vorbis. 2021-07-03 07:48:12 +10:00
David Reid 4d1f619ff2 Formatting fixes. 2021-07-02 22:09:29 +10:00
David Reid f568dd8a79 Fix an infinite loop with the Vorbis decoder. 2021-07-02 21:54:50 +10:00
David Reid d2e5d3c283 Start to add some logging to the resource manager. 2021-07-02 21:49:00 +10:00
David Reid 479718d86d Fix a log formatting bug. 2021-07-02 21:31:19 +10:00
David Reid 9978520acf Use better allocation functions. 2021-07-02 20:57:33 +10:00
David Reid 18d185832f Fix a compilation warning. 2021-07-02 20:54:38 +10:00
David Reid 9b237dac04 Hook up the resource manager to the new logging system. 2021-07-02 20:54:30 +10:00
David Reid f940118fd8 Fix some logging bugs. 2021-07-02 20:30:13 +10:00
David Reid f2ef1d8f99 Hook up the engine to the new logging system. 2021-07-02 20:29:52 +10:00
David Reid 591d340343 Improvements to logging.
* The old logging callback has been deprecated and will be removed in
    version 0.11.
  * MA_LOG_LEVEL_DEBUG has been added and MA_LOG_LEVEL_VERBOSE
    deprecated.
  * The MA_LOG_LEVEL option has been deprecated. All log levels are now
    posted to the logging callbacks, except for MA_LOG_LEVEL_DEBUG
    which is only posted if MA_DEBUG_OUTPUT is enabled.

The new logging system works by creating a `ma_log` object. You then
register callbacks that will be fired when a log message is posted. You
can register up to 4 callbacks. You the specify a pointer to this log
object in the context config. This replaces the `logCallback` variable.

The old logging system was specific to context's and device's, however
with the introduction of new APIs this is no longer appropriate. The
new logging system is completely generic with a simple user-data
pointer being used for application-specific data.

This commit adds some helper APIs for retrieving a pointer to the
context's log object:

  * ma_context_get_log()
  * ma_device_get_log()
  * ma_device_get_context()

The MA_DEBUG_OUTPUT option has been improved for Android builds. With
the new system, __android_log_print() will be used instead of printf().
2021-07-02 20:10:23 +10:00
David Reid 1ad55ca9ad OpenSL: Fix a copy/paste bug. 2021-07-02 15:52:50 +10:00
David Reid 410bdaa6bf Fix some bugs with recent commits. 2021-07-01 19:51:17 +10:00
David Reid 210d2db9a3 Deprecate some decoder initialization functions. 2021-07-01 19:25:10 +10:00
David Reid acb7aba85e PulseAudio: Another attempt at fixing a division by zero.
Public issue https://github.com/mackron/miniaudio/issues/323
2021-07-01 18:43:45 +10:00
David Reid f340578d76 Update revision history. 2021-07-01 17:43:49 +10:00
David Reid 00baf2f622 Remove some unnecessary members from ma_decoder. 2021-07-01 17:42:20 +10:00
David Reid fd0c441423 Remove unused variables from the ma_decoder structure. 2021-07-01 17:14:47 +10:00
David Reid e312ac5411 Remove the old "raw" decoder.
This is no longer used. New code should use `ma_audio_buffer`.
2021-07-01 17:11:56 +10:00
David Reid b1f64fdaf6 Update simple_playback example. 2021-07-01 17:05:31 +10:00
David Reid 11a774c9ff Update dr_wav. 2021-07-01 17:05:17 +10:00
David Reid ead7373925 Update the WAV decoder to use the new backend infrastructure. 2021-07-01 16:20:27 +10:00
David Reid ea4453377a Update the FLAC decoder to use the new backend infrastructure. 2021-07-01 16:12:44 +10:00
David Reid 13252284e5 Update the MP3 decoder to use the new backend infrastructure. 2021-07-01 16:01:08 +10:00
David Reid 956701fcdd Update the Vorbis decoder to use the new backend infrastructure. 2021-07-01 15:31:39 +10:00
David Reid e0bfc59bc0 Restructuring in preparation for future work. 2021-07-01 15:22:13 +10:00
David Reid c54bb96964 Rename some config variables. 2021-07-01 14:58:05 +10:00
David Reid 6ec9a1c1fb Minor code restructure. 2021-07-01 14:55:20 +10:00
David Reid 9f4460797f Fix memory leaks. 2021-07-01 14:36:22 +10:00
David Reid 022b38517e Simplify the custom_decoder example. 2021-07-01 13:46:43 +10:00
David Reid 6dbb31849b Fix copy/paste errors. 2021-07-01 10:08:22 +10:00
David Reid d80c41f414 Update wording in comments. 2021-07-01 06:45:55 +10:00
David Reid a70515a96d Add example for using custom decoders with the resource manager. 2021-06-30 20:59:16 +10:00
David Reid 9ed296b3b9 Fix a bug where custom decoding backends aren't being used. 2021-06-30 20:58:43 +10:00
David Reid 52f471ae43 Try to standardize the use of MA_AT_END.
With this change, MA_AT_END should only ever be returned the number of
bytes or frames returned is equal to 0.
2021-06-30 20:58:07 +10:00
David Reid 07fbb6ac6d Update custom_decoder example. 2021-06-30 20:43:05 +10:00