Commit Graph

92 Commits

Author SHA1 Message Date
David Reid f45326a5f2 Remove the C++ test. 2026-05-02 17:01:18 +10:00
David Reid 15da9bd7ff API CHANGE: Add onProp callback to ma_data_source_vtable.
A new callback called `onProp` has been added to
`ma_data_source_vtable`. This replaces the following callbacks:

    onGetDataFormat
    onGetCursor
    onGetLength
    onSetLooping

This new callback is for retrieving and setting various properties
relating to the data source. It takes a `prop` parameter which is an ID
for the property being handled, and a `void*` pointer for
property-specific data.

Typically onProp implementations would discriminate on the property type
using a switch. The example below shows how to handle the old callbacks:

    switch (prop)
    {
        // Replaces onGetDataFormat (format/channels/rate).
        case MA_DATA_SOURCE_GET_DATA_SOURCE:
        {
            ma_data_source_data_format* pDataFormat =
                (ma_data_source_data_format*)pData;
            pDataFormat->format     = pCustomDataSource->format;
            pDataFormat->channels   = pCustomDataSource->channels;
            pDataFormat->sampleRate = pCustomDataSource->sampleRate;

            return MA_SUCCESS;
        }

        // Replaces onGetDataFormat (channel map)
        case MA_DATA_SOURCE_GET_CHANNEL_MAP:
        {
            ma_channel_map_init_standard(
                ma_standard_channel_map_default,
                (ma_channel*)pData,
                MA_MAX_CHANNELS,
                pCustomDataSource->channels);

            return MA_SUCCESS;
        }

        // Replaces onGetCursor
        case MA_DATA_SOURCE_GET_CURSOR:
        {
            *((ma_uint64*)pData) = pCustomDataSource->cursor;
            return MA_SUCCESS;
        }

        // Replaces onGetLength
        case MA_DATA_SOURCE_GET_LENGTH:
        {
            *((ma_uint64*)pData) = pCustomDataSource->length;
            return MA_SUCCESS;
        }

        // Replaces onSetLooping
        case MA_DATA_SOURCE_SET_LOOPING:
        {
            pCustomDataSource->isLooping = *((ma_bool32*)pData);
            return MA_SUCCESS;
        }

        // Mandatory when MA_DATA_SOURCE_SET_LOOPING is implemented.
        case MA_DATA_SOURCE_GET_LOOPING:
        {
            *((ma_bool32*)pData) = pCustomDataSource->isLooping;
            return MA_SUCCESS;
        }

        // Return MA_NOT_IMPLEMENTED for any ignored properties.
        default: return MA_NOT_IMPLEMENTED;
    }

Note how the format/channels/rate and channel map properties have been
split across two separate properties, `MA_DATA_SOURCE_GET_DATA_SOURCE`
and `MA_DATA_SOURCE_GET_CHANNEL_MAP`. Along with this change, the
channel map parameters have been removed from
`ma_data_source_get_data_format()` and a new function called
`ma_data_source_get_channel_map()` has been added.

New properties have also been added for handling ranges and loop points.
This allows the data source implementation itself to handle it rather
than miniaudio doing it at a higher level. Where this is useful is if
your data source is a wrapper around another data source and you want to
route ranges and loop points to the internal data source.

The reason for this change is that it allows for properties to be added
without having to break the build due to yet another callback being
added. It also hides away the more niche properties that the majority of
data sources do not care about. For example, rarely does a data source
need to handle the `onSetLooping` callback, yet every data source needed
to add a `NULL` entry to their vtables just for this one extremely niche
property.

See documentation for further details.

Tag: release-notes
Tag: api-change
2026-05-02 15:31:09 +10:00
David Reid a92139b686 Enable libvorbis and libopus decoding in the deviceio test. 2026-04-28 19:00:24 +10:00
David Reid 72a6203849 Fix build errors with MA_NO_RUNTIME_LINKING. 2026-04-26 09:12:46 +10:00
David Reid deda7e500f Alignment. 2026-03-05 17:50:34 +10:00
David Reid bc52a82903 Add PS Vita backend. 2026-03-01 07:53:00 +10:00
David Reid 41a8ec6a8d Add XAudio options to the CMake script. 2026-03-01 07:24:36 +10:00
David Reid dea554dbb2 Minor rearrangement. 2026-03-01 07:22:06 +10:00
David Reid d94b45d058 Add a template for device backends. 2026-02-27 17:42:28 +10:00
David Reid 60a96123db Add Dreamcast to CMake script and readme. 2026-02-17 06:52:47 +10:00
David Reid 242cbf4d8c Optimizations to ma_deinterleave_pcm_frames() for stereo. 2026-02-15 21:54:29 +10:00
David Reid dbf391611d Add resampling test. 2026-02-14 20:26:20 +10:00
David Reid f37ffed283 Merge PipeWire backend into the main library. 2026-01-20 17:15:32 +10:00
David Reid f1d99a186c Update audioconverter. 2026-01-17 15:08:27 +10:00
David Reid 994ae48feb CMake: Minor output cleanup. 2026-01-12 19:39:15 +10:00
David Reid c50cc675c9 CMake: Try fixing the build for Clang and FORCE_C89. 2026-01-12 19:38:33 +10:00
David Reid 26029b2250 Add a basic engine test.
This is currently just for some specific tests, but might be expanded
later to be something a bit more practical.
2026-01-12 17:30:05 +10:00
David Reid 82ec45e349 CMake: Fix an error with libvorbis. 2026-01-12 17:25:33 +10:00
David Reid 83ef69a79a CMake: Update an option description. 2026-01-06 09:07:43 +10:00
David Reid fe31274720 CMake: Add support for MA_NO_THREADING to deviceio test. 2026-01-05 20:19:05 +10:00
David Reid 28d071766d CMake: Remove some superfluous error messages. 2026-01-03 15:06:50 +10:00
David Reid 70a3690499 CMake: Clean up the handling of SteamAudio. 2026-01-03 15:03:05 +10:00
David Reid 9128cbe35b CMake: Clean up the handling of libopus and libvorbis. 2026-01-03 15:02:21 +10:00
David Reid 44b39fe097 Rename SDL2 backend source files. 2026-01-03 13:56:40 +10:00
David Reid 3df99ce51d Rename the SDL backend to SDL2.
This distinction is needed because we'll be doing an SDL3 backend in the
future.
2026-01-03 13:50:48 +10:00
David Reid 6048a9a73e Fix CMake script for the Emscripten build. 2026-01-02 17:49:26 +10:00
David Reid e78a86d30b Cleanup of the CMake script. 2026-01-02 15:50:15 +10:00
David Reid 46b2cdd0cf Improve SDL2 integration in the CMake script. 2026-01-02 14:44:26 +10:00
David Reid ff9ff16341 CMake: Remove is_backend_enabled()
This is no longer necessary since we can just use MINIAUDIO_NO_[BACKEND]
as the standard way to check if a backend is enabled.
2025-12-31 20:25:11 +10:00
David Reid 7cbb204abb CMake: Experiment to make it easier to check if a backend is enabled. 2025-12-31 20:17:46 +10:00
David Reid 0e6eaae06b CMake: Don't compile the the PipeWire backend if device IO is disabled. 2025-12-31 19:34:58 +10:00
David Reid c6429bb866 Try fixing a CMake error. 2025-12-31 19:24:16 +10:00
David Reid 552cf613b3 PipeWire: Add support for disabling runtime linking. 2025-12-31 18:19:52 +10:00
David Reid a16756ec3b Add an example for single-threaded mode. 2025-12-30 09:26:38 +10:00
David Reid 442e9f4db8 Merge branch 'dev' into dev-0.12 2025-12-14 06:48:16 +10:00
Marty f513f462df cmake: add public include directories for extra decoders
It seems that when linking, for example, `miniaudio_libvorbis`, it doesn't add the necessary include directories for use in the project. This is because the include directories were not being added to the target at all.

Here, I fix that by adding them with PUBLIC scope.
2025-12-12 19:12:13 +10:00
David Reid 477020295a Merge branch 'dev' into dev-0.12 2025-11-30 06:01:16 +10:00
David Delassus dbf8e114f9 CMake: make install directives optional 2025-11-29 14:42:38 +10:00
David Reid 63485c2e7d Merge branch 'dev' into dev-0.12 2025-09-11 09:30:16 +10:00
David Reid 6648ed005a Initial commit of the documentation generation tool. 2025-09-10 13:47:00 +10:00
David Reid c3245ee3ca Merge branch 'dev' into dev-0.12 2025-09-10 09:53:01 +10:00
David Reid b306c6a270 Use pkg-config for libvorbis and libopus detection. 2025-09-10 09:51:13 +10:00
David Reid 8030f3bf7b Merge branch 'dev' into dev-0.12 2025-08-23 09:54:51 +10:00
David Reid 70eb06d3bd CMake: Minor fix for pthread and m. 2025-08-23 09:54:32 +10:00
Marcin Serwin 959283f244 Ignore missing library dependencies in CMake
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
2025-08-23 09:45:49 +10:00
David Reid 5384cfaf12 Merge branch 'dev' into dev-0.12 2025-08-23 08:11:38 +10:00
David Reid 1d7d8dfba0 Fix some CMake errors with the Emscripten build. 2025-08-23 08:09:03 +10:00
David Reid f9cb8a3e4d Revert "Expose compile defines in pkg-config file"
This reverts commit a2f92095dc.
2025-08-23 06:09:33 +10:00
David Reid 74aa94d980 Merge branch 'dev' into dev-0.12 2025-08-23 05:50:33 +10:00
David Reid e75a053908 Update CMake script to extract the version from miniaudio.h. 2025-08-23 05:50:15 +10:00