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_kmixerAllPrivate.h"
- //todo: include mutexes where they should be
- typedef struct _kit_kmixerAsyncTrack {
- kit_acodecPCM* pcm;
- //double
- Uint64 position;
- Uint32 index;
- Uint32 timeStamp;
- SDL_bool stopOnMute;
- Uint32 _padding;
- } _kit_kmixerAsyncTrack;
- //this should be contiguous with the AsyncTrack(s)
- typedef struct _kit_kmixerAsyncUserdata {
- kit_kmixerVoiceSpec vspec;
- Uint32 numTracks;
- Uint32 padding;
- _kit_kmixerAsyncTrack* tracks;
- } _kit_kmixerAsyncUserdata;
- void _kit_kmixerAsyncRemoveCallback(void* userdata){ if(userdata != NULL) SDL_free(userdata); }
- void _kit_kmixerAsyncTrackCallback(void* userdata, void* _stream, int size, SDL_bool hasInput){
- }
- void _kit_kmixerAsyncVoiceCallback(void* userdata, void* _stream, int size, SDL_bool hasInput){
- }
- Uint32 kit_kmixerAsyncAdd(kit_kmixerDevice* device, kit_kmixerVoiceSpec* vspec,
- Uint32 outputVoiceID, Uint32 numTracks)
- {
- Uint32 newIndex = 0; //0 for error by default
- _DEVICE_VALIDITY_CHECK(0)
- _IF_SDLERR(outputVoiceID>=device->_raw->x,;,"outputVoiceID out of bounds")
- _IF_SDLERR(numTracks==0,;,"!numTracks")
- _IF_SDLERR(vspec==NULL,;,"!vspec")
- vspec->remove = _kit_kmixerAsyncRemoveCallback;
- vspec->callback = _kit_kmixerAsyncVoiceCallback;
- //(then do userdata stuff here)
- newIndex = kit_kmixerVoiceAdd(device,vspec,outputVoiceID);
- _noerr_:
- _error_:
- return newIndex;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement