Commit Graph

1986 Commits

Author SHA1 Message Date
Pedro K Custodio ac62b0a030 Include dr_wav if only one of MA_NO_DECODING or MA_NO_ENCODING is defined. 2020-08-16 13:50:47 +01:00
David Reid 4873584058 Add support for fading out to sound groups. 2020-08-16 21:30:35 +10:00
David Reid 3de7f5caf5 Add support for start delays to sound groups. 2020-08-16 17:16:50 +10:00
David Reid 56dbcb529c Add support for fading in to sound groups. 2020-08-16 16:57:53 +10:00
David Reid 1baf3e941a Update documentation for ma_mixer_end(). 2020-08-16 15:23:20 +10:00
David Reid 22a785d72b Add support for setting the pitch on sound groups. 2020-08-16 15:20:35 +10:00
David Reid 41198b9b75 Add support for offsetting mixing output. 2020-08-16 15:10:16 +10:00
David Reid 042e1b95b1 Add support for panning to sound groups. 2020-08-16 11:34:13 +10:00
David Reid 340dbcc37b Fix a mixing bug when applying an effect. 2020-08-16 11:32:07 +10:00
David Reid 96ee8242f4 Add support for start delays for engine sounds. 2020-08-15 11:53:37 +10:00
David Reid fea2cba24b Add support for offsets to the low-level mixing API. 2020-08-15 11:48:40 +10:00
David Reid fe85a13214 Add ma_decoder_get_cursor_in_pcm_frames(). 2020-08-15 10:09:19 +10:00
David Reid eea8ea9e2d Version 0.10.16 2020-08-14 18:56:49 +10:00
David Reid 1f97a8138b Update dr_flac. 2020-08-14 18:50:22 +10:00
David Reid 6d1a1ccd05 Engine: Improve support for fading in and out of sounds.
Fading is now set using these APIs:

  * ma_engine_sound_set_fade_in()
  * ma_engine_sound_set_fade_out()

When a sound is stopped, either by naturally reaching the end, or
explicitly with ma_engine_sound_stop(), the fade out will be applied.
Fading will also be applied around loop transitions.

Note that when a sound is stopped implicitly by it reaching the end,
fading out will not work when the length of the sound is not know (that
is, when ma_data_source_get_length_in_pcm_frames() returns 0).
2020-08-14 13:25:47 +10:00
David Reid b61fc570a2 Fix a bug in ma_data_source_get_cursor/length_in_pcm_frames(). 2020-08-14 10:57:53 +10:00
David Reid 775c624e66 Add some APIs to data sources:
* ma_data_source_get_cursor_in_pcm_frames()
  * ma_data_source_get_length_in_pcm_frames()

When the data source has no notion of a cursor or length, these return
MA_NOT_IMPLEMENTED to let the caller know about it. This is returned
when a custom data source leaves these functions unimplemented.

ma_decoder, ma_audio_buffer, ma_waveform and ma_noise have all been
updated to support these new functions.
2020-08-09 22:29:11 +10:00
David Reid 78ff206095 Fix bug in ma_resource_manager_data_buffer_get_available_frames(). 2020-08-09 18:49:48 +10:00
David Reid ab38bf91aa Add ma_engine_sound_get_data_format().
This function is used for retrieving the sample format, channel count
and sample rate of the sound.
2020-08-09 17:17:52 +10:00
David Reid 6e32cc22ff Add ma_engine_sound_set_fade_in/out().
As of this commit, ma_engine_sound_set_fade_out() is not fully
implemented pending the writing of some additional infrastructure.
2020-08-09 17:01:18 +10:00
David Reid f3f11b4133 Update the fader effect to support dual sub-fades.
This is useful for having a separate fade in and fade out for a sound
which is what we require for the ma_engine API.
2020-08-09 10:42:56 +10:00
David Reid 65e547c5a6 Add output parameter for number of frames mixed to ma_mixer_mix_*(). 2020-08-09 09:02:25 +10:00
David Reid 0672f3043a Add ma_engine_sound_seek_to_pcm_frame(). 2020-08-09 08:37:35 +10:00
David Reid 76a43426de Add sample rate to ma_data_source_get_data_format(). 2020-08-09 07:27:41 +10:00
David Reid 4060f18cda Minor cleanup. 2020-08-08 20:10:43 +10:00
David Reid 9763fa626b Engine: Add support for fading.
This adds support for having a sound fade in when it is started and
fade out when it is stopped.

This commit does not yet include support for fading out when the sound
approaches the end - it only fades out when explicitly stopped with
ma_sound_stop().

The fade time is set in milliseconds.

This commit includes a new effect called ma_fader, but it currently
only supports f32 formats. Support for other formats will be added in
the future.
2020-08-08 19:31:49 +10:00
David Reid 764ebc5e1b Change volume APIs to take 64-bit frame counts. 2020-08-08 19:29:10 +10:00
David Reid 9ded34fec4 Fix some minor typos. 2020-08-08 15:39:12 +10:00
David Reid d91ca8e88c Resource Manager: Cleanup from some previous refactoring. 2020-08-08 13:31:30 +10:00
David Reid 0cbd8c2c4f Resource Manager: Add support for flexible async notifications.
The ma_async_notification object is used for notifying the application
that an asynchronous operation has completed.

Custom notifications can be implemented by implementing the callback in
ma_async_notification_callbacks. There is currently only a single
callback called onSignal which is fired when the operation completes. A
helper notification which wraps around an ma_event object called
ma_async_notification_event is implemented which you can use as an
example for building your own notifications.
2020-08-08 13:29:20 +10:00
David Reid f5284505ac Resource Manager: Fix retrieval of available frames. 2020-08-08 12:15:04 +10:00
David Reid 6e017f7fe7 Add some APIs for ma_audio_buffer and ma_decoder.
* ma_audio_buffer_get_available_frames()
  * ma_decoder_get_available_frames()
2020-08-08 12:14:18 +10:00
David Reid 61b545e2b4 Resource Manager: Rename some APIs for consistency. 2020-08-03 20:32:50 +10:00
David Reid dbbae5b6a6 Resource Manager: Remove some unnecessary functions. 2020-08-03 19:43:29 +10:00
David Reid 91d1a5abcd Resource Manager: Add public APIs for data stream/buffer/source. 2020-08-03 19:37:16 +10:00
David Reid d48708d5de Big refactor to the resource manager.
* The data buffers and data streams are now first class data sources.
  * The ma_resource_manager_data_source object is now just a simple
    wrapper around ma_resource_manager_data_buffer and
    ma_resource_manager_data_stream.
  * Unnecessary pResourceManager parameters have been removed.
  * The part of the data buffer that's added to the BST has been split
    out from the main data buffer object so that the main object can be
    owned by the caller.
  * Add ma_resource_manager_data_source_get_available_frames() which is
    used to retrieve the number of frames that can be read at the time
    of calling. This is useful in asynchronous scenarios.
2020-08-02 21:26:34 +10:00
David Reid 5303558ac8 Add ma_resource_manager_data_source_get_available_frames(). 2020-08-02 13:58:36 +10:00
David Reid 0336896c33 Resource Manager: Update some documentation for implementation details. 2020-08-02 12:38:14 +10:00
David Reid 6425fc643a Update dr_wav, dr_flac and dr_mp3. 2020-08-02 11:53:41 +10:00
David Reid 4830c9f5b5 Update c89atomic. 2020-08-02 11:53:00 +10:00
David Reid d0149a0374 Simplify sized types. 2020-08-02 09:15:40 +10:00
David Reid b48d0dfbdd WASAPI: A few tweaks for handling device changes. 2020-08-02 08:41:19 +10:00
David Reid f947a75dbe Silence a warning on VC6. 2020-08-01 12:03:02 +10:00
David Reid 5b50d07fe8 Update c89atomic. 2020-08-01 11:59:02 +10:00
David Reid f6a4e33946 Clean up some code from an earlier commit. 2020-08-01 11:43:35 +10:00
David Reid 54fe965bc0 Fix some bugs in ma_data_source_read_pcm_frames()
* A crash when the pFramesRead parameter is null
  * Looping not working due to MA_AT_END now being returned.

Public issue https://github.com/dr-soft/miniaudio/issues/185
2020-08-01 11:39:58 +10:00
David Reid 0a9f0c625c WASAPI: Try fixing a deadlock when disabling a device.
Public issue https://github.com/dr-soft/miniaudio/issues/184
2020-08-01 10:51:03 +10:00
David Reid 11e488e1cc Win32: Use better error detection for WaitForSingleObject(). 2020-08-01 08:21:05 +10:00
David Reid 1aac650c46 Core Audio: Fix build errors on macOS. 2020-07-30 17:30:52 +10:00
David Reid 63aef51bfc Fix a typo. 2020-07-29 19:24:10 +10:00