Commit Graph

130 Commits

Author SHA1 Message Date
David Reid ab518977ec Remove unnecessary casts. 2020-01-30 21:25:50 +10:00
David Reid 96f747d3f3 Don't allow format and channels to change for biquad and LPF filters.
Previously this would result in a glitch, however in the interest of
avoiding as many sources of glitching as possible, changing the format
and/or channel count of a biquad filter (and by extension, anything
derived from it, such as low-pass filters) will now result in an error.
2020-01-30 21:23:21 +10:00
David Reid 9dbcc39c6e Update biquad documentation. 2020-01-29 19:01:04 +10:00
David Reid c8b6fdaf2c Use fixed point arithmetic with s16 biquads. 2020-01-29 18:50:50 +10:00
David Reid 68b960215f Update old comments. 2020-01-28 22:03:47 +10:00
David Reid b9c2509d78 Fix an overflow bug in the s16 biquad pipeline. 2020-01-28 21:54:15 +10:00
David Reid 040dcf8d2c Add documentation for low-pass filters. 2020-01-28 21:49:33 +10:00
David Reid b97c6fd35b Remove the old direct form 1 biquad code. 2020-01-28 21:19:14 +10:00
David Reid 8a44789840 Remove the unnecessary config member from ma_lpf.
This is never actually used internally and saves a bit of memory.
2020-01-28 20:42:59 +10:00
David Reid 42095a3e5a Add documentation for biquads. 2020-01-28 20:41:41 +10:00
David Reid e525d457c9 Change biquad filter to use transposed direct form 2.
This change reduces memory usage by removing half the number of delay
registers.

This commit also sets up some infrastructure for future work on a fixed
point implementation. Both the floating and fixed point implementations
will run on a 32-bit pipeline for now.
2020-01-28 20:14:55 +10:00
David Reid eedb7d3200 Add some documentation for channel conversion. 2020-01-27 20:17:01 +10:00
David Reid d37b23a729 Bug fixes to the new data converter. 2020-01-27 18:30:49 +10:00
David Reid 5d3ed8687e Bug fixes to the linear resampler.
This changes the the lpfCutoffFrequency config variable from a uint32
to a double. This is required because we simplify the sample rate
fraction which cant result in cases where the cutoff frequency is too
aggressively rounded down due to dividing tiny integers.
2020-01-27 18:12:25 +10:00
David Reid 4f5eb2f8a1 Finish initial work on the new data converter. 2020-01-27 09:08:15 +10:00
David Reid b546607332 Begin work on integration of the new channel converter. 2020-01-26 19:01:43 +10:00
David Reid cbcf6f6cf3 Early work on new channel converter. 2020-01-26 18:37:10 +10:00
David Reid 68dc797469 Add early work on new data converter. 2020-01-26 16:42:27 +10:00
David Reid d27678a277 Fix bug in ma_linear_resampler_get_required_input_frame_count(). 2020-01-26 11:53:12 +10:00
David Reid 4241b9f6ae Add ma_linear_resampler_set_rate_ratio(). 2020-01-26 11:28:33 +10:00
David Reid ed6ad79e24 Don't use generic seeking with the linear resampler. 2020-01-26 11:24:02 +10:00
David Reid f704b62767 Update resampling documentation. 2020-01-26 11:21:09 +10:00
David Reid 01c41ed329 Add support for passing in NULL for input frames for linear resampler.
This is equivalent to passing in zeroes.
2020-01-26 09:19:24 +10:00
David Reid b092720bf3 Integrate the new linear resampler. 2020-01-26 09:05:50 +10:00
David Reid 13a5512879 Work in progress on the linear resampler. 2020-01-26 08:51:53 +10:00
David Reid 811e438d1b Add support for reinitialization of low-pass and biquad filters. 2020-01-20 19:01:42 +10:00
David Reid 5d0f21448e Remove MA_RESAMPLER_MIN_RATIO and MA_RESAMPLER_MAX_RATIO. 2020-01-19 21:29:43 +10:00
David Reid ad9d1e636b Remove old experimental resampler code. 2020-01-19 21:26:02 +10:00
David Reid a9e7d6d8c9 Add some documentation for the new resampler.
This commit also renames ma_resampler_process() to
ma_resampler_process_pcm_frames().
2020-01-19 21:23:57 +10:00
David Reid b770ea91d5 Add generic seeking to the resampler. 2020-01-19 19:18:43 +10:00
David Reid 867e1ee7e4 SRC: Implement ma_speex_resampler_get_expected_output_frame_count(). 2020-01-19 17:47:22 +10:00
David Reid f7ff9ee19e SRC: Fix linear ma_resampler_get_expected_output_frame_count(). 2020-01-19 17:24:20 +10:00
David Reid 959885a303 SRC/Speex: Add support for querying required input frame counts. 2020-01-19 14:23:35 +10:00
David Reid 3e8f261c6f Minor restructuring in preparation for some Speex work. 2020-01-19 11:27:58 +10:00
David Reid 6894d10d78 Warning fixes. 2020-01-19 11:18:22 +10:00
David Reid 31086c5de9 Fix bugs in ma_resampler_get_required_input_frame_count(). 2020-01-19 11:12:35 +10:00
David Reid 5df3c0ce15 SRC: Add APIs for querying required input and expected output frames.
* ma_resampler_get_required_input_frame_count()
  * ma_resampler_get_expected_output_frame_count()

These have not yet been implemented for the Speex backend.

This commit also adds an APIs for setting changing the rate:

  * ma_resampler_set_rate()
  * ma_resampler_set_rate_ratio()
2020-01-19 08:15:47 +10:00
David Reid 8fabcc44d8 Add support for passing in null for the input buffer to the resampler. 2020-01-18 18:44:35 +10:00
David Reid 6817dc84f8 Rearrange some function parameters. 2020-01-18 17:46:51 +10:00
David Reid f22ad84986 Add ma_resampler_uninit(). 2020-01-18 17:37:55 +10:00
David Reid 7b27cda74a Add support for s16 format to biquad and low-pass filters. 2020-01-18 17:23:36 +10:00
David Reid 705e54c69a Add support for s16 format to the linear resampler. 2020-01-18 17:12:30 +10:00
David Reid 1449edf49f Add support for the Speex resampler. 2020-01-18 16:38:22 +10:00
David Reid 7d37789418 Resampling and LPF work. 2020-01-18 14:36:12 +10:00
David Reid 11d752ad78 Untested work in progress on the improved resampler. 2020-01-14 21:50:01 +10:00
David Reid 2b526f6945 Add experimental code for biquad and low-pass filters. 2020-01-09 11:27:57 +10:00
David Reid e8e048c965 Random resampler WIP experiments. 2019-12-01 08:45:22 +10:00
David Reid 98792caeaa Resampling testing. 2019-10-19 07:40:46 +10:00
David Reid 3e825396c1 Random resampler work. 2019-08-17 11:01:53 +10:00
David Reid d289e5cf6f Sketch out an API idea for the new resampler. 2019-05-09 19:10:28 +10:00