summaryrefslogtreecommitdiffhomepage
path: root/src/external/mini_al.h
diff options
context:
space:
mode:
authorRay <[email protected]>2018-02-12 11:27:26 +0100
committerGitHub <[email protected]>2018-02-12 11:27:26 +0100
commitdd8f0765b833bff2fbcc523e2d0a20d4fd28b5f3 (patch)
tree298dc5f3d8890bdb478c73c3737c751486b6ec5b /src/external/mini_al.h
parentb908a4078a2f318e6bc9cbdcb7045d1ccab0c6a4 (diff)
parent8af5f9dfe0e23d918bb88a5fca9e5671c9100f3a (diff)
downloadraylib-dd8f0765b833bff2fbcc523e2d0a20d4fd28b5f3.tar.gz
raylib-dd8f0765b833bff2fbcc523e2d0a20d4fd28b5f3.zip
Merge pull request #465 from raysan5/develop
Integrate develop branch into master
Diffstat (limited to 'src/external/mini_al.h')
-rw-r--r--src/external/mini_al.h65
1 files changed, 40 insertions, 25 deletions
diff --git a/src/external/mini_al.h b/src/external/mini_al.h
index 906e3c59..c9ab40fa 100644
--- a/src/external/mini_al.h
+++ b/src/external/mini_al.h
@@ -1,5 +1,5 @@
// Audio playback and capture library. Public domain. See "unlicense" statement at the end of this file.
-// mini_al - v0.x - xxxx-xx-xx
+// mini_al - v0.6b - 2018-02-03
//
// David Reid - [email protected]
@@ -59,7 +59,7 @@
//
// Building (BSD)
// --------------
-// The BSD build uses OSS and should Just Work without any linking nor include path configuration.
+// BSD build uses OSS. Requires linking to -lossaudio on {Open,Net}BSD, but not FreeBSD.
//
// Building (Emscripten)
// ---------------------
@@ -1774,7 +1774,10 @@ typedef HWND (WINAPI * MAL_PFN_GetDesktopWindow)();
#define mal_buffer_frame_capacity(buffer, channels, format) (sizeof(buffer) / mal_get_sample_size_in_bytes(format) / (channels))
// Some of these string utility functions are unused on some platforms.
-#if defined(__GNUC__)
+#if defined(_MSC_VER)
+ #pragma warning(push)
+ #pragma warning(disable:4505)
+#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
@@ -1972,7 +1975,9 @@ static int mal_strcmp(const char* str1, const char* str2)
return ((unsigned char*)str1)[0] - ((unsigned char*)str2)[0];
}
-#if defined(__GNUC__)
+#if defined(_MSC_VER)
+ #pragma warning(pop)
+#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
@@ -6707,6 +6712,10 @@ static mal_result mal_device__main_loop__alsa(mal_device* pDevice)
#include <fcntl.h>
#include <sys/soundcard.h>
+#ifndef SNDCTL_DSP_HALT
+#define SNDCTL_DSP_HALT SNDCTL_DSP_RESET
+#endif
+
int mal_open_temp_device__oss()
{
// The OSS sample code uses "/dev/mixer" as the device for getting system properties so I'm going to do the same.
@@ -8843,6 +8852,8 @@ mal_result mal_device_init__sdl(mal_context* pContext, mal_device_type type, mal
mal_assert(pConfig != NULL);
mal_assert(pDevice != NULL);
+ (void)pContext;
+
// SDL wants the buffer size to be a power of 2. The SDL_AudioSpec property for this is only a Uint16, so we need
// to explicitly clamp this because it will be easy to overflow.
mal_uint32 bufferSize = pConfig->bufferSizeInFrames;
@@ -10760,7 +10771,7 @@ static void mal_dsp_mix_channels__inc(float* pFramesOut, mal_uint32 channelsOut,
(void)channelMapOut;
(void)channelMapIn;
- if (mode == mal_channel_mix_mode_basic) {\
+ if (mode == mal_channel_mix_mode_basic) {
// Basic mode is where we just zero out extra channels.
for (mal_uint32 iFrame = 0; iFrame < frameCount; ++iFrame) {
switch (channelsIn) {
@@ -10785,23 +10796,23 @@ static void mal_dsp_mix_channels__inc(float* pFramesOut, mal_uint32 channelsOut,
// Zero out extra channels.
switch (channelsOut - channelsIn) {
- case 17: pFramesOut[iFrame*channelsOut+16] = 0;
- case 16: pFramesOut[iFrame*channelsOut+15] = 0;
- case 15: pFramesOut[iFrame*channelsOut+14] = 0;
- case 14: pFramesOut[iFrame*channelsOut+13] = 0;
- case 13: pFramesOut[iFrame*channelsOut+12] = 0;
- case 12: pFramesOut[iFrame*channelsOut+11] = 0;
- case 11: pFramesOut[iFrame*channelsOut+10] = 0;
- case 10: pFramesOut[iFrame*channelsOut+ 9] = 0;
- case 9: pFramesOut[iFrame*channelsOut+ 8] = 0;
- case 8: pFramesOut[iFrame*channelsOut+ 7] = 0;
- case 7: pFramesOut[iFrame*channelsOut+ 6] = 0;
- case 6: pFramesOut[iFrame*channelsOut+ 5] = 0;
- case 5: pFramesOut[iFrame*channelsOut+ 4] = 0;
- case 4: pFramesOut[iFrame*channelsOut+ 3] = 0;
- case 3: pFramesOut[iFrame*channelsOut+ 2] = 0;
- case 2: pFramesOut[iFrame*channelsOut+ 1] = 0;
- case 1: pFramesOut[iFrame*channelsOut+ 0] = 0;
+ case 17: pFramesOut[iFrame*channelsOut+16 + channelsIn] = 0;
+ case 16: pFramesOut[iFrame*channelsOut+15 + channelsIn] = 0;
+ case 15: pFramesOut[iFrame*channelsOut+14 + channelsIn] = 0;
+ case 14: pFramesOut[iFrame*channelsOut+13 + channelsIn] = 0;
+ case 13: pFramesOut[iFrame*channelsOut+12 + channelsIn] = 0;
+ case 12: pFramesOut[iFrame*channelsOut+11 + channelsIn] = 0;
+ case 11: pFramesOut[iFrame*channelsOut+10 + channelsIn] = 0;
+ case 10: pFramesOut[iFrame*channelsOut+ 9 + channelsIn] = 0;
+ case 9: pFramesOut[iFrame*channelsOut+ 8 + channelsIn] = 0;
+ case 8: pFramesOut[iFrame*channelsOut+ 7 + channelsIn] = 0;
+ case 7: pFramesOut[iFrame*channelsOut+ 6 + channelsIn] = 0;
+ case 6: pFramesOut[iFrame*channelsOut+ 5 + channelsIn] = 0;
+ case 5: pFramesOut[iFrame*channelsOut+ 4 + channelsIn] = 0;
+ case 4: pFramesOut[iFrame*channelsOut+ 3 + channelsIn] = 0;
+ case 3: pFramesOut[iFrame*channelsOut+ 2 + channelsIn] = 0;
+ case 2: pFramesOut[iFrame*channelsOut+ 1 + channelsIn] = 0;
+ case 1: pFramesOut[iFrame*channelsOut+ 0 + channelsIn] = 0;
}
}
} else {
@@ -10832,10 +10843,10 @@ static void mal_dsp_mix_channels__inc(float* pFramesOut, mal_uint32 channelsOut,
}
} else if (channelsIn == 2) {
// TODO: Implement an optimized stereo conversion.
- mal_dsp_mix_channels__dec(pFramesOut, channelsOut, channelMapOut, pFramesIn, channelsIn, channelMapIn, frameCount, mal_channel_mix_mode_basic);
+ mal_dsp_mix_channels__inc(pFramesOut, channelsOut, channelMapOut, pFramesIn, channelsIn, channelMapIn, frameCount, mal_channel_mix_mode_basic);
} else {
// Fall back to basic mixing mode.
- mal_dsp_mix_channels__dec(pFramesOut, channelsOut, channelMapOut, pFramesIn, channelsIn, channelMapIn, frameCount, mal_channel_mix_mode_basic);
+ mal_dsp_mix_channels__inc(pFramesOut, channelsOut, channelMapOut, pFramesIn, channelsIn, channelMapIn, frameCount, mal_channel_mix_mode_basic);
}
}
}
@@ -11494,7 +11505,11 @@ void mal_pcm_f32_to_s32(int* pOut, const float* pIn, unsigned int count)
// REVISION HISTORY
// ================
//
-// v0.x - xxxx-xx-xx
+// v0.6b - 2018-02-03
+// - Fix some warnings when compiling with Visual C++.
+//
+// v0.6a - 2018-01-26
+// - Fix errors with channel mixing when increasing the channel count.
// - Improvements to the build system for the OpenAL backend.
// - Documentation fixes.
//