Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * \file kit_kmixer.h
- * \brief Header file for KIT SDL2's KMixer module
- */
- #ifndef _KIT_KMIXER_H
- #define _KIT_KMIXER_H
- #ifndef _KIT_SDL2_KMIXER_H
- #define _KIT_SDL2_KMIXER_H
- //#include <SDL2/SDL.h>
- #include "./kit_core.h"
- /* +kit_kmixer+ */
- extern int kit_kmixerInit(int deviceThreadPoolSize);
- extern int kit_kmixerQuit();
- /* -kit_kmixer- */
- /* +kit_kmixerVoice+ */
- /**
- * PCM Audio Voice Callback
- * This type of function is called when added as a voice to a KMixer audio device.
- * Unless it's a capture (recording) type, you can add multiple voices or returns to a KMixer device.
- * While each voice's callback is given its own threadpool task (and should be thread-safe),
- * the overall speed is determined by device's slowest voice or return chain (processing-wise).
- * For a capture-type device, the given audio buffer must be completely read before returning.
- * For a rendering (playback) device, the buffer must be completely filled before returning.
- * \param[in] userdata A user-defined pointer passed to the voice callback.
- * \param[in] _stream A pointer to the audio data buffer.
- * \param[in] len The length of that buffer in samples (number of sample *frames* is len/<# of channels>).
- */
- typedef void (*kit_kmixerVoiceCallback) (void* userdata, void* _stream, int len);
- /* -kit_kmixerVoice- */
- /* +kit_kmixerDevice+ */
- /**
- * \brief This struct contains all info related to a an audio device and its voice chain
- */
- typedef struct {
- union {
- char str[8]; ///< \brief String portion of struct ID ("kmxrDev\x00").
- Uint64 num; ///< \brief Integer portion of struct ID (0x0076654472786D6B).
- } /* ---------- */ _magic; ///< \brief Struct ID number; union of Uint64 and char[8].
- SDL_AudioSpec spec; ///< \brief Audio specification of the device.
- SDL_mutex* _lock; ///< \brief Mutex for device access (lock unnecessary for accessing some members).
- struct {
- SDL_cond* cond; ///< \brief < TBD >
- kit_coreVector* queue; ///< \brief Circular buffer that contains currently queued voice tasks.
- kit_coreVector* pool; ///< \brief The thread pool for voice tasks
- } /* --------- */ _thread; ///< \brief The device's thread pool voice task queue.
- struct {
- kit_coreVector* raw; ///< \brief 1D array of all registered voices and their information.
- kit_coreVector* ord; ///< \brief 2D array of voices and their info, ordered by number of input voices.
- } /* --------- */ _voices; ///< \brief The device's registered voices
- SDL_AudioDeviceID _devID; ///< \brief The device ID number that SDL uses.
- } kit_kmixerDevice;
- /* -kit_kmixerDevice- */
- #endif /* _KIT_SDL2_KMIXER_H */
- #endif /* _KIT_KMIXER_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement