Commit Graph

931 Commits

Author SHA1 Message Date
David Reid 479718d86d Fix a log formatting bug. 2021-07-02 21:31:19 +10:00
David Reid f940118fd8 Fix some logging bugs. 2021-07-02 20:30:13 +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 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 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 4559253587 Remove the MA_END_OF_FILE result code.
Use MA_AT_END instead. Use of MA_END_OF_FILE is too easily confused
with MA_AT_END, and MA_AT_END is a more generally applicable.
2021-06-30 12:30:31 +10:00
David Reid 1c179fb475 Try fixing an infinite loop. 2021-06-30 12:17:21 +10:00
David Reid 38f2754edb Fix compilation errors on 32-bit. 2021-06-30 06:10:44 +10:00
David Reid dad754b745 Add support for custom decoding backends.
Public issue https://github.com/mackron/miniaudio/issues/311
2021-06-27 21:43:31 +10:00
David Reid cf2c9f2533 PulseAudio: Attempt to fix a division by zero error.
Public issue https://github.com/mackron/miniaudio/issues/323
2021-06-22 17:41:41 +10:00
David Reid a95c066218 Add alternate names for some structs.
This is in preparation for some work in the high level API.
2021-06-20 10:20:12 +10:00
David Reid f24967f952 Comment out some code to try and fix an error on iOS.
Public issue https://github.com/mackron/miniaudio/issues/101
2021-06-17 18:05:06 +10:00
David Reid 9be681b848 Return MA_AT_END from ma_(pcm_)rb_commit_read/write(). 2021-06-13 18:04:57 +10:00
David Reid 7858e098f5 Add some helper functions to ma_audio_buffer/_ref. 2021-06-13 12:42:06 +10:00
David Reid 7a9ce3d0d3 Fix a bug where MA_AT_END is not getting returned by audio buffers. 2021-06-13 07:17:26 +10:00
David Reid 73e1589afa Update dr_wav.
Public issue https://github.com/mackron/miniaudio/issues/320
2021-06-11 19:50:42 +10:00
David Reid 8234df87c9 Fix a possible double file close when decoder initialization fails.
Public issue https://github.com/mackron/miniaudio/issues/319
2021-06-11 19:03:01 +10:00
David Reid f0a8ea3a76 Merge branch 'gh-301' into dev 2021-06-02 17:28:13 +10:00
David Reid 57a107db20 Add support for loop points to ma_data_source.
The loop points are specified relative to the range, and will be
clamped as such.
2021-05-29 15:27:06 +10:00
David Reid 3542cd26e9 Update c89atomic. 2021-05-27 19:39:46 +10:00
David Reid a5159bd297 Fix an infinite loop when reading from a data source with no data. 2021-05-25 18:28:53 +10:00
David Reid 63955a65a9 Update c89atomic. 2021-05-23 20:25:18 +10:00
David Reid 46a033b43a Initial work on custom loop points and chaining for data sources.
This is locked behind the following compile time macro for now since
it'll involve breaking changes to custom data sources. This will be
removed in version 0.11:

  MA_EXPERIMENTAL__DATA_LOOPING_AND_CHAINING

Public issue https://github.com/mackron/miniaudio/issues/290
2021-05-16 15:36:20 +10:00
David Reid c6b44df8f4 Add support for running custom code on thread entry and exit.
To use this, define `MA_ON_THREAD_ENTRY` and `MA_ON_THREAD_EXIT` before
the implementation of miniaudio.

Public issue https://github.com/mackron/miniaudio/issues/301
2021-05-14 18:09:49 +10:00
David Reid 2eb792b719 Fix some typos. 2021-05-14 17:54:21 +10:00
David Reid 2d11a3542c PulseAudio: Fix a bug with channel mapping. 2021-05-09 16:16:03 +10:00
David Reid c3636a45b9 PulseAudio: Try fixing a divide by zero error.
Public issue https://github.com/mackron/miniaudio/pull/308
2021-05-09 10:30:50 +10:00
David Reid 964e352e24 Fix a copy/paste error. 2021-05-03 16:28:09 +10:00
David Reid 8973469186 Simplify the data source config. 2021-05-03 16:07:19 +10:00
David Reid 11acb0caa5 Prep work in preparation for some changes to data sources.
Public issue https://github.com/mackron/miniaudio/issues/290
2021-05-03 15:35:07 +10:00
David Reid 236da866eb Silence some warnings when compiling with MA_DEBUG_OUTPUT. 2021-05-02 09:44:50 +10:00
David Reid 199d6a7875 Version 0.10.35 2021-04-27 17:31:19 +10:00
David Reid 3c80311743 Fix the C++ build. 2021-04-27 17:25:46 +10:00
David Reid 994cda44b5 Version 0.10.34 2021-04-26 16:32:00 +10:00
David Reid 16a605eebd Cleanup. 2021-04-26 16:28:57 +10:00
David Reid 24a8d433ac Clean up some debug output. 2021-04-26 16:22:02 +10:00