diff OpenAL32/Include/alSource.h @ 0:f9476ff7637e

initial forking of open-al to create multiple listeners
author Robert McIntyre <rlm@mit.edu>
date Tue, 25 Oct 2011 13:02:31 -0700
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/OpenAL32/Include/alSource.h	Tue Oct 25 13:02:31 2011 -0700
     1.3 @@ -0,0 +1,142 @@
     1.4 +#ifndef _AL_SOURCE_H_
     1.5 +#define _AL_SOURCE_H_
     1.6 +
     1.7 +#define MAX_SENDS                 4
     1.8 +
     1.9 +#include "alFilter.h"
    1.10 +#include "alu.h"
    1.11 +#include "AL/al.h"
    1.12 +
    1.13 +#ifdef __cplusplus
    1.14 +extern "C" {
    1.15 +#endif
    1.16 +
    1.17 +#define SRC_HISTORY_BITS   (6)
    1.18 +#define SRC_HISTORY_LENGTH (1<<SRC_HISTORY_BITS)
    1.19 +#define SRC_HISTORY_MASK   (SRC_HISTORY_LENGTH-1)
    1.20 +
    1.21 +extern enum Resampler DefaultResampler;
    1.22 +
    1.23 +extern const ALsizei ResamplerPadding[RESAMPLER_MAX];
    1.24 +extern const ALsizei ResamplerPrePadding[RESAMPLER_MAX];
    1.25 +
    1.26 +
    1.27 +typedef struct ALbufferlistitem
    1.28 +{
    1.29 +    struct ALbuffer         *buffer;
    1.30 +    struct ALbufferlistitem *next;
    1.31 +    struct ALbufferlistitem *prev;
    1.32 +} ALbufferlistitem;
    1.33 +
    1.34 +typedef struct ALsource
    1.35 +{
    1.36 +    ALfloat      flPitch;
    1.37 +    ALfloat      flGain;
    1.38 +    ALfloat      flOuterGain;
    1.39 +    ALfloat      flMinGain;
    1.40 +    ALfloat      flMaxGain;
    1.41 +    ALfloat      flInnerAngle;
    1.42 +    ALfloat      flOuterAngle;
    1.43 +    ALfloat      flRefDistance;
    1.44 +    ALfloat      flMaxDistance;
    1.45 +    ALfloat      flRollOffFactor;
    1.46 +    ALfloat      vPosition[3];
    1.47 +    ALfloat      vVelocity[3];
    1.48 +    ALfloat      vOrientation[3];
    1.49 +    ALboolean    bHeadRelative;
    1.50 +    ALboolean    bLooping;
    1.51 +    enum DistanceModel DistanceModel;
    1.52 +    ALboolean    VirtualChannels;
    1.53 +
    1.54 +    enum Resampler Resampler;
    1.55 +
    1.56 +    ALenum       state;
    1.57 +    ALenum       new_state;
    1.58 +    ALuint       position;
    1.59 +    ALuint       position_fraction;
    1.60 +
    1.61 +    struct ALbuffer *Buffer;
    1.62 +
    1.63 +    ALbufferlistitem *queue; // Linked list of buffers in queue
    1.64 +    ALuint BuffersInQueue;   // Number of buffers in queue
    1.65 +    ALuint BuffersPlayed;    // Number of buffers played on this loop
    1.66 +
    1.67 +    ALfilter DirectFilter;
    1.68 +
    1.69 +    struct {
    1.70 +        struct ALeffectslot *Slot;
    1.71 +        ALfilter WetFilter;
    1.72 +    } Send[MAX_SENDS];
    1.73 +
    1.74 +    ALboolean DryGainHFAuto;
    1.75 +    ALboolean WetGainAuto;
    1.76 +    ALboolean WetGainHFAuto;
    1.77 +    ALfloat   OuterGainHF;
    1.78 +
    1.79 +    ALfloat AirAbsorptionFactor;
    1.80 +    ALfloat RoomRolloffFactor;
    1.81 +    ALfloat DopplerFactor;
    1.82 +
    1.83 +    ALint  lOffset;
    1.84 +    ALint  lOffsetType;
    1.85 +
    1.86 +    // Source Type (Static, Streaming, or Undetermined)
    1.87 +    ALint  lSourceType;
    1.88 +
    1.89 +    ALuint NumChannels;
    1.90 +    ALuint SampleSize;
    1.91 +
    1.92 +    /* HRTF info */
    1.93 +    ALboolean HrtfMoving;
    1.94 +    ALuint HrtfCounter;
    1.95 +    ALfloat HrtfHistory[MAXCHANNELS][SRC_HISTORY_LENGTH];
    1.96 +    ALfloat HrtfValues[MAXCHANNELS][HRIR_LENGTH][2];
    1.97 +    ALuint HrtfOffset;
    1.98 +
    1.99 +    /* Current target parameters used for mixing */
   1.100 +    struct {
   1.101 +        MixerFunc DoMix;
   1.102 +
   1.103 +        ALint Step;
   1.104 +
   1.105 +        ALfloat HrtfGain;
   1.106 +        ALfloat HrtfDir[3];
   1.107 +        ALfloat HrtfCoeffs[MAXCHANNELS][HRIR_LENGTH][2];
   1.108 +        ALuint HrtfDelay[MAXCHANNELS][2];
   1.109 +        ALfloat HrtfCoeffStep[HRIR_LENGTH][2];
   1.110 +        ALint HrtfDelayStep[2];
   1.111 +
   1.112 +        /* A mixing matrix. First subscript is the channel number of the input
   1.113 +         * data (regardless of channel configuration) and the second is the
   1.114 +         * channel target (eg. FRONT_LEFT) */
   1.115 +        ALfloat DryGains[MAXCHANNELS][MAXCHANNELS];
   1.116 +
   1.117 +        FILTER iirFilter;
   1.118 +        ALfloat history[MAXCHANNELS*2];
   1.119 +
   1.120 +        struct {
   1.121 +            struct ALeffectslot *Slot;
   1.122 +            ALfloat WetGain;
   1.123 +            FILTER iirFilter;
   1.124 +            ALfloat history[MAXCHANNELS];
   1.125 +        } Send[MAX_SENDS];
   1.126 +    } Params;
   1.127 +    ALboolean NeedsUpdate;
   1.128 +
   1.129 +    ALvoid (*Update)(struct ALsource *self, const ALCcontext *context);
   1.130 +
   1.131 +    // Index to itself
   1.132 +    ALuint source;
   1.133 +} ALsource;
   1.134 +#define ALsource_Update(s,a)                 ((s)->Update(s,a))
   1.135 +
   1.136 +ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state);
   1.137 +ALboolean ApplyOffset(ALsource *Source);
   1.138 +
   1.139 +ALvoid ReleaseALSources(ALCcontext *Context);
   1.140 +
   1.141 +#ifdef __cplusplus
   1.142 +}
   1.143 +#endif
   1.144 +
   1.145 +#endif