[17] | 1 | /* -*- mode: C; tab-width:8; c-basic-offset:8 -*- |
---|
| 2 | * vi:set ts=8: |
---|
| 3 | * |
---|
| 4 | * al_mixer.h |
---|
| 5 | * |
---|
| 6 | * Prototypes, macros and definitions related to the control and |
---|
| 7 | * execution of the mixing "thread". |
---|
| 8 | * |
---|
| 9 | * The mixing "thread" is responsible for managing playing sources, |
---|
| 10 | * applying the requisite filters, mixing in audio data from said sources, |
---|
| 11 | * etc. |
---|
| 12 | * |
---|
| 13 | */ |
---|
| 14 | #ifndef _AL_MIXER_H_ |
---|
| 15 | #define _AL_MIXER_H_ |
---|
| 16 | |
---|
| 17 | #include <AL/al.h> |
---|
| 18 | #include "al_siteconfig.h" |
---|
| 19 | |
---|
| 20 | /* |
---|
| 21 | * Number of sources for which optimized mixing functions exist. |
---|
| 22 | */ |
---|
| 23 | #ifdef USE_LIGHT_GEN_MIXING |
---|
| 24 | #define GENMIXSOURCES 8 |
---|
| 25 | #else |
---|
| 26 | #define GENMIXSOURCES 64 |
---|
| 27 | #endif /* USE_LIGHT_GEN_MIXING */ |
---|
| 28 | |
---|
| 29 | #ifdef __MMX__ |
---|
| 30 | #define MMXMIXSOURCES 32 |
---|
| 31 | #else |
---|
| 32 | #define MMXMIXSOURCES 0 |
---|
| 33 | #endif /* __MMX__ */ |
---|
| 34 | |
---|
| 35 | /* set MAXMIXSOURCES to MAX */ |
---|
| 36 | #if GENMIXSOURCES<MMXMIXSOURCES |
---|
| 37 | #define MAXMIXSOURCES MMXMIXSOURCES |
---|
| 38 | #else |
---|
| 39 | #define MAXMIXSOURCES GENMIXSOURCES |
---|
| 40 | #endif |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | /* |
---|
| 44 | * our main mixing function. |
---|
| 45 | */ |
---|
| 46 | extern int (*mixer_iterate)( void *dummy ); |
---|
| 47 | |
---|
| 48 | /* |
---|
| 49 | * The mixing function checks this variable for equality with AL_TRUE. When |
---|
| 50 | * this is the case, it exits. The default is AL_FALSE. |
---|
| 51 | */ |
---|
| 52 | extern volatile ALboolean time_for_mixer_to_die; |
---|
| 53 | |
---|
| 54 | /* |
---|
| 55 | * Create and initialize data structures needed by the mixing function. |
---|
| 56 | */ |
---|
| 57 | ALboolean _alInitMixer( void ); |
---|
| 58 | |
---|
| 59 | /* |
---|
| 60 | * Inform the mixer that settings may have changed. Data structures can |
---|
| 61 | * be/are updated to reflect new settings in the current context. |
---|
| 62 | * |
---|
| 63 | * Synchronous, if AL_FALSE, causes a new thread to be launched. |
---|
| 64 | */ |
---|
| 65 | void _alSetMixer( ALboolean synchronous ); |
---|
| 66 | |
---|
| 67 | /* |
---|
| 68 | * Deallocate data allocated in _alInitMixer. |
---|
| 69 | */ |
---|
| 70 | void _alDestroyMixer( void ); |
---|
| 71 | |
---|
| 72 | /* |
---|
| 73 | * "play" the source named by sid. If sid does not refer to a valid source, |
---|
| 74 | * AL_INVALID_NAME is set. |
---|
| 75 | */ |
---|
| 76 | void _alAddSourceToMixer( ALuint sid ); |
---|
| 77 | |
---|
| 78 | /* |
---|
| 79 | * "stop" the source named by sid. If sid does not refer to a valid source, |
---|
| 80 | * AL_INVALID_NAME is set. |
---|
| 81 | */ |
---|
| 82 | ALboolean _alRemoveSourceFromMixer( ALuint sid ); |
---|
| 83 | |
---|
| 84 | /* |
---|
| 85 | * "start" the capture named by cpid. If cpid does not refer to a valid |
---|
| 86 | * capture, AL_INVALID_NAME is set. |
---|
| 87 | */ |
---|
| 88 | void _alAddCaptureToMixer( ALuint cpid ); |
---|
| 89 | |
---|
| 90 | /* |
---|
| 91 | * "stop" the capture named by cpid. If cpid does not refer to a valid |
---|
| 92 | * capture, AL_INVALID_NAME is set. |
---|
| 93 | */ |
---|
| 94 | void _alRemoveCaptureFromMixer( ALuint cpid ); |
---|
| 95 | |
---|
| 96 | /* |
---|
| 97 | * Lock the mixer mutex, handing fn and ln to _alLockPrintf |
---|
| 98 | */ |
---|
| 99 | void FL_alLockMixBuf( const char *fn, int ln ); |
---|
| 100 | |
---|
| 101 | /* |
---|
| 102 | * Unlock the mixer mutex, handing fn and ln to _alLockPrintf |
---|
| 103 | */ |
---|
| 104 | void FL_alUnlockMixBuf( const char *fn, int ln ); |
---|
| 105 | |
---|
| 106 | /* |
---|
| 107 | * functions to pause async mixer. Oy Vey |
---|
| 108 | */ |
---|
| 109 | |
---|
| 110 | /* |
---|
| 111 | * Lock the MixerPause mutex, which is use to "pause" the mixer. |
---|
| 112 | */ |
---|
| 113 | void _alLockMixerPause( void ); |
---|
| 114 | |
---|
| 115 | /* |
---|
| 116 | * Unlock the MixerPause mutex, which is use to "resume" the mixer. |
---|
| 117 | */ |
---|
| 118 | void _alUnlockMixerPause( void ); |
---|
| 119 | |
---|
| 120 | /* macro madness */ |
---|
| 121 | #define _alLockMixBuf() FL_alLockMixBuf(__FILE__, __LINE__) |
---|
| 122 | #define _alUnlockMixBuf() FL_alUnlockMixBuf(__FILE__, __LINE__) |
---|
| 123 | |
---|
| 124 | #endif |
---|