Commit Graph

3927 Commits

Author SHA1 Message Date
David Reid 38d9a34f7d Bump version. 2016-10-28 08:16:16 +10:00
David Reid 6c911783b4 Add a TODO. 2016-10-27 20:28:26 +10:00
David Reid 9d336be542 Fix compilation warning. 2016-10-27 00:17:37 +10:00
David Reid 1b34736831 Move #include's for OpenSL|ES to a more appropriate spot. 2016-10-26 22:40:17 +10:00
David Reid d4c0a07c40 Move some #define's out of the public section. 2016-10-26 22:38:51 +10:00
David Reid 7afcede3bd API CHANGE: Add device callbacks to mal_device_config.
Rationale:
1) It allows the callbacks to be set at initialization time which feels
   a bit more intuitive to me.
2) It avoids the need to call mal_device_set_send_callback(), etc.
3) It's a bit more consistent with the onLog callback. Previously,
   onLog would be passed to mal_device_init(), whereas onSend, etc were
   set with mal_device_set_send_callback(), etc. which feels needlessly
   inconsistent.
2016-10-26 22:20:16 +10:00
David Reid 4e2e48d29e DirectSound: Fix compilation error with MSVC when compiling as C++. 2016-10-26 15:36:22 +10:00
David Reid ca53ff1053 Drop support for f64, A-law and Mu-law formats.
Rationale:
1) These formats just aren't common enough to justify the added
   maintenance cost.
2) It makes software format conversion a lot simpler since it reduces
   the number of permutations.
2016-10-26 15:22:22 +10:00
David Reid 8774f70d6f OpenSL|ES: Explicitly fail for known unsupported formats. 2016-10-26 12:40:37 +10:00
David Reid 6901b5caa1 OpenSL|ES: Call the onStop callback when the device is stopped. 2016-10-26 11:20:52 +10:00
David Reid 91ae8801ac Add support for backend-specific default buffer size and periods.
Previously, there was only a single default buffer size and period
count. This forces the library to use a lowest common denominator for
every backend which forces higher quality backends to suffer because
of the lesser quality ones.

This change adds basic infrastructure for future work to tweak these
properties for each individual backend to try and get the best out
them.
2016-10-26 11:07:47 +10:00
David Reid cba66e9bae API CHANGE: Pass config properties to mal_device_init() via a structure.
Rationale:
1) The number of parameters is just getting too much.
2) It makes it a bit easier to add new configuration properties in the
   future. In particular, there's a chance there will be support added
   for backend-specific properties.
2016-10-26 10:40:27 +10:00
David Reid 2fad235932 API CHANGE: Add user data pointer as the last parameter for mal_device_init().
The rationale for this change is to ensure the user data is available for
the logging callback during initialization.
2016-10-26 09:32:34 +10:00
David Reid 8cf6036345 Start revision history for v0.2. 2016-10-25 11:24:42 +10:00
David Reid d3669e3177 Add a note that the OpenSL|ES / Android backend is unstable. 2016-10-25 10:47:45 +10:00
David Reid c1f35b583e Minor changes to OpenSL|ES backend. 2016-10-25 10:43:23 +10:00
David Reid d3f17c223b OpenSL|ES: Add untested work for capture support. 2016-10-25 10:09:10 +10:00
David Reid f540e10fd7 Fix typos. 2016-10-25 10:03:18 +10:00
David Reid b7b1cd6b72 OpenSL|ES: Use ANDROIDSIMPLEBUFFERQUEUE instead of BUFFERQUEUE. 2016-10-25 10:02:08 +10:00
David Reid 1b20f53291 Add some very basic support for playback with OpenSL|ES/Android. 2016-10-23 10:41:38 +10:00
David Reid 11f4e21b3a Fix a comment. 2016-10-22 11:29:58 +10:00
David Reid dd26ad9d45 Fix the Android build and fix a few typos. 2016-10-22 08:30:26 +10:00
David Reid 7fb3a30412 Clean up some whitespace. 2016-10-21 18:07:07 +10:00
David Reid 6881209021 Put the declaration of mal_device_set_stop_callback() in a sensible location. 2016-10-21 13:46:20 +10:00
David Reid ce99f62f63 Convert tabs to spaces and remove trailing spaces. 2016-10-21 13:35:21 +10:00
David Reid b5831564da Use C syntax highlighting for example. 2016-10-21 13:25:58 +10:00
David Reid f2d0fac903 Add gitignore. 2016-10-21 13:25:17 +10:00
David Reid 3a1072e30f Update example in readme. 2016-10-21 13:24:33 +10:00
David Reid 596a3ef966 Add onStop callback which is called when a device is stopped either explicitly or internally as a result of an error. 2016-10-21 12:54:14 +10:00
David Reid 26ccabc834 Add examples. 2016-10-21 12:53:38 +10:00
David Reid bfc4d3ffc5 DirectSound: Add back notifications to better handle waking up the worker thread based on periods. 2016-10-21 10:59:25 +10:00
David Reid 46aaa53f2c Update documentation and add support for default buffer sizes and periods. 2016-10-21 10:33:13 +10:00
David Reid 5cbbf0b988 Have the onSend and onRecv callbacks work on frames rather than samples.
The rationale for this change is to keep it consistent with the rest of the library.
2016-10-21 08:34:14 +10:00
David Reid 6ec93e902e DirectSound: Improve rewind latency. 2016-10-21 08:19:18 +10:00
David Reid d984e39e1b Improve the main loop for DirectSound by making better use of periods. 2016-10-21 08:08:30 +10:00
David Reid 3180cadb4a Fix ALSA build. 2016-10-20 21:47:30 +10:00
David Reid bf093f22db Remove unnecessary notifications from the DirectSound backend. 2016-10-20 21:40:08 +10:00
David Reid 05c85e5bd2 Fix some thread-safety issues with callbacks. 2016-10-20 21:22:11 +10:00
David Reid 6ed399d57b Remove the notion of fragments and use a simplified buffer size and periods concept instead. 2016-10-20 21:16:49 +10:00
David Reid 08db9fbda8 Rename mal_device__read_samples_from_client() to mal_device__read_frames_from_client() and mal_device__send_samples_to_client() to mal_device__send_frames_to_client().
Rationale for this is to keep it consistent with the rest of the library.
2016-10-20 13:18:20 +10:00
David Reid 7039d4c9bf Add support for rewinding to the DirectSound backend. 2016-10-20 12:58:55 +10:00
David Reid 59feeafc03 Add some infrastructure for better thread-safety. 2016-10-19 21:42:43 +10:00
David Reid 9698068d3e ALSA: Have the id of enumerated devices be returned in "hw:%d,%d" format.
The rationale for this change is that during testing I noticed that
snd_pcm_open() would sometimes fail with "Invalid value for card"
when using the "NAME" hint returned by snd_device_name_get_hint()
verbatim. Using "hw:%d,%d" seems to fix this problem.
2016-10-19 21:14:20 +10:00
David Reid 916328c550 ALSA: Add a fallback for when snd_pcm_open() fails for "default" and "pulse" devices. 2016-10-19 19:27:17 +10:00
David Reid 1617261be1 ALSA: Fix a bug with timers for non-Windows platforms. 2016-10-19 19:00:33 +10:00
David Reid f9130d74c1 ALSA: Make device initialization a bit more robust.
- The buffer size is now set with set_buffer_size_near()
 - The size of the buffer is now independant of periods
 - snd_pcm_sw_params_set_avail_min() is now called with the previous
   power of 2 rather than the next.
 - The start threshold is now called with the previous power of 2
   rather than the next.
2016-10-19 18:38:33 +10:00
David Reid e2c93382f8 ALSA: Remove some old device iteration code. 2016-10-19 17:45:45 +10:00
David Reid a18a38f74e Add initial implementation of the null device. 2016-10-19 16:29:20 +10:00
David Reid 56b9101cfd Add placeholder APIs for rewinding:
- mal_device_get_available_rewind_amount()
  - mal_device_rewind()
2016-10-19 12:00:32 +10:00
David Reid f7a825d9de Fix build for the DirectSound backend. 2016-10-18 12:35:26 +10:00