Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "../include/kit_sdl2/kit_kmixer.h"
- #include "../_private/include/_kit_privmacro.h"
- #include "../_private/include/_kit_kmixerPrivate.h"
- struct _kit_kmixerGlobals_t _kit_kmixerGlobals;
- int kit_kmixerInit(int deviceThreadPoolSize){
- if(_kit_kmixerGlobals.init){ SDL_SetError("kmixer is already initialized!"); return 1; }
- _kit_kmixerGlobals.lock=SDL_CreateMutex();
- if(_kit_kmixerGlobals.lock == NULL) return -1;
- if(SDL_LockMutex(_kit_kmixerGlobals.lock)<0) return -2;
- _kit_kmixerGlobals.cores=SDL_GetCPUCount();
- if(deviceThreadPoolSize>0) _kit_kmixerGlobals.threadPoolSize=deviceThreadPoolSize;
- else _kit_kmixerGlobals.threadPoolSize=_kit_kmixerGlobals.cores;
- _kit_kmixerGlobals.capabilities =SDL_HasSSE() <<5;
- _kit_kmixerGlobals.capabilities|=SDL_HasSSE2() <<4;
- _kit_kmixerGlobals.capabilities|=SDL_HasSSE3() <<3;
- _kit_kmixerGlobals.capabilities|=SDL_HasSSE41()<<2;
- _kit_kmixerGlobals.capabilities|=SDL_HasAVX() <<1;
- _kit_kmixerGlobals.capabilities|=SDL_HasAVX2() ;
- _kit_kmixerGlobals.init=1;
- if(SDL_UnlockMutex(_kit_kmixerGlobals.lock)<0) return -999; //change this value later
- return 0;
- }
- int kit_kmixerQuit(){
- if(!_kit_kmixerGlobals.init){ SDL_SetError("kmixer is not initialized!"); return 1; }
- if(SDL_LockMutex(_kit_kmixerGlobals.lock)<0) return -1;
- _kit_kmixerGlobals.init=0;
- if(SDL_UnlockMutex(_kit_kmixerGlobals.lock)<0) return -999; //change this value later
- SDL_DestroyMutex(_kit_kmixerGlobals.lock);
- //_kit_kmixerGlobals.lock=NULL;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement