1 | /* -*- mode: C; tab-width:8; c-basic-offset:8 -*- |
---|
2 | * vi:set ts=8: |
---|
3 | * |
---|
4 | * al_mixmanager.h |
---|
5 | * |
---|
6 | * Interface to the mixmanager. The mix manager is an abstraction such |
---|
7 | * that repeated calls to mix audio data can be collected into one set, |
---|
8 | * so that optimizations can be performed based on the number of data |
---|
9 | * streams that need to be mixed simultaneously. |
---|
10 | * |
---|
11 | */ |
---|
12 | #ifndef _AL_MIXMANAGER_H_ |
---|
13 | #define _AL_MIXMANAGER_H_ |
---|
14 | |
---|
15 | #include "al_types.h" |
---|
16 | #include "al_mixfunc.h" |
---|
17 | |
---|
18 | /* |
---|
19 | * Our mix manager. |
---|
20 | * |
---|
21 | * By using a mix manager, I hope to pool together the calls to |
---|
22 | * mix audio, in essence loop unrolling on the fly. Instead of |
---|
23 | * mixing each source's outdata directly onto the mix buffer, we |
---|
24 | * add an entry to the MixManager, which after it has collected |
---|
25 | * all sources for the mixer_iteration interval uses a MixAudio |
---|
26 | * call optimized for the number of sources present. |
---|
27 | * |
---|
28 | * Used in conjunction with MixFuncs |
---|
29 | */ |
---|
30 | typedef struct _AL_MixManager { |
---|
31 | alMixEntry *pool; |
---|
32 | ALuint size; |
---|
33 | ALuint index; |
---|
34 | } ALMixManager; |
---|
35 | |
---|
36 | /* Mix manager funcs */ |
---|
37 | |
---|
38 | /* |
---|
39 | * Initializes the already allocated ALMixManager object *mixman, to |
---|
40 | * accomodate at least size entries. |
---|
41 | */ |
---|
42 | ALboolean _alMixManagerInit( ALMixManager *mixman, ALuint size ); |
---|
43 | |
---|
44 | /* |
---|
45 | * Performs finalization on the ALMixManager object *mixman. |
---|
46 | */ |
---|
47 | void _alMixManagerDestroy( ALMixManager *mixman ); |
---|
48 | |
---|
49 | /* |
---|
50 | * Adds an entry to the ALMixManager object *mixman, with data dataptr of |
---|
51 | * length bytes_to_write in bytes. |
---|
52 | */ |
---|
53 | void _alMixManagerAdd( ALMixManager *mixman, ALvoid *dataptr, int bytes_to_write ); |
---|
54 | |
---|
55 | /* |
---|
56 | * Mixes each entry in ALMixManager *mixman, using mixing functions from |
---|
57 | * ALMixFunc, populating dataptr. |
---|
58 | */ |
---|
59 | void _alMixManagerMix( ALMixManager *mixman, ALMixFunc *mf, ALvoid *dataptr ); |
---|
60 | |
---|
61 | #endif /* _AL_MIXMANAGER_H_ */ |
---|