mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-21 15:56:58 +02:00
Use a default instead of blank channel map by default.
This commit fixes an issue where the optimized mono expansion path is never hit.
This commit is contained in:
+29
-4
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file.
|
||||
miniaudio - v0.10.17 - 2020-08-28
|
||||
miniaudio - v0.10.18 - TBD
|
||||
|
||||
David Reid - davidreidsoftware@gmail.com
|
||||
|
||||
@@ -1420,7 +1420,7 @@ extern "C" {
|
||||
|
||||
#define MA_VERSION_MAJOR 0
|
||||
#define MA_VERSION_MINOR 10
|
||||
#define MA_VERSION_REVISION 17
|
||||
#define MA_VERSION_REVISION 18
|
||||
#define MA_VERSION_STRING MA_XSTRINGIFY(MA_VERSION_MAJOR) "." MA_XSTRINGIFY(MA_VERSION_MINOR) "." MA_XSTRINGIFY(MA_VERSION_REVISION)
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
@@ -2603,6 +2603,13 @@ Both input and output channel map buffers must have a capacity of at at least `c
|
||||
*/
|
||||
MA_API void ma_channel_map_copy(ma_channel* pOut, const ma_channel* pIn, ma_uint32 channels);
|
||||
|
||||
/*
|
||||
Copies a channel map if one is specified, otherwise copies the default channel map.
|
||||
|
||||
The output buffer must have a capacity of at least `channels`. If not NULL, the input channel map must also have a capacity of at least `channels`.
|
||||
*/
|
||||
MA_API void ma_channel_map_copy_or_default(ma_channel* pOut, const ma_channel* pIn, ma_uint32 channels);
|
||||
|
||||
|
||||
/*
|
||||
Determines whether or not a channel map is valid.
|
||||
@@ -37936,8 +37943,8 @@ MA_API ma_channel_converter_config ma_channel_converter_config_init(ma_format fo
|
||||
config.format = format;
|
||||
config.channelsIn = channelsIn;
|
||||
config.channelsOut = channelsOut;
|
||||
ma_channel_map_copy(config.channelMapIn, pChannelMapIn, channelsIn);
|
||||
ma_channel_map_copy(config.channelMapOut, pChannelMapOut, channelsOut);
|
||||
ma_channel_map_copy_or_default(config.channelMapIn, pChannelMapIn, channelsIn);
|
||||
ma_channel_map_copy_or_default(config.channelMapOut, pChannelMapOut, channelsOut);
|
||||
config.mixingMode = mixingMode;
|
||||
|
||||
return config;
|
||||
@@ -40229,6 +40236,19 @@ MA_API void ma_channel_map_copy(ma_channel* pOut, const ma_channel* pIn, ma_uint
|
||||
}
|
||||
}
|
||||
|
||||
MA_API void ma_channel_map_copy_or_default(ma_channel* pOut, const ma_channel* pIn, ma_uint32 channels)
|
||||
{
|
||||
if (pOut == NULL || channels == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pIn != NULL) {
|
||||
ma_channel_map_copy(pOut, pIn, channels);
|
||||
} else {
|
||||
ma_get_standard_channel_map(ma_standard_channel_map_default, channels, pOut);
|
||||
}
|
||||
}
|
||||
|
||||
MA_API ma_bool32 ma_channel_map_valid(ma_uint32 channels, const ma_channel* pChannelMap)
|
||||
{
|
||||
if (pChannelMap == NULL) {
|
||||
@@ -62485,6 +62505,11 @@ The following miscellaneous changes have also been made.
|
||||
/*
|
||||
REVISION HISTORY
|
||||
================
|
||||
v0.10.18 - TBD
|
||||
- Fix a bug in channel converter for s32 format.
|
||||
- Change channel converter configs to use the default channel map instead of a blank channel map when no channel map is specified when initializing the
|
||||
config. This fixes an issue where the optimized mono expansion path would never get used.
|
||||
|
||||
v0.10.17 - 2020-08-28
|
||||
- Fix an error where the WAV codec is incorrectly excluded from the build depending on which compile time options are set.
|
||||
- Fix a bug in ma_audio_buffer_read_pcm_frames() where it isn't returning the correct number of frames processed.
|
||||
|
||||
+15
-1
@@ -28,7 +28,10 @@ void on_sound_loaded(ma_async_notification* pNotification)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ma_result result;
|
||||
ma_resource_manager resourceManager;
|
||||
ma_resource_manager_config resourceManagerConfig;
|
||||
ma_engine engine;
|
||||
ma_engine_config engineConfig;
|
||||
ma_sound sound;
|
||||
ma_sound sound2;
|
||||
sound_loaded_notification loadNotification;
|
||||
@@ -39,7 +42,18 @@ int main(int argc, char** argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
result = ma_engine_init(NULL, &engine);
|
||||
resourceManagerConfig = ma_resource_manager_config_init();
|
||||
//resourceManagerConfig.decodedFormat = ma_format_s16;
|
||||
result = ma_resource_manager_init(&resourceManagerConfig, &resourceManager);
|
||||
if (result != MA_SUCCESS) {
|
||||
printf("Failed to initialize resource manager.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
engineConfig = ma_engine_config_init_default();
|
||||
engineConfig.pResourceManager = &resourceManager;
|
||||
|
||||
result = ma_engine_init(&engineConfig, &engine);
|
||||
if (result != MA_SUCCESS) {
|
||||
printf("Failed to initialize audio engine.\n");
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user