This section describes all data types used with miscellaneous MIDAS functions.
typedef struct { unsigned delay; int gain; int reverseChannels; unsigned filterType; } MIDASecho;
MIDAS echo effect echo structure.
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.
typedef ... MIDASechoHandle;
MIDASechoHandle is an echo handle that defines an echo effect that is being used.
typedef struct { int feedback; int gain; unsigned numEchoes; MIDASecho *echoes; } MIDASechoSet;
MIDAS echo effect echo set structure.
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.
typedef struct { struct _MIDASpostProcessor *next, *prev; void *userData; MIDASpostProcFunction floatMono; MIDASpostProcFunction floatStereo; MIDASpostProcFunction intMono; MIDASpostProcFunction intStereo; } MIDASpostProcessor;
MIDAS user post-processor structure.
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.
typedef void (MIDAS_CALL *MIDASpostProcFunction)(void *data, unsigned numSamples, void *user);
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.