#include <cafe/ax.h>

typedef void    (*AXUserFinalMixCallback) (AX_FINAL_MIX_CB_STRUCT *info);

AXPB_ERROR_CODE AXRegisterDeviceFinalMixCallback(AXPBDeviceType device,
                                                 AXUserFinalMixCallback fcb);


device Output device.
fcb Callback function to be invoked.

Return Values

AXPB_ERROR_NONE if successful, an error of type AXPB_ERROR otherwise.


Registers an application callback function that AX will invoke at each audio frame after all the final mix for this device is performed. The function will replace the previously registered callback, if any.

The callback function can optionally change the waveforms and/or apply any final effects that it wants to. This function callback is useful for applying virtual sound type of effects.

The callback must be of type AXUserFinalMixCallback defined as follows.

typedef struct _AX_FINAL_MIX_CB_STRUCT
    s32 **data;         // pointer to an array of pointers pointing to channel buffers
    u16 numChnsIn;
    u16 numSamples;
    u16 numDevices;
    u16 numChnsOut;     // when AX invokes callback, numChnsOut = numChnsIn; 
                        // callback can tell AX how many of outputs to pick from processed samples
typedef void    (*AXUserFinalMixCallback) (AX_FINAL_MIX_CB_STRUCT *info);

The pointers are stored in L, R, SL, SR, FC, LFE order. The data being sent out is in Q(0) format at 48kHz sampling rate, if upsampling stage is set to pre final mix and at 32kHz if upsampling stage is set to post final mix.

The callback is invoked from the AX application I/O thread, which has a higher priority than application threads. All standard thread synchronization methods apply. For more information, see Basic Thread Scheduling.


Library Version Availability
Sound 2.0 Yes
Sound 1.0 Yes

Do Not Call From


See Also

Cafe Core OS (COS) Overview

Revision History

2015/06/01 Fixed links to Basic Thread topic.
2013/05/08 Automated cleanup pass.
2012/08/01 Cleanup Pass.
2012/01/26 Update to Audio API v2.0.
2011/02/21 Initial Version