diff options
-rw-r--r-- | Alc/ALc.c | 21 | ||||
-rw-r--r-- | Alc/ALu.c | 17 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 2 | ||||
-rw-r--r-- | alsoftrc.sample | 4 |
4 files changed, 36 insertions, 8 deletions
@@ -481,6 +481,9 @@ static ALvoid InitContext(ALCcontext *pContext) pContext->lNumMonoSources = pContext->Device->MaxNoOfSources - pContext->lNumStereoSources; pContext->AuxiliaryEffectSlotMax = GetConfigValueInt(NULL, "slots", 4); + pContext->NumSends = GetConfigValueInt(NULL, "sends", MAX_SENDS); + if(pContext->NumSends > MAX_SENDS) + pContext->NumSends = MAX_SENDS; pContext->ExtensionList = "AL_EXTX_buffer_sub_data AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_OFFSET AL_EXTX_source_distance_model AL_LOKI_quadriphonic"; @@ -819,6 +822,8 @@ ALCAPI ALCvoid ALCAPIENTRY alcGetIntegerv(ALCdevice *device,ALCenum param,ALsize case ALC_MAX_AUXILIARY_SENDS: if(!size) SetALCError(ALC_INVALID_VALUE); + else if(device && device->Context) + *data = device->Context->NumSends; else *data = MAX_SENDS; break; @@ -860,7 +865,7 @@ ALCAPI ALCvoid ALCAPIENTRY alcGetIntegerv(ALCdevice *device,ALCenum param,ALsize data[i++] = device->Context->lNumStereoSources; data[i++] = ALC_MAX_AUXILIARY_SENDS; - data[i++] = MAX_SENDS; + data[i++] = device->Context->NumSends; } ProcessContext(NULL); @@ -1025,6 +1030,7 @@ ALCAPI ALCcontext* ALCAPIENTRY alcCreateContext(ALCdevice *device, const ALCint { ALCcontext *ALContext = NULL; ALuint ulAttributeIndex, ulRequestedStereoSources; + ALuint RequestedSends; if ((device)&&(!device->IsCaptureDevice)) { @@ -1054,7 +1060,7 @@ ALCAPI ALCcontext* ALCAPIENTRY alcCreateContext(ALCdevice *device, const ALCint ProcessContext(NULL); - // Check for Voice Count attributes + // Check for attributes if (attrList) { ulAttributeIndex = 0; @@ -1069,7 +1075,16 @@ ALCAPI ALCcontext* ALCAPIENTRY alcCreateContext(ALCdevice *device, const ALCint ALContext->lNumStereoSources = ulRequestedStereoSources; ALContext->lNumMonoSources = ALContext->Device->MaxNoOfSources - ALContext->lNumStereoSources; - break; + } + + if(attrList[ulAttributeIndex] == ALC_MAX_AUXILIARY_SENDS) + { + RequestedSends = attrList[ulAttributeIndex + 1]; + + if(RequestedSends > ALContext->NumSends) + RequestedSends = ALContext->NumSends; + + ALContext->NumSends = RequestedSends; } ulAttributeIndex += 2; @@ -573,12 +573,14 @@ static ALvoid CalcSourceParams(const ALCcontext *ALContext, ALfloat DryGainHF = 1.0f; ALfloat DirGain, AmbientGain; const ALfloat *SpeakerGain; + ALint NumSends; ALint pos, s, i; //Get context properties DopplerFactor = ALContext->DopplerFactor * ALSource->DopplerFactor; DopplerVelocity = ALContext->DopplerVelocity; flSpeedOfSound = ALContext->flSpeedOfSound; + NumSends = ALContext->NumSends; //Get listener properties ListenerGain = ALContext->Listener.Gain; @@ -666,7 +668,7 @@ static ALvoid CalcSourceParams(const ALCcontext *ALContext, { if ((MinDist + (Rolloff * (Distance - MinDist))) > 0.0f) flAttenuation = MinDist / (MinDist + (Rolloff * (Distance - MinDist))); - for(i = 0;i < MAX_SENDS;i++) + for(i = 0;i < NumSends;i++) { if ((MinDist + (RoomRolloff[i] * (Distance - MinDist))) > 0.0f) RoomAttenuation[i] = MinDist / (MinDist + (RoomRolloff[i] * (Distance - MinDist))); @@ -685,7 +687,7 @@ static ALvoid CalcSourceParams(const ALCcontext *ALContext, if (MaxDist != MinDist) { flAttenuation = 1.0f - (Rolloff*(Distance-MinDist)/(MaxDist - MinDist)); - for(i = 0;i < MAX_SENDS;i++) + for(i = 0;i < NumSends;i++) RoomAttenuation[i] = 1.0f - (RoomRolloff[i]*(Distance-MinDist)/(MaxDist - MinDist)); } break; @@ -700,7 +702,7 @@ static ALvoid CalcSourceParams(const ALCcontext *ALContext, if ((Distance > 0.0f) && (MinDist > 0.0f)) { flAttenuation = (ALfloat)pow(Distance/MinDist, -Rolloff); - for(i = 0;i < MAX_SENDS;i++) + for(i = 0;i < NumSends;i++) RoomAttenuation[i] = (ALfloat)pow(Distance/MinDist, -RoomRolloff[i]); } break; @@ -714,7 +716,7 @@ static ALvoid CalcSourceParams(const ALCcontext *ALContext, DryMix = __min(DryMix,MaxVolume); DryMix = __max(DryMix,MinVolume); - for(i = 0;i < MAX_SENDS;i++) + for(i = 0;i < NumSends;i++) { ALfloat WetMix = SourceVolume * RoomAttenuation[i]; WetMix = __min(WetMix,MaxVolume); @@ -792,7 +794,7 @@ static ALvoid CalcSourceParams(const ALCcontext *ALContext, else pitch[0] = ALSource->flPitch; - for(i = 0;i < MAX_SENDS;i++) + for(i = 0;i < NumSends;i++) { if(ALSource->Send[i].Slot && ALSource->Send[i].Slot->effect.type != AL_EFFECT_NULL) @@ -836,6 +838,11 @@ static ALvoid CalcSourceParams(const ALCcontext *ALContext, wetgainhf[i] = 1.0f; } } + for(i = NumSends;i < MAX_SENDS;i++) + { + wetsend[i] = 0.0f; + wetgainhf[i] = 1.0f; + } //5. Apply filter gains and filters switch(ALSource->DirectFilter.type) diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 66102b8b..bb82d8e1 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -211,6 +211,8 @@ struct ALCcontext_struct ALint lNumMonoSources; ALint lNumStereoSources; + ALuint NumSends; + ALfloat PanningLUT[OUTPUTCHANNELS * LUT_NUM]; ALint NumChan; diff --git a/alsoftrc.sample b/alsoftrc.sample index 855b862e..aede54a5 100644 --- a/alsoftrc.sample +++ b/alsoftrc.sample @@ -72,6 +72,10 @@ slots = 4 # Sets the maximum number of Auxiliary Effect Slots an app can # effect is set on it even if no sources are feeding it, so this may # help when apps use more than the system can handle. Default is 4 +sends = 1 # Sets the maximum number of auxiliary sends per source. The total + # number of sends possible is defined at compile time and thus can + # not be increased beyond the default. Default is 1 + layout_STEREO = # Sets the speaker layout when using stereo output. Values are # specified in degrees, where 0 is straight in front, negative # goes left, and positive goes right. The values must define a |