Advertisement
Kitomas

_kit_kmixerAllPrivate.h as of 2023-10-05

Oct 6th, 2023
804
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 6.92 KB | None | 0 0
  1. #ifndef _KIT_KMIXERALLPRIVATE_H
  2. #define _KIT_KMIXERALLPRIVATE_H
  3.  
  4.  
  5. #include "../../include/kit_sdl2/kit_macroconst.h"
  6. #include "../../include/kit_sdl2/kit_kmixer.h"
  7. #include "_kit_kmixerPrivate.h"
  8. #include "_kit_kmixerDevicePrivate.h"
  9. #include "_kit_kmixerVoicePrivate.h"
  10. //include intrinsic functions
  11. #include <immintrin.h>
  12.  
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16.  
  17.  
  18.  
  19.  
  20. #define _CAST_VOICE(_vector) \
  21.   ((_kit_kmixerVoice*)(_vector)->ptr)
  22. #define _CAST_U32(_vector) \
  23.   ((Uint32*)(_vector)->ptr)
  24. //assumes device name is "device"
  25. #define _CAST_RAW \
  26.   ((_kit_kmixerVoice*)device->_voices.raw->ptr)
  27. #define _CAST_ORD \
  28.   ((_kit_kmixerVoice***)device->_voices.ord->ptr)
  29.  
  30.  
  31.  
  32. #define _PRINT_AUDIO_SPEC(_pref, _spec) {        \
  33.   SDL_Log(_pref".freq    =%i",(_spec).freq);     \
  34.   SDL_Log(_pref".format  =%X",(_spec).format);   \
  35.   SDL_Log(_pref".channels=%u",(_spec).channels); \
  36.   SDL_Log(_pref".silence =%u",(_spec).silence);  \
  37.   SDL_Log(_pref".samples =%u",(_spec).samples);  \
  38.   SDL_Log(_pref".size    =%u",(_spec).size);     \
  39.   SDL_Log(_pref".callback=%p",(_spec).callback); \
  40.   SDL_Log(_pref".userdata=%p",(_spec).userdata); }
  41.  
  42. #define _PRINT_AUDIO_SPEC_P(_pref, _spec_p) {        \
  43.   SDL_Log(_pref"->freq    =%i",(_spec_p)->freq);     \
  44.   SDL_Log(_pref"->format  =%X",(_spec_p)->format);   \
  45.   SDL_Log(_pref"->channels=%u",(_spec_p)->channels); \
  46.   SDL_Log(_pref"->silence =%u",(_spec_p)->silence);  \
  47.   SDL_Log(_pref"->samples =%u",(_spec_p)->samples);  \
  48.   SDL_Log(_pref"->size    =%u",(_spec_p)->size);     \
  49.   SDL_Log(_pref"->callback=%p",(_spec_p)->callback); \
  50.   SDL_Log(_pref"->userdata=%p",(_spec_p)->userdata); }
  51.  
  52.  
  53. #define _PRINT_VOICE(_pref, _voice) {                                \
  54.   SDL_Log(_pref".lock         =%p",(_voice).lock);                   \
  55.   SDL_Log(_pref".inputs       =%p",(_voice).inputs);                 \
  56.   SDL_Log(_pref".inputRefs    =%p",(_voice).inputRefs);              \
  57.   SDL_Log(_pref".output       =%p",(_voice).output);                 \
  58.   SDL_Log(_pref".bufferInput  =%p",(_voice).bufferInput.v);          \
  59.   SDL_Log(_pref".bufferUser   =%p",(_voice).bufferUser.v);           \
  60.   SDL_Log(_pref".bufferConvert=%p",(_voice).bufferConvert.v);        \
  61.   SDL_Log(_pref".bufferOutput =%p",(_voice).bufferOutput.v);         \
  62.   SDL_Log(_pref".spec={");                                           \
  63.     PRINT_VOICE_SPEC(_pref"  ", (_voice).spec)                       \
  64.   SDL_Log(_pref"}");                                                 \
  65.   SDL_Log(_pref".chainStage   =%u",(_voice).chainStage);             \
  66.   SDL_Log(_pref".index        =%u",(_voice).index);                  \
  67.   SDL_Log(_pref".volL         =%f",(_voice).volL);                   \
  68.   SDL_Log(_pref".volR         =%f",(_voice).volR);                   \
  69.   SDL_Log(_pref".applyVolume  =%s",kit_coreBoolStr[(_voice).applyVolume]);  \
  70.   SDL_Log(_pref".stereoOutput =%s",kit_coreBoolStr[(_voice).stereoOutput]); }
  71.  
  72. #define _PRINT_VOICE_P(_pref, _voice_p) {                                \
  73.   SDL_Log(_pref"->lock         =%p",(_voice_p)->lock);                   \
  74.   SDL_Log(_pref"->inputs       =%p",(_voice_p)->inputs);                 \
  75.   SDL_Log(_pref"->inputRefs    =%p",(_voice_p)->inputRefs);              \
  76.   SDL_Log(_pref"->output       =%p",(_voice_p)->output);                 \
  77.   SDL_Log(_pref"->bufferInput  =%p",(_voice_p)->bufferInput.v);          \
  78.   SDL_Log(_pref"->bufferUser   =%p",(_voice_p)->bufferUser.v);           \
  79.   SDL_Log(_pref"->bufferConvert=%p",(_voice_p)->bufferConvert.v);        \
  80.   SDL_Log(_pref"->bufferOutput =%p",(_voice_p)->bufferOutput.v);         \
  81.   SDL_Log(_pref"->spec={");                                              \
  82.     PRINT_VOICE_SPEC("  ", (_voice_p)->spec)                             \
  83.   SDL_Log(_pref"}");                                                     \
  84.   SDL_Log(_pref"->chainStage   =%u",(_voice_p)->chainStage);             \
  85.   SDL_Log(_pref"->index        =%u",(_voice_p)->index);                  \
  86.   SDL_Log(_pref"->volL         =%f",(_voice_p)->volL);                   \
  87.   SDL_Log(_pref"->volR         =%f",(_voice_p)->volR);                   \
  88.   SDL_Log(_pref"->applyVolume  =%s",kit_coreBoolStr[(_voice_p)->applyVolume]);  \
  89.   SDL_Log(_pref"->stereoOutput =%s",kit_coreBoolStr[(_voice_p)->stereoOutput]); }
  90.  
  91.  
  92.  
  93. #define _PRINT_DEVICE_P(_pref, _device_p) {                               \
  94.   SDL_Log(_pref"._magic.num=0x%p",(_device_p)->_magic.num);   \
  95.   SDL_Log(_pref"->_spec={");                                              \
  96.     _PRINT_AUDIO_SPEC(_pref"  ",(_device_p)->_spec)                       \
  97.   SDL_Log(_pref"}");                                                      \
  98.                                                                           \
  99.   SDL_Log(_pref"._lock           =%p",  (_device_p)->_lock);              \
  100.   SDL_Log(_pref"._thread.cond    =%p",  (_device_p)->_thread.cond);       \
  101.   SDL_Log(_pref"->_thread.queue  =%p {",(_device_p)->_thread.queue->ptr); \
  102.     PRINT_VECTOR(_pref"  ", (_device_p)->_thread.queue)                   \
  103.   SDL_Log(_pref"}");                                                      \
  104.                                                                           \
  105.   SDL_Log(_pref"->_thread.pool   =%p {",(_device_p)->_thread.pool->ptr);  \
  106.     PRINT_VECTOR(_pref"  ", (_device_p)->_thread.pool)                    \
  107.   SDL_Log(_pref"}");                                                      \
  108.                                                                           \
  109.   SDL_Log(_pref"->_thread.qread  =%u",  (_device_p)->_thread.qread);      \
  110.   SDL_Log(_pref"->_thread.qwrite =%u",  (_device_p)->_thread.qwrite);     \
  111.   SDL_Log(_pref"->_voices.raw    =%p {",(_device_p)->_voices.raw->ptr);   \
  112.     PRINT_VECTOR(_pref"  ", (_device_p)->_voices.raw)                     \
  113.   SDL_Log(_pref"}");                                                      \
  114.                                                                           \
  115.   SDL_Log(_pref"->_voices.ord    =%p {",(_device_p)->_voices.ord->ptr);   \
  116.     PRINT_VECTOR(_pref"  ", (_device_p)->_voices.ord)                     \
  117.   SDL_Log(_pref"}");                                                      \
  118.                                                                           \
  119.   SDL_Log(_pref"->_fadeMultiplier=%f", (_device_p)->_fadeMultiplier);     \
  120.   SDL_Log(_pref"->_fadeVolume    =%f", (_device_p)->_fadeVolume);         \
  121.   SDL_Log(_pref"->_fadeInDelay   =%u", (_device_p)->_fadeInDelay);        \
  122.   SDL_Log(_pref"->_lockCount     =%u", (_device_p)->_lockCount);          \
  123.   SDL_Log(_pref"->_devID         =%u", (_device_p)->_devID);              \
  124.   SDL_Log(_pref"->_playing       =%s",kit_coreBoolStr[(_device_p)->_playing]);   \
  125.   SDL_Log(_pref"->_closing       =%s",kit_coreBoolStr[(_device_p)->_closing]);   \
  126.   SDL_Log(_pref"->_fadeOut       =%s",kit_coreBoolStr[(_device_p)->_fadeOut]);   }
  127.  
  128.  
  129.  
  130.  
  131. #ifdef __cplusplus
  132. }
  133. #endif
  134.  
  135. #endif /* _KIT_KMIXERALLPRIVATE_H */
  136.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement