Commit f156baaf authored by David Reid's avatar David Reid

Use a default instead of blank channel map by default.

This commit fixes an issue where the optimized mono expansion path is
never hit.
parent f6fcbc71
/* /*
Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file. 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 David Reid - davidreidsoftware@gmail.com
...@@ -1420,7 +1420,7 @@ extern "C" { ...@@ -1420,7 +1420,7 @@ extern "C" {
#define MA_VERSION_MAJOR 0 #define MA_VERSION_MAJOR 0
#define MA_VERSION_MINOR 10 #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) #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__) #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 ...@@ -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); 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. 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 ...@@ -37936,8 +37943,8 @@ MA_API ma_channel_converter_config ma_channel_converter_config_init(ma_format fo
config.format = format; config.format = format;
config.channelsIn = channelsIn; config.channelsIn = channelsIn;
config.channelsOut = channelsOut; config.channelsOut = channelsOut;
ma_channel_map_copy(config.channelMapIn, pChannelMapIn, channelsIn); ma_channel_map_copy_or_default(config.channelMapIn, pChannelMapIn, channelsIn);
ma_channel_map_copy(config.channelMapOut, pChannelMapOut, channelsOut); ma_channel_map_copy_or_default(config.channelMapOut, pChannelMapOut, channelsOut);
config.mixingMode = mixingMode; config.mixingMode = mixingMode;
return config; return config;
...@@ -40229,6 +40236,19 @@ MA_API void ma_channel_map_copy(ma_channel* pOut, const ma_channel* pIn, ma_uint ...@@ -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) MA_API ma_bool32 ma_channel_map_valid(ma_uint32 channels, const ma_channel* pChannelMap)
{ {
if (pChannelMap == NULL) { if (pChannelMap == NULL) {
...@@ -62485,6 +62505,11 @@ The following miscellaneous changes have also been made. ...@@ -62485,6 +62505,11 @@ The following miscellaneous changes have also been made.
/* /*
REVISION HISTORY 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 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 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. - Fix a bug in ma_audio_buffer_read_pcm_frames() where it isn't returning the correct number of frames processed.
...@@ -28,7 +28,10 @@ void on_sound_loaded(ma_async_notification* pNotification) ...@@ -28,7 +28,10 @@ void on_sound_loaded(ma_async_notification* pNotification)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
ma_result result; ma_result result;
ma_resource_manager resourceManager;
ma_resource_manager_config resourceManagerConfig;
ma_engine engine; ma_engine engine;
ma_engine_config engineConfig;
ma_sound sound; ma_sound sound;
ma_sound sound2; ma_sound sound2;
sound_loaded_notification loadNotification; sound_loaded_notification loadNotification;
...@@ -39,7 +42,18 @@ int main(int argc, char** argv) ...@@ -39,7 +42,18 @@ int main(int argc, char** argv)
return -1; 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) { if (result != MA_SUCCESS) {
printf("Failed to initialize audio engine.\n"); printf("Failed to initialize audio engine.\n");
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment