Next: Functions Up: 7 Miscellaneous Previous: Constants

# Data types

This section describes all data types used with miscellaneous MIDAS functions.

## 7.2.1 MIDASecho

    typedef struct
    {
        unsigned    delay;
        int         gain;
        int         reverseChannels;
        unsigned    filterType;
    } MIDASecho;

MIDAS echo effect echo structure.

### Members

delay
  Echo delay in milliseconds, in 16.16 fixed point
gain
  Echo gain, in 16.16 fixed point
reverseChannels
  1 if the left and right channels should be reversed in the echo
filterType
  Echo filter type, see `enum` MIDASechoFilterTypes.

### Description

This structure defines a single echo of a MIDAS Digital Audio System echo effect. One or more of echoes form an echo set (MIDASechoSet), which can then be activated with MIDASaddEchoEffect.

The delay and gain values are given in 16.16 fixed point, which essentially means multiplying the value with 65536. Thus, a delay of 32 milliseconds becomes 2097152 (0x200000), and a gain of 0.5 32768 (0x8000). If reverseChannels is 1, data from the left channel is echoed on the right one and vice versa.

## 7.2.2 MIDASechoHandle

    typedef ... MIDASechoHandle;

### Description

MIDASechoHandle is an echo handle that defines an echo effect that is being used.

## 7.2.3 MIDASechoSet

    typedef struct
    {
        int         feedback;
        int         gain;
        unsigned    numEchoes;
        MIDASecho   *echoes;
    } MIDASechoSet;

MIDAS echo effect echo set structure.

### Members

feedback
  Echo effect feedback, in 16.16 fixed point
gain
  Echo effect total gain, in 16.16 fixed point
numEchoes
  Total number of echoes in the echo effect
echoes
  Pointer to the echoes

### Description

This structure defines a MIDAS Digital Audio System echo set, that can be used with MIDASaddEchoEffect. The echo set consists of one or more echoes (MIDASecho), plus two controlling variables: feedback controls the amount of feedback for the effect, ie. the amount of echoed data that is recycled back to the echo delay line, and gain controls the total gain for the effect.

The feedback and gain values are given in 16.16 fixed point, which essentially means multiplying the value with 65536. Thus, a feedback of 0.8 becomes 52428, and a gain of 0.25 16384 (0x1000). feedback typically controls the strength of the echo effect, and is kept at a value below 1, while gain can be used to decrease the total volume from the effect to reduce distortion by setting it to a value below 1. Values above 1 are also possible for both feedback and gain, but should be used with care.

## 7.2.4 MIDASpostProcessor

    typedef struct
    {
        struct _MIDASpostProcessor *next, *prev;
        void *userData;
        MIDASpostProcFunction floatMono;
        MIDASpostProcFunction floatStereo;
        MIDASpostProcFunction intMono;
        MIDASpostProcFunction intStereo;
    } MIDASpostProcessor;

MIDAS user post-processor structure.

### Members

next, prev, userData
  Reserved for MIDAS use
floatMono
  Pointer to the floating-point mono post-processor function, see MIDASpostProcFunction
floatStereo
  Pointer to the floating-point stereo post-processor function, see MIDASpostProcFunction
intMono
  Pointer to the integer mono post-processor function, see MIDASpostProcFunction
intStereo
  Pointer to the integer stereo post-processor function, see MIDASpostProcFunction

### Description

This structure describes a MIDAS Digital Audio System user post-processor, used with MIDASaddPostProcessor and MIDASremovePostProcessor. The structure consists of four function pointers, for all possible post-processing functions, plus three reserved members. If any of the post-processor function pointers is NULL, it is simply ignored.

The functions actually used depend on the mixing and output mode, but to be safe all of them should be implemented. The floating-point functions will receive 32-bit floating-point data (C `float`), and the integer ones 32-bit integers (C `int`). The sample data range is normal signed 16-bit range, -32768-32767, but the data has not been clipped yet, so smaller and larger values are also possible -- the user should clip them if necessary. The data needs to be modified in place.

Note that it is not necessary to use the post-processing functions to actually modify the data. They could also be used, for example, to gather statistics about the output sample data for spectrum analyzers. However, remember that the post-processing functions are called in the context of the MIDAS player thread or interrupt. Therefore they may not call MIDAS functions, and should be kept as simple and short as possible.

## 7.2.5 MIDASpostProcFunction

    typedef void (MIDAS_CALL *MIDASpostProcFunction)(void *data,
        unsigned numSamples, void *user);

### Description

A MIDAS user post-processing function, used with in MIDASpostProcessor structures. The function receives three arguments: pointer to the sample data to be processed, the number of samples of data to process, and an user pointer passed to MIDASaddPostProcessor.

Next: Functions Up: 7 Miscellaneous Previous: Constants