Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef _KIT_KMIXERPRIVATE_H
- #define _KIT_KMIXERPRIVATE_H
- struct _kit_kmixerGlobals_t {
- SDL_mutex* lock;
- int threadPoolSize, cores, capabilities;
- int init;
- };
- extern struct _kit_kmixerGlobals_t _kit_kmixerGlobals;
- typedef union {
- void* ptr;
- Uint8* u_8;
- Sint16* i16;
- Sint32* i32;
- float* f32;
- } _mono_samples;
- //(stores left and right ear components of a stereo stream)
- typedef struct { Uint8 l,r; } _stereo_samples_u_8;
- typedef struct { Sint16 l,r; } _stereo_samples_i16;
- typedef struct { Sint32 l,r; } _stereo_samples_i32;
- typedef struct { float l,r; } _stereo_samples_f32;
- typedef union {
- void* ptr;
- _stereo_samples_u_8* u_8;
- _stereo_samples_i16* i16;
- _stereo_samples_i32* i32;
- _stereo_samples_f32* f32;
- } _stereo_samples;
- typedef union {
- void* v;
- _mono_samples m;
- _stereo_samples s;
- } _kit_kmixerVoiceBuffer;
- typedef union {
- void* v;
- float* m;
- _stereo_samples_f32* s;
- } _kit_kmixerVoiceBufferF;
- typedef struct {
- _kit_kmixerVoiceBufferF bufferInput; //input buffer (or the mixing stage's output)
- _kit_kmixerVoiceBufferF bufferType; //output of type conversion to f32 (always stereo size)
- _kit_kmixerVoiceBufferF bufferChannel; //output of mono-stereo or stereo-mono conversion (always stereo size)
- _kit_kmixerVoiceBuffer bufferUser; //buffer to be filled in or modified by user
- _kit_kmixerVoiceBufferF bufferOutput; //final output buffer (or the mixing stage's input)
- SDL_mutex* lock; //to make sure a voice doesn't get deleted while it's processing
- kit_kmixerVoiceCallback callback; //user-implemented callback for processing audio data
- void* userdata; //user-defined pointer to be passed to the kit_kmixerVoiceCallback
- kit_coreVector* inputs; //indexes of input voices, if any (can be NULL)
- Uint32 _padding32; //for padding to a multiple of 8 bytes
- Uint32 index; //index of this specific voice in the device's voice list
- Uint32 sampleRate; //samples per second, in Hz
- Uint32 bufferUser_size; //size of inBuffer, in bytes
- //volume can actually be <0, but for volL it will override applyVolume to SDL_FALSE,
- //and for volR, volR would then be set to volL
- float volL; //left ear volume (or total volume if mono); 0.0 -> 1.0
- float volR; //right ear volume (ignored if mono); 0.0 -> 1.0
- SDL_bool applyVolume; //if SDL_TRUE, apply volume when mixing voice's output
- SDL_bool stereoInput; //input is mono if SDL_FALSE, stereo if SDL_TRUE
- SDL_bool stereoUser; //voice is mono if SDL_FALSE, stereo if SDL_TRUE
- SDL_bool stereoOutput; //output is mono if SDL_FALSE, stereo if SDL_TRUE
- Uint16 sampleFrames; //number of sample frames in the audio stream
- SDL_AudioFormat formatInput; //data type of input buffer
- SDL_AudioFormat formatUser; //data type of voice (user) buffer
- SDL_AudioFormat formatOutput; //data type of output buffer
- //Uint16 _padding16; //for padding to a multiple of 8 bytes
- } /*__attribute__((packed))*/ _kit_kmixerVoice;
- extern int _kit_kmixerVoiceProc(void* data);
- extern void _kit_kmixerVoiceMix(_kit_kmixerVoice* ovoice,
- _kit_kmixerVoice* ivoices, Uint32 ivoices_len);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement