Commit Graph

122 Commits

Author SHA1 Message Date
David Reid c54bb96964 Rename some config variables. 2021-07-01 14:58:05 +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 07fbb6ac6d Update custom_decoder example. 2021-06-30 20:43:05 +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 ea84294d97 Fix the custom_backend example. 2021-06-24 19:23:30 +10:00
David Reid 5551dc67e1 Update wording in example. 2021-06-24 19:07:33 +10:00
David Reid 595ba3f729 Update wording in example. 2021-06-24 18:52:33 +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 c715ead0e8 Minor simplification to the custom backend example. 2021-01-31 10:17:28 +10:00
David Reid 7fd98209ef Migrate the WebAudio backend over to the new callback system.
This changes a few things for custom backends and the calculation of
the size of the buffer. See the custom_backend example.
2020-11-17 20:43:29 +10:00
David Reid db0442fb78 Migrate the WASAPI backend over to the new callback system.
This includes changes to callbacks used by custom backends. It adds a
`pConfig` parameter to both onContextInit and onDeviceInit. This allows
custom backends to specify custom config properties.
2020-11-15 15:41:15 +10:00
David Reid a5bd015936 Explicitly set native data format flags in custom backend example. 2020-11-08 19:15:45 +10:00
David Reid dd8f6c4c66 Fix warnings on the Emscripten build. 2020-11-08 14:37:40 +10:00
David Reid 887bbeeeee Add support for custom backends.
This commit includes a few changes required for better supporting this:

  * Extra members have been added to ma_device_info which are going to
    eventually replace the min and max channels and sample rates. The
    new system is going to provide a list of supported data formats,
    groups by format/channels/rate and some flags. The only flag used
    at the moment is whether or not the format is usable in exclusive
    mode. The custom backend is the only backend currently using these
    new device info properties, and a backwards-compatibility layer has
    been implemented to fill out the old properties. Built-in backends
    will be migrated over to the new system in time.

  * A new set of backend callbacks have been implemented. Only the
    custom backend is using these at the moment. Built-in backends will
    be migrated over to these new backends soon.

  * A new public API called ma_device_get_state() has been added which
    returns the current state of the device (whether or not it's
    started or stopped). This is necessary for some custom backends.

  * A new public API called ma_device_handle_backend_data_callback()
    has been added. This is required for custom backends who use the
    callback paradigm for data delivery.

  * A new type of ring buffer has been created called ma_duplex_rb.
    This is used as an intermediary buffer for duplex devices running
    on backends that use the callback paradigm. It's used internally by
    ma_device_handle_backend_data_callback(). In the future it's
    planned to expand ma_duplex_rb to handle desyncs by dynamically
    resampling to get both sides back in sync. This is not implemented
    as of this commit.

Future work will involve converting existing built-in backends to be
consistent with the new ideas introduced with custom backend support.
2020-11-08 14:25:55 +10:00
David Reid 4f78581a92 Update wording in simple_duplex example. 2020-07-25 15:42:25 +10:00
David Reid 8be8e3bb00 Update examples building readme. 2020-07-16 08:45:15 +10:00
David Reid 3d82237ee2 Update documentation for examples. 2020-07-15 21:29:16 +10:00
David Reid 82a1410ec5 Fix compilation errors with MA_NO_DECODING and MA_NO_ENCODING. 2020-06-25 06:54:28 +10:00
David Reid 6f748942e6 Update examples and tests. 2020-06-24 19:37:46 +10:00
David Reid 4b23beb1f0 Fix example from recent API change. 2020-06-23 20:29:20 +10:00
David Reid e0294ac74c Fix a bug in fixed_sized_callback.
This is uninitializing the ring buffer before the device which results
in a situation where a stray data callback may try touching the buffer
after it's be uninitialized.
2020-06-23 19:55:46 +10:00
David Reid 86181dfac8 Updates to data sources.
* ma_data_source_read_pcm_frames and ma_data_source_seek_pcm_frames
    now return a result code and output the frames read/seeked as an
    output parameter.
  * These return MA_AT_END if the end of the data source has been
    reached. This should never be returned if the loop parameter is set
    to true.
2020-06-10 22:01:55 +10:00
David Reid 803cd284bc Shorten a comment for easier viewing. 2020-05-29 19:51:37 +10:00
David Reid 967174368e Add looping example. 2020-05-29 19:50:04 +10:00
David Reid 169132de39 Fix formatting in examples build readme. 2020-05-21 20:19:22 +10:00
David Reid e438ab0c9c Update loopback example to use the ma_encoder API. 2020-04-23 17:30:49 +10:00
David Reid 3645d9b0fd Update capture example to use the ma_encoder API. 2020-04-23 17:13:34 +10:00
David Reid 63c5cf851e Fix a typo. 2020-04-09 07:53:38 +10:00
David Reid f2dd3159f9 Update build command line examples to be consistent with each other. 2020-03-07 10:20:24 +10:00
David Reid 000180baf4 Silence a warning on the Emscripten build. 2020-03-07 10:16:53 +10:00
David Reid a4faf3daaa Remove unnecessary placeholder file. 2020-03-03 19:17:29 +10:00
David Reid 98a28d3c72 Example build scripts are no longer being maintained.
See the readme for an example build script for GCC and Emscripten.
2020-03-03 19:02:29 +10:00
David Reid f6665cdd73 Move the examples readme into the build folder. 2020-03-03 19:01:36 +10:00
David Reid ab8035d793 Fix fixed_size_callback example. 2020-03-03 18:20:53 +10:00
David Reid fff4cd56c9 Add simple_duplex example and remove old duplex text.
Duplex can be tested with the deviceio test.
2020-03-01 12:19:44 +10:00
David Reid 117b1b8595 Update waveform API to be consistent with other APIs. 2020-02-22 10:06:14 +10:00
David Reid 8a7a65c271 API CHANGE: Replace ma_sine_wave with ma_waveform.
The ma_waveform API is a more general API supporting different waveform
including sine, square, triangle and sawtooth.
2020-02-18 20:46:36 +10:00
David Reid 3981e361cd Remove the advanced_config example.
This example is no longer useful as everything is explained in the
documentation of ma_context_init() and ma_device_init().
2020-02-10 19:05:13 +10:00
David Reid dedd68f5be Rename example. 2020-02-10 18:54:28 +10:00
David Reid 86a0e65d02 Update examples. 2020-02-09 14:54:58 +10:00
David Reid df94bce3e4 Update examples. 2020-02-03 20:20:43 +10:00
David Reid 3732a2c476 Use MA_NO_DECODING with the simple_playback_emscripten example.
The rationale for this is to test that the MA_NO_DECODING option is
compiling clean.
2020-01-14 20:47:37 +10:00
David Reid f8b635b972 Update backend notes for Emscripten.
Emscripten no longer supports the -std=c* and -ansi compiler flags.
2020-01-14 20:46:31 +10:00
David Reid 4a67189f22 Minor change to simple_playback_emscripten. 2020-01-05 10:17:02 +10:00
David Reid 1ca6f80698 Fix some tests.
These compilation errors are a result of the recent change to dr_wav to
add support for allocation callbacks.
2019-10-19 07:46:44 +10:00
David Reid bb22d85a71 Add an example for handling fixed sized callbacks. 2019-09-10 19:59:13 +10:00
David Reid 99960dd706 Fix a bug on the audio(4) backend. 2018-08-25 07:54:35 +00:00
David Reid 3c68046fd3 Remove a debugging line from the loopback example. 2019-08-21 11:03:30 +10:00
David Reid 4edc39acd0 Add loopback example. 2019-08-21 11:00:06 +10:00