diff options
| author | martincohen <m@coh.io> | 2019-09-02 12:08:51 +0200 |
|---|---|---|
| committer | martincohen <m@coh.io> | 2019-09-02 12:08:51 +0200 |
| commit | 3eff120cfffbd6b9285208a02269927235d59693 (patch) | |
| tree | ea32d83184a7f66ee52722d5e1977757707a13cd | |
| parent | d476a22a51f195976fb6a61a449603125b8cbb9f (diff) | |
ifdef guards
| -rw-r--r-- | sokol_app.h | 3 | ||||
| -rw-r--r-- | sokol_args.h | 3 | ||||
| -rw-r--r-- | sokol_audio.h | 25 | ||||
| -rw-r--r-- | sokol_fetch.h | 3 | ||||
| -rw-r--r-- | sokol_gfx.h | 3 | ||||
| -rw-r--r-- | sokol_time.h | 3 |
6 files changed, 23 insertions, 17 deletions
diff --git a/sokol_app.h b/sokol_app.h index f33db9b1..86e7a9e0 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -1,4 +1,4 @@ -#pragma once +#ifndef SOKOL_APP_INCLUDED /* sokol_app.h -- cross-platform application wrapper @@ -794,6 +794,7 @@ SOKOL_API_DECL const void* sapp_android_get_native_activity(void); #ifdef __cplusplus } /* extern "C" */ #endif +#endif // SOKOL_APP_INCLUDED /*-- IMPLEMENTATION ----------------------------------------------------------*/ #ifdef SOKOL_IMPL diff --git a/sokol_args.h b/sokol_args.h index 6cc87531..3d11d981 100644 --- a/sokol_args.h +++ b/sokol_args.h @@ -1,4 +1,4 @@ -#pragma once +#ifndef SOKOL_ARGS_INCLUDED /* sokol_args.h -- cross-platform key/value arg-parsing for web and native @@ -295,6 +295,7 @@ SOKOL_API_DECL const char* sargs_value_at(int index); #ifdef __cplusplus } /* extern "C" */ #endif +#endif // SOKOL_ARGS_INCLUDED /*--- IMPLEMENTATION ---------------------------------------------------------*/ #ifdef SOKOL_IMPL diff --git a/sokol_audio.h b/sokol_audio.h index 759ab8ff..89b95871 100644 --- a/sokol_audio.h +++ b/sokol_audio.h @@ -1,4 +1,4 @@ -#pragma once +#ifndef SOKOL_AUDIO_INCLUDED /* sokol_audio.h -- cross-platform audio-streaming API @@ -418,6 +418,7 @@ SOKOL_API_DECL int saudio_push(const float* frames, int num_frames); #ifdef __cplusplus } /* extern "C" */ #endif +#endif // SOKOL_AUDIO_INCLUDED /*=== IMPLEMENTATION =========================================================*/ #ifdef SOKOL_IMPL @@ -569,8 +570,8 @@ typedef struct { typedef struct { pthread_mutex_t mutex; - pthread_cond_t cond; - int count; + pthread_cond_t cond; + int count; } _saudio_semaphore_t; typedef struct { @@ -1472,12 +1473,12 @@ _SOKOL_PRIVATE void* _saudio_opensles_thread_fn(void* param) { /* get next output buffer, advance, next buffer. */ int16_t* out_buffer = _saudio.backend.output_buffers[_saudio.backend.active_buffer]; _saudio.backend.active_buffer = (_saudio.backend.active_buffer + 1) % SAUDIO_NUM_BUFFERS; - int16_t* next_buffer = _saudio.backend.output_buffers[_saudio.backend.active_buffer]; + int16_t* next_buffer = _saudio.backend.output_buffers[_saudio.backend.active_buffer]; /* queue this buffer */ const int buffer_size_bytes = _saudio.buffer_frames * _saudio.num_channels * sizeof(short); (*_saudio.backend.player_buffer_queue)->Enqueue(_saudio.backend.player_buffer_queue, out_buffer, buffer_size_bytes); - + /* fill the next buffer */ _saudio_opensles_fill_buffer(); const int num_samples = _saudio.num_channels * _saudio.buffer_frames; @@ -1491,7 +1492,7 @@ _SOKOL_PRIVATE void* _saudio_opensles_thread_fn(void* param) { return 0; } -_SOKOL_PRIVATE void _saudio_backend_shutdown(void) { +_SOKOL_PRIVATE void _saudio_backend_shutdown(void) { _saudio.backend.thread_stop = 1; pthread_join(_saudio.backend.thread, 0); @@ -1509,11 +1510,11 @@ _SOKOL_PRIVATE void _saudio_backend_shutdown(void) { for (int i = 0; i < SAUDIO_NUM_BUFFERS; i++) { SOKOL_FREE(_saudio.backend.output_buffers[i]); - } + } SOKOL_FREE(_saudio.backend.src_buffer); } -_SOKOL_PRIVATE bool _saudio_backend_init(void) { +_SOKOL_PRIVATE bool _saudio_backend_init(void) { _saudio.bytes_per_frame = sizeof(float) * _saudio.num_channels; for (int i = 0; i < SAUDIO_NUM_BUFFERS; ++i) { @@ -1590,9 +1591,9 @@ _SOKOL_PRIVATE bool _saudio_backend_init(void) { /* Output mix. */ _saudio.backend.out_locator.locatorType = SL_DATALOCATOR_OUTPUTMIX; _saudio.backend.out_locator.outputMix = _saudio.backend.output_mix_obj; - + _saudio.backend.dst_data_sink.pLocator = &_saudio.backend.out_locator; - _saudio.backend.dst_data_sink.pFormat = NULL; + _saudio.backend.dst_data_sink.pFormat = NULL; /* setup player */ { @@ -1600,9 +1601,9 @@ _SOKOL_PRIVATE bool _saudio_backend_init(void) { const SLboolean req[] = { SL_BOOLEAN_FALSE, SL_BOOLEAN_TRUE }; (*_saudio.backend.engine)->CreateAudioPlayer(_saudio.backend.engine, &_saudio.backend.player_obj, &src, &_saudio.backend.dst_data_sink, sizeof(ids) / sizeof(ids[0]), ids, req); - + (*_saudio.backend.player_obj)->Realize(_saudio.backend.player_obj, SL_BOOLEAN_FALSE); - + (*_saudio.backend.player_obj)->GetInterface(_saudio.backend.player_obj, SL_IID_PLAY, &_saudio.backend.player); (*_saudio.backend.player_obj)->GetInterface(_saudio.backend.player_obj, SL_IID_VOLUME, &_saudio.backend.player_vol); diff --git a/sokol_fetch.h b/sokol_fetch.h index 20d1ed42..309b7d68 100644 --- a/sokol_fetch.h +++ b/sokol_fetch.h @@ -1,4 +1,4 @@ -#pragma once +#ifndef SOKOL_FETCH_INCLUDED /* sokol_fetch.h -- asynchronous data loading/streaming @@ -937,6 +937,7 @@ SOKOL_API_DECL void sfetch_continue(sfetch_handle_t h); #ifdef __cplusplus } /* extern "C" */ #endif +#endif // SOKOL_FETCH_INCLUDED /*--- IMPLEMENTATION ---------------------------------------------------------*/ #ifdef SOKOL_IMPL diff --git a/sokol_gfx.h b/sokol_gfx.h index ac83e5e9..61355d11 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -1,4 +1,4 @@ -#pragma once +#ifndef SOKOL_GFX_INCLUDED /* sokol_gfx.h -- simple 3D API wrapper @@ -2036,6 +2036,7 @@ SOKOL_API_DECL void sg_discard_context(sg_context ctx_id); #ifdef __cplusplus } /* extern "C" */ #endif +#endif // SOKOL_GFX_INCLUDED /*--- IMPLEMENTATION ---------------------------------------------------------*/ #ifdef SOKOL_IMPL diff --git a/sokol_time.h b/sokol_time.h index e1f24fd6..d3e4c2a3 100644 --- a/sokol_time.h +++ b/sokol_time.h @@ -1,4 +1,4 @@ -#pragma once +#ifndef SOKOL_TIME_INCLUDED /* sokol_time.h -- simple cross-platform time measurement @@ -119,6 +119,7 @@ SOKOL_API_DECL double stm_ns(uint64_t ticks); #ifdef __cplusplus } /* extern "C" */ #endif +#endif // SOKOL_TIME_INCLUDED /*-- IMPLEMENTATION ----------------------------------------------------------*/ #ifdef SOKOL_IMPL |