sokol: temporary sound fixes
This commit is contained in:
		| @@ -22,12 +22,20 @@ | |||||||
|  |  | ||||||
| #pragma once | #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_LUA 		1 | ||||||
| #define TIC_BUILD_WITH_MOON 	1 | #define TIC_BUILD_WITH_MOON 	1 | ||||||
| #define TIC_BUILD_WITH_FENNEL 	1 | #define TIC_BUILD_WITH_FENNEL 	1 | ||||||
| #define TIC_BUILD_WITH_JS 		1 | #define TIC_BUILD_WITH_JS 		1 | ||||||
| #define TIC_BUILD_WITH_WREN 	1 | #define TIC_BUILD_WITH_WREN 	1 | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #if defined(__APPLE__) | #if defined(__APPLE__) | ||||||
| // TODO: this disables macos config  | // TODO: this disables macos config  | ||||||
| #	include "AvailabilityMacros.h" | #	include "AvailabilityMacros.h" | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								sokol/main.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								sokol/main.c
									
									
									
									
									
								
							| @@ -260,7 +260,6 @@ static tic80* tic = NULL; | |||||||
| static void app_init(void) | static void app_init(void) | ||||||
| { | { | ||||||
|     saudio_desc desc = {0}; |     saudio_desc desc = {0}; | ||||||
|     desc.num_channels = 2; |  | ||||||
|  |  | ||||||
|     saudio_setup(&desc); |     saudio_setup(&desc); | ||||||
|  |  | ||||||
| @@ -307,14 +306,16 @@ static void app_frame(void) | |||||||
|  |  | ||||||
|     gfx_draw(); |     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 |     static float floatSamples[44100/60 * Channels]; | ||||||
|     for(s32 i = 0; i < tic->sound.count/2; i++) |  | ||||||
|         floatSamples[i] = (float)tic->sound.samples[i*2] / 32768.0f; |  | ||||||
|  |  | ||||||
|     // TODO: remove /2 for stero sound |     for(s32 i = 0; i < tic->sound.count; i+=2) | ||||||
|     saudio_push(floatSamples, tic->sound.count/2); |         floatSamples[i>>1] = (float)(tic->sound.samples[i] + tic->sound.samples[i+1]) / 65536.0f; | ||||||
|  |  | ||||||
|  |     saudio_push(floatSamples, tic->sound.count / 2); | ||||||
| } | } | ||||||
|  |  | ||||||
| static void app_input(const sapp_event* event) | static void app_input(const sapp_event* event) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 nesbox
					nesbox