sokol: temporary sound fixes
This commit is contained in:
parent
d12ce84f7f
commit
cd4db83725
|
@ -22,12 +22,20 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if !defined(TIC_BUILD_WITH_LUA) && \
|
||||
!defined(TIC_BUILD_WITH_MOON) && \
|
||||
!defined(TIC_BUILD_WITH_FENNEL) && \
|
||||
!defined(TIC_BUILD_WITH_JS) && \
|
||||
!defined(TIC_BUILD_WITH_WREN)
|
||||
|
||||
#define TIC_BUILD_WITH_LUA 1
|
||||
#define TIC_BUILD_WITH_MOON 1
|
||||
#define TIC_BUILD_WITH_FENNEL 1
|
||||
#define TIC_BUILD_WITH_JS 1
|
||||
#define TIC_BUILD_WITH_WREN 1
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
// TODO: this disables macos config
|
||||
# include "AvailabilityMacros.h"
|
||||
|
|
13
sokol/main.c
13
sokol/main.c
|
@ -260,7 +260,6 @@ static tic80* tic = NULL;
|
|||
static void app_init(void)
|
||||
{
|
||||
saudio_desc desc = {0};
|
||||
desc.num_channels = 2;
|
||||
|
||||
saudio_setup(&desc);
|
||||
|
||||
|
@ -307,13 +306,15 @@ static void app_frame(void)
|
|||
|
||||
gfx_draw();
|
||||
|
||||
static float floatSamples[44100/60];
|
||||
// TODO: Sokol doesn't support stereo at the moment
|
||||
// will fix it later
|
||||
enum {Channels = 1};
|
||||
|
||||
// TODO: remove /2 for stereo sound
|
||||
for(s32 i = 0; i < tic->sound.count/2; i++)
|
||||
floatSamples[i] = (float)tic->sound.samples[i*2] / 32768.0f;
|
||||
static float floatSamples[44100/60 * Channels];
|
||||
|
||||
for(s32 i = 0; i < tic->sound.count; i+=2)
|
||||
floatSamples[i>>1] = (float)(tic->sound.samples[i] + tic->sound.samples[i+1]) / 65536.0f;
|
||||
|
||||
// TODO: remove /2 for stero sound
|
||||
saudio_push(floatSamples, tic->sound.count / 2);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue