diff options
| author | David Reid <mackron@gmail.com> | 2017-11-24 22:13:33 +1000 |
|---|---|---|
| committer | David Reid <mackron@gmail.com> | 2017-11-24 22:13:33 +1000 |
| commit | a0d9913c7cf2dce11f8d45e38923c69eae5d6f5e (patch) | |
| tree | 184bd8ae68898330320b954488b18c5843efaf87 /src/external | |
| parent | 5463e14886456e362594250d9d5aa548a462eb20 (diff) | |
| download | raylib-a0d9913c7cf2dce11f8d45e38923c69eae5d6f5e.tar.gz raylib-a0d9913c7cf2dce11f8d45e38923c69eae5d6f5e.zip | |
Potential fixes for audio on RPI and Emscripten builds.
Diffstat (limited to 'src/external')
| -rw-r--r-- | src/external/mini_al.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/external/mini_al.h b/src/external/mini_al.h index 164709d9..1779e707 100644 --- a/src/external/mini_al.h +++ b/src/external/mini_al.h @@ -8634,7 +8634,7 @@ mal_result mal_device_init__sdl(mal_context* pContext, mal_device_type type, mal // 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 * pConfig->periods * pConfig->channels; + mal_uint32 bufferSize = pConfig->bufferSizeInFrames; if (bufferSize > 32768) { bufferSize = 32768; } else { @@ -8696,7 +8696,7 @@ mal_result mal_device_init__sdl(mal_context* pContext, mal_device_type type, mal pDevice->internalFormat = mal_format_from_sdl(obtainedSpec.format); pDevice->internalChannels = obtainedSpec.channels; pDevice->internalSampleRate = (mal_uint32)obtainedSpec.freq; - pDevice->bufferSizeInFrames = obtainedSpec.samples / obtainedSpec.channels; + pDevice->bufferSizeInFrames = obtainedSpec.samples; pDevice->periods = 1; // SDL doesn't seem to tell us what the period count is. Just set this 1. #if 0 @@ -10980,6 +10980,7 @@ const char* mal_get_backend_name(mal_backend backend) case mal_backend_oss: return "OSS"; case mal_backend_opensl: return "OpenSL|ES"; case mal_backend_openal: return "OpenAL"; + case mal_backend_sdl: return "SDL"; default: return "Unknown"; } } @@ -11197,7 +11198,8 @@ void mal_pcm_s32_to_f32(float* pOut, const int* pIn, unsigned int count) for (unsigned int i = 0; i < count; ++i) { int x = pIn[i]; double t; - t = (double)(x + 2147483648LL); + t = (double)(x + 2147483647); + t = t + 1; t = t * 0.0000000004656612873077392578125; r = (float)(t - 1); pOut[i] = (float)r; @@ -11255,7 +11257,8 @@ void mal_pcm_f32_to_s32(int* pOut, const float* pIn, unsigned int count) c = ((x < -1) ? -1 : ((x > 1) ? 1 : x)); c = c + 1; t = (mal_int64)(c * 2147483647.5); - r = (int)(t - 2147483648LL); + t = t - 2147483647; + r = (int)(t - 1); pOut[i] = (int)r; } } |
