[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.6.1 Mix_RegisterEffect

int Mix_RegisterEffect(int chan, Mix_EffectFunc_t f, Mix_EffectDone_t d,
                       void *arg)

channel number to register f and d on.
Use MIX_CHANNEL_POST to process the postmix stream.
The function pointer for the effects processor.
The function pointer for any cleanup routine to be called when the channel is done playing a sample.
This may be NULL for any processors that don't need to clean up any memory or other dynamic data.
A pointer to data to pass into the f's and d's udata parameter. It is a good place to keep the state data for the processor, especially if the processor is made to handle multiple channels at the same time.
This may be NULL, depending on the processor.

Hook a processor function f into a channel for post processing effects. You may just be reading the data and displaying it, or you may be altering the stream to add an echo. Most processors also have state data that they allocate as they are in use, this would be stored in the arg pointer data space. When a processor is finished being used, any function passed into d will be called, which is when your processor should clean up the data in the arg data space.
The effects are put into a linked list, and always appended to the end, meaning they always work on previously registered effects output. Effects may be added multiple times in a row. Effects are cumulative this way.

Returns: Zero on errors, such as a nonexisting channel.

// make a passthru processor function that does nothing...
void noEffect(int chan, void *stream, int len, void *udata)
    // you could work with stream here...
// register noEffect as a postmix processor
if(!Mix_RegisterEffect(MIX_CHANNEL_POST, noEffect, NULL, NULL)) {
    printf("Mix_RegisterEffect: %s\n", Mix_GetError());

See Also:
4.6.2 Mix_UnregisterEffect, 4.6.3 Mix_UnregisterAllEffects

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on November, 13 2009 using texi2html