mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-12-23 16:21:50 +01:00
wiiu: audio fixes
This commit is contained in:
parent
2ec0e7f27e
commit
f9b5b7e016
@ -276,33 +276,30 @@ int ALDeviceList::GetNextFilteredDevice()
|
|||||||
*/
|
*/
|
||||||
unsigned int ALDeviceList::GetMaxNumSources()
|
unsigned int ALDeviceList::GetMaxNumSources()
|
||||||
{
|
{
|
||||||
// ALuint uiSources[256];
|
ALuint uiSources[256];
|
||||||
// unsigned int iSourceCount = 0;
|
unsigned int iSourceCount = 0;
|
||||||
|
|
||||||
// // Clear AL Error Code
|
// Clear AL Error Code
|
||||||
// alGetError();
|
alGetError();
|
||||||
|
|
||||||
// // Generate up to 256 Sources, checking for any errors
|
// Generate up to 256 Sources, checking for any errors
|
||||||
// for (iSourceCount = 0; iSourceCount < 256; iSourceCount++)
|
for (iSourceCount = 0; iSourceCount < 256; iSourceCount++)
|
||||||
// {
|
{
|
||||||
// alGenSources(1, &uiSources[iSourceCount]);
|
alGenSources(1, &uiSources[iSourceCount]);
|
||||||
// if (alGetError() != AL_NO_ERROR)
|
if (alGetError() != AL_NO_ERROR)
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Release the Sources
|
// Release the Sources
|
||||||
// alDeleteSources(iSourceCount, uiSources);
|
alDeleteSources(iSourceCount, uiSources);
|
||||||
// if (alGetError() != AL_NO_ERROR)
|
if (alGetError() != AL_NO_ERROR)
|
||||||
// {
|
{
|
||||||
// for (unsigned int i = 0; i < 256; i++)
|
for (unsigned int i = 0; i < 256; i++)
|
||||||
// {
|
{
|
||||||
// alDeleteSources(1, &uiSources[i]);
|
alDeleteSources(1, &uiSources[i]);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// return iSourceCount;
|
return iSourceCount;
|
||||||
|
|
||||||
// allocating sources until it errors seems to just crash. using a hardcoded value for now
|
|
||||||
return 100;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -57,7 +57,7 @@ void CChannel::Init(bool Is2D)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( IsFXSupported() )
|
if ( IsFXSupported() )
|
||||||
reAlGenFilters(1,&alFilter);
|
alGenFilters(1,&alFilter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ void CChannel::Term()
|
|||||||
alSource3i(alSource, AL_AUXILIARY_SEND_FILTER, AL_EFFECTSLOT_NULL, 0, AL_FILTER_NULL);
|
alSource3i(alSource, AL_AUXILIARY_SEND_FILTER, AL_EFFECTSLOT_NULL, 0, AL_FILTER_NULL);
|
||||||
|
|
||||||
if(alFilter != AL_FILTER_NULL)
|
if(alFilter != AL_FILTER_NULL)
|
||||||
reAlDeleteFilters(1,&alFilter);
|
alDeleteFilters(1,&alFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
alDeleteSources(1, &alSource);
|
alDeleteSources(1, &alSource);
|
||||||
|
@ -3,89 +3,93 @@
|
|||||||
|
|
||||||
#ifdef AUDIO_OAL
|
#ifdef AUDIO_OAL
|
||||||
|
|
||||||
LPALGENEFFECTS reAlGenEffects;
|
#ifndef __WIIU__
|
||||||
LPALDELETEEFFECTS reAlDeleteEffects;
|
LPALGENEFFECTS alGenEffects;
|
||||||
LPALISEFFECT reAlIsEffect;
|
LPALDELETEEFFECTS alDeleteEffects;
|
||||||
LPALEFFECTI reAlEffecti;
|
LPALISEFFECT alIsEffect;
|
||||||
LPALEFFECTIV reAlEffectiv;
|
LPALEFFECTI alEffecti;
|
||||||
LPALEFFECTF reAlEffectf;
|
LPALEFFECTIV alEffectiv;
|
||||||
LPALEFFECTFV reAlEffectfv;
|
LPALEFFECTF alEffectf;
|
||||||
LPALGETEFFECTI reAlGetEffecti;
|
LPALEFFECTFV alEffectfv;
|
||||||
LPALGETEFFECTIV reAlGetEffectiv;
|
LPALGETEFFECTI alGetEffecti;
|
||||||
LPALGETEFFECTF reAlGetEffectf;
|
LPALGETEFFECTIV alGetEffectiv;
|
||||||
LPALGETEFFECTFV reAlGetEffectfv;
|
LPALGETEFFECTF alGetEffectf;
|
||||||
LPALGENAUXILIARYEFFECTSLOTS reAlGenAuxiliaryEffectSlots;
|
LPALGETEFFECTFV alGetEffectfv;
|
||||||
LPALDELETEAUXILIARYEFFECTSLOTS reAlDeleteAuxiliaryEffectSlots;
|
LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots;
|
||||||
LPALISAUXILIARYEFFECTSLOT reAlIsAuxiliaryEffectSlot;
|
LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots;
|
||||||
LPALAUXILIARYEFFECTSLOTI reAlAuxiliaryEffectSloti;
|
LPALISAUXILIARYEFFECTSLOT alIsAuxiliaryEffectSlot;
|
||||||
LPALAUXILIARYEFFECTSLOTIV reAlAuxiliaryEffectSlotiv;
|
LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti;
|
||||||
LPALAUXILIARYEFFECTSLOTF reAlAuxiliaryEffectSlotf;
|
LPALAUXILIARYEFFECTSLOTIV alAuxiliaryEffectSlotiv;
|
||||||
LPALAUXILIARYEFFECTSLOTFV reAlAuxiliaryEffectSlotfv;
|
LPALAUXILIARYEFFECTSLOTF alAuxiliaryEffectSlotf;
|
||||||
LPALGETAUXILIARYEFFECTSLOTI reAlGetAuxiliaryEffectSloti;
|
LPALAUXILIARYEFFECTSLOTFV alAuxiliaryEffectSlotfv;
|
||||||
LPALGETAUXILIARYEFFECTSLOTIV reAlGetAuxiliaryEffectSlotiv;
|
LPALGETAUXILIARYEFFECTSLOTI alGetAuxiliaryEffectSloti;
|
||||||
LPALGETAUXILIARYEFFECTSLOTF reAlGetAuxiliaryEffectSlotf;
|
LPALGETAUXILIARYEFFECTSLOTIV alGetAuxiliaryEffectSlotiv;
|
||||||
LPALGETAUXILIARYEFFECTSLOTFV reAlGetAuxiliaryEffectSlotfv;
|
LPALGETAUXILIARYEFFECTSLOTF alGetAuxiliaryEffectSlotf;
|
||||||
LPALGENFILTERS reAlGenFilters;
|
LPALGETAUXILIARYEFFECTSLOTFV alGetAuxiliaryEffectSlotfv;
|
||||||
LPALDELETEFILTERS reAlDeleteFilters;
|
LPALGENFILTERS alGenFilters;
|
||||||
LPALISFILTER reAlIsFilter;
|
LPALDELETEFILTERS alDeleteFilters;
|
||||||
LPALFILTERI reAlFilteri;
|
LPALISFILTER alIsFilter;
|
||||||
LPALFILTERIV reAlFilteriv;
|
LPALFILTERI alFilteri;
|
||||||
LPALFILTERF reAlFilterf;
|
LPALFILTERIV alFilteriv;
|
||||||
LPALFILTERFV reAlFilterfv;
|
LPALFILTERF alFilterf;
|
||||||
LPALGETFILTERI reAlGetFilteri;
|
LPALFILTERFV alFilterfv;
|
||||||
LPALGETFILTERIV reAlGetFilteriv;
|
LPALGETFILTERI alGetFilteri;
|
||||||
LPALGETFILTERF reAlGetFilterf;
|
LPALGETFILTERIV alGetFilteriv;
|
||||||
LPALGETFILTERFV reAlGetFilterfv;
|
LPALGETFILTERF alGetFilterf;
|
||||||
|
LPALGETFILTERFV alGetFilterfv;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void EFXInit()
|
void EFXInit()
|
||||||
{
|
{
|
||||||
|
#ifndef __WIIU__
|
||||||
/* Define a macro to help load the function pointers. */
|
/* Define a macro to help load the function pointers. */
|
||||||
/* Prefix all the function pointers with re* to avoid linking issue with the library functions */
|
/* Prefix all the function pointers with re* to avoid linking issue with the library functions */
|
||||||
#define LOAD_PROC(T, x, y) ((x) = (T)alGetProcAddress(#y))
|
#define LOAD_PROC(T, x) ((x) = (T)alGetProcAddress(#x))
|
||||||
LOAD_PROC(LPALGENEFFECTS, reAlGenEffects, alGenEffects);
|
LOAD_PROC(LPALGENEFFECTS, alGenEffects);
|
||||||
LOAD_PROC(LPALDELETEEFFECTS, reAlDeleteEffects, alDeleteEffects);
|
LOAD_PROC(LPALDELETEEFFECTS, alDeleteEffects);
|
||||||
LOAD_PROC(LPALISEFFECT, reAlIsEffect, alIsEffect);
|
LOAD_PROC(LPALISEFFECT, alIsEffect);
|
||||||
LOAD_PROC(LPALEFFECTI, reAlEffecti, alEffecti);
|
LOAD_PROC(LPALEFFECTI, alEffecti);
|
||||||
LOAD_PROC(LPALEFFECTIV, reAlEffectiv, alEffectiv);
|
LOAD_PROC(LPALEFFECTIV, alEffectiv);
|
||||||
LOAD_PROC(LPALEFFECTF, reAlEffectf, alEffectf);
|
LOAD_PROC(LPALEFFECTF, alEffectf);
|
||||||
LOAD_PROC(LPALEFFECTFV, reAlEffectfv, alEffectfv);
|
LOAD_PROC(LPALEFFECTFV, alEffectfv);
|
||||||
LOAD_PROC(LPALGETEFFECTI, reAlGetEffecti, alGetEffecti);
|
LOAD_PROC(LPALGETEFFECTI, alGetEffecti);
|
||||||
LOAD_PROC(LPALGETEFFECTIV, reAlGetEffectiv, alGetEffectiv);
|
LOAD_PROC(LPALGETEFFECTIV, alGetEffectiv);
|
||||||
LOAD_PROC(LPALGETEFFECTF, reAlGetEffectf, alGetEffectf);
|
LOAD_PROC(LPALGETEFFECTF, alGetEffectf);
|
||||||
LOAD_PROC(LPALGETEFFECTFV, reAlGetEffectfv, alGetEffectfv);
|
LOAD_PROC(LPALGETEFFECTFV, alGetEffectfv);
|
||||||
|
|
||||||
LOAD_PROC(LPALGENFILTERS, reAlGenFilters, alGenFilters);
|
LOAD_PROC(LPALGENFILTERS, alGenFilters);
|
||||||
LOAD_PROC(LPALDELETEFILTERS, reAlDeleteFilters, alDeleteFilters);
|
LOAD_PROC(LPALDELETEFILTERS, alDeleteFilters);
|
||||||
LOAD_PROC(LPALISFILTER, reAlIsFilter, alIsFilter);
|
LOAD_PROC(LPALISFILTER, alIsFilter);
|
||||||
LOAD_PROC(LPALFILTERI, reAlFilteri, alFilteri);
|
LOAD_PROC(LPALFILTERI, alFilteri);
|
||||||
LOAD_PROC(LPALFILTERIV, reAlFilteriv, alFilteriv);
|
LOAD_PROC(LPALFILTERIV, alFilteriv);
|
||||||
LOAD_PROC(LPALFILTERF, reAlFilterf, alFilterf);
|
LOAD_PROC(LPALFILTERF, alFilterf);
|
||||||
LOAD_PROC(LPALFILTERFV, reAlFilterfv, alFilterfv);
|
LOAD_PROC(LPALFILTERFV, alFilterfv);
|
||||||
LOAD_PROC(LPALGETFILTERI, reAlGetFilteri, alGetFilteri);
|
LOAD_PROC(LPALGETFILTERI, alGetFilteri);
|
||||||
LOAD_PROC(LPALGETFILTERIV, reAlGetFilteriv, alGetFilteriv);
|
LOAD_PROC(LPALGETFILTERIV, alGetFilteriv);
|
||||||
LOAD_PROC(LPALGETFILTERF, reAlGetFilterf, alGetFilterf);
|
LOAD_PROC(LPALGETFILTERF, alGetFilterf);
|
||||||
LOAD_PROC(LPALGETFILTERFV, reAlGetFilterfv, alGetFilterfv);
|
LOAD_PROC(LPALGETFILTERFV, alGetFilterfv);
|
||||||
|
|
||||||
LOAD_PROC(LPALGENAUXILIARYEFFECTSLOTS, reAlGenAuxiliaryEffectSlots, alGenAuxiliaryEffectSlots);
|
LOAD_PROC(LPALGENAUXILIARYEFFECTSLOTS, alGenAuxiliaryEffectSlots);
|
||||||
LOAD_PROC(LPALDELETEAUXILIARYEFFECTSLOTS, reAlDeleteAuxiliaryEffectSlots, alDeleteAuxiliaryEffectSlots);
|
LOAD_PROC(LPALDELETEAUXILIARYEFFECTSLOTS, alDeleteAuxiliaryEffectSlots);
|
||||||
LOAD_PROC(LPALISAUXILIARYEFFECTSLOT, reAlIsAuxiliaryEffectSlot, alIsAuxiliaryEffectSlot);
|
LOAD_PROC(LPALISAUXILIARYEFFECTSLOT, alIsAuxiliaryEffectSlot);
|
||||||
LOAD_PROC(LPALAUXILIARYEFFECTSLOTI, reAlAuxiliaryEffectSloti, alAuxiliaryEffectSloti);
|
LOAD_PROC(LPALAUXILIARYEFFECTSLOTI, alAuxiliaryEffectSloti);
|
||||||
LOAD_PROC(LPALAUXILIARYEFFECTSLOTIV, reAlAuxiliaryEffectSlotiv, alAuxiliaryEffectSlotiv);
|
LOAD_PROC(LPALAUXILIARYEFFECTSLOTIV, alAuxiliaryEffectSlotiv);
|
||||||
LOAD_PROC(LPALAUXILIARYEFFECTSLOTF, reAlAuxiliaryEffectSlotf, alAuxiliaryEffectSlotf);
|
LOAD_PROC(LPALAUXILIARYEFFECTSLOTF, alAuxiliaryEffectSlotf);
|
||||||
LOAD_PROC(LPALAUXILIARYEFFECTSLOTFV, reAlAuxiliaryEffectSlotfv, alAuxiliaryEffectSlotfv);
|
LOAD_PROC(LPALAUXILIARYEFFECTSLOTFV, alAuxiliaryEffectSlotfv);
|
||||||
LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTI, reAlGetAuxiliaryEffectSloti, alGetAuxiliaryEffectSloti);
|
LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTI, alGetAuxiliaryEffectSloti);
|
||||||
LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTIV, reAlGetAuxiliaryEffectSlotiv, alGetAuxiliaryEffectSlotiv);
|
LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTIV, alGetAuxiliaryEffectSlotiv);
|
||||||
LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTF, reAlGetAuxiliaryEffectSlotf, alGetAuxiliaryEffectSlotf);
|
LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTF, alGetAuxiliaryEffectSlotf);
|
||||||
LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTFV, reAlGetAuxiliaryEffectSlotfv, alGetAuxiliaryEffectSlotfv);
|
LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTFV, alGetAuxiliaryEffectSlotfv);
|
||||||
#undef LOAD_PROC
|
#undef LOAD_PROC
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetEffectsLevel(ALuint uiFilter, float level)
|
void SetEffectsLevel(ALuint uiFilter, float level)
|
||||||
{
|
{
|
||||||
reAlFilteri(uiFilter, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
|
alFilteri(uiFilter, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
|
||||||
reAlFilterf(uiFilter, AL_LOWPASS_GAIN, 1.0f);
|
alFilterf(uiFilter, AL_LOWPASS_GAIN, 1.0f);
|
||||||
reAlFilterf(uiFilter, AL_LOWPASS_GAINHF, level);
|
alFilterf(uiFilter, AL_LOWPASS_GAINHF, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline float gain_to_mB(float gain)
|
static inline float gain_to_mB(float gain)
|
||||||
@ -107,49 +111,49 @@ static inline float clampF(float val, float minval, float maxval)
|
|||||||
|
|
||||||
void EAX3_Set(ALuint effect, const EAXLISTENERPROPERTIES *props)
|
void EAX3_Set(ALuint effect, const EAXLISTENERPROPERTIES *props)
|
||||||
{
|
{
|
||||||
reAlEffecti (effect, AL_EFFECT_TYPE, AL_EFFECT_EAXREVERB);
|
alEffecti (effect, AL_EFFECT_TYPE, AL_EFFECT_EAXREVERB);
|
||||||
reAlEffectf (effect, AL_EAXREVERB_DENSITY, clampF(powf(props->flEnvironmentSize, 3.0f) / 16.0f, 0.0f, 1.0f));
|
alEffectf (effect, AL_EAXREVERB_DENSITY, clampF(powf(props->flEnvironmentSize, 3.0f) / 16.0f, 0.0f, 1.0f));
|
||||||
reAlEffectf (effect, AL_EAXREVERB_DIFFUSION, props->flEnvironmentDiffusion);
|
alEffectf (effect, AL_EAXREVERB_DIFFUSION, props->flEnvironmentDiffusion);
|
||||||
reAlEffectf (effect, AL_EAXREVERB_GAIN, mB_to_gain((float)props->lRoom));
|
alEffectf (effect, AL_EAXREVERB_GAIN, mB_to_gain((float)props->lRoom));
|
||||||
reAlEffectf (effect, AL_EAXREVERB_GAINHF, mB_to_gain((float)props->lRoomHF));
|
alEffectf (effect, AL_EAXREVERB_GAINHF, mB_to_gain((float)props->lRoomHF));
|
||||||
reAlEffectf (effect, AL_EAXREVERB_GAINLF, mB_to_gain((float)props->lRoomLF));
|
alEffectf (effect, AL_EAXREVERB_GAINLF, mB_to_gain((float)props->lRoomLF));
|
||||||
reAlEffectf (effect, AL_EAXREVERB_DECAY_TIME, props->flDecayTime);
|
alEffectf (effect, AL_EAXREVERB_DECAY_TIME, props->flDecayTime);
|
||||||
reAlEffectf (effect, AL_EAXREVERB_DECAY_HFRATIO, props->flDecayHFRatio);
|
alEffectf (effect, AL_EAXREVERB_DECAY_HFRATIO, props->flDecayHFRatio);
|
||||||
reAlEffectf (effect, AL_EAXREVERB_DECAY_LFRATIO, props->flDecayLFRatio);
|
alEffectf (effect, AL_EAXREVERB_DECAY_LFRATIO, props->flDecayLFRatio);
|
||||||
reAlEffectf (effect, AL_EAXREVERB_REFLECTIONS_GAIN, clampF(mB_to_gain((float)props->lReflections), AL_EAXREVERB_MIN_REFLECTIONS_GAIN, AL_EAXREVERB_MAX_REFLECTIONS_GAIN));
|
alEffectf (effect, AL_EAXREVERB_REFLECTIONS_GAIN, clampF(mB_to_gain((float)props->lReflections), AL_EAXREVERB_MIN_REFLECTIONS_GAIN, AL_EAXREVERB_MAX_REFLECTIONS_GAIN));
|
||||||
reAlEffectf (effect, AL_EAXREVERB_REFLECTIONS_DELAY, props->flReflectionsDelay);
|
alEffectf (effect, AL_EAXREVERB_REFLECTIONS_DELAY, props->flReflectionsDelay);
|
||||||
reAlEffectfv(effect, AL_EAXREVERB_REFLECTIONS_PAN, &props->vReflectionsPan.x);
|
alEffectfv(effect, AL_EAXREVERB_REFLECTIONS_PAN, &props->vReflectionsPan.x);
|
||||||
reAlEffectf (effect, AL_EAXREVERB_LATE_REVERB_GAIN, clampF(mB_to_gain((float)props->lReverb), AL_EAXREVERB_MIN_LATE_REVERB_GAIN, AL_EAXREVERB_MAX_LATE_REVERB_GAIN));
|
alEffectf (effect, AL_EAXREVERB_LATE_REVERB_GAIN, clampF(mB_to_gain((float)props->lReverb), AL_EAXREVERB_MIN_LATE_REVERB_GAIN, AL_EAXREVERB_MAX_LATE_REVERB_GAIN));
|
||||||
reAlEffectf (effect, AL_EAXREVERB_LATE_REVERB_DELAY, props->flReverbDelay);
|
alEffectf (effect, AL_EAXREVERB_LATE_REVERB_DELAY, props->flReverbDelay);
|
||||||
reAlEffectfv(effect, AL_EAXREVERB_LATE_REVERB_PAN, &props->vReverbPan.x);
|
alEffectfv(effect, AL_EAXREVERB_LATE_REVERB_PAN, &props->vReverbPan.x);
|
||||||
reAlEffectf (effect, AL_EAXREVERB_ECHO_TIME, props->flEchoTime);
|
alEffectf (effect, AL_EAXREVERB_ECHO_TIME, props->flEchoTime);
|
||||||
reAlEffectf (effect, AL_EAXREVERB_ECHO_DEPTH, props->flEchoDepth);
|
alEffectf (effect, AL_EAXREVERB_ECHO_DEPTH, props->flEchoDepth);
|
||||||
reAlEffectf (effect, AL_EAXREVERB_MODULATION_TIME, props->flModulationTime);
|
alEffectf (effect, AL_EAXREVERB_MODULATION_TIME, props->flModulationTime);
|
||||||
reAlEffectf (effect, AL_EAXREVERB_MODULATION_DEPTH, props->flModulationDepth);
|
alEffectf (effect, AL_EAXREVERB_MODULATION_DEPTH, props->flModulationDepth);
|
||||||
reAlEffectf (effect, AL_EAXREVERB_AIR_ABSORPTION_GAINHF, clampF(mB_to_gain(props->flAirAbsorptionHF), AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF, AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF));
|
alEffectf (effect, AL_EAXREVERB_AIR_ABSORPTION_GAINHF, clampF(mB_to_gain(props->flAirAbsorptionHF), AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF, AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF));
|
||||||
reAlEffectf (effect, AL_EAXREVERB_HFREFERENCE, props->flHFReference);
|
alEffectf (effect, AL_EAXREVERB_HFREFERENCE, props->flHFReference);
|
||||||
reAlEffectf (effect, AL_EAXREVERB_LFREFERENCE, props->flLFReference);
|
alEffectf (effect, AL_EAXREVERB_LFREFERENCE, props->flLFReference);
|
||||||
reAlEffectf (effect, AL_EAXREVERB_ROOM_ROLLOFF_FACTOR, props->flRoomRolloffFactor);
|
alEffectf (effect, AL_EAXREVERB_ROOM_ROLLOFF_FACTOR, props->flRoomRolloffFactor);
|
||||||
reAlEffecti (effect, AL_EAXREVERB_DECAY_HFLIMIT, (props->ulFlags&EAXLISTENERFLAGS_DECAYHFLIMIT) ? AL_TRUE : AL_FALSE);
|
alEffecti (effect, AL_EAXREVERB_DECAY_HFLIMIT, (props->ulFlags&EAXLISTENERFLAGS_DECAYHFLIMIT) ? AL_TRUE : AL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EFX_Set(ALuint effect, const EAXLISTENERPROPERTIES *props)
|
void EFX_Set(ALuint effect, const EAXLISTENERPROPERTIES *props)
|
||||||
{
|
{
|
||||||
reAlEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_REVERB);
|
alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_REVERB);
|
||||||
|
|
||||||
reAlEffectf(effect, AL_REVERB_DENSITY, clampF(powf(props->flEnvironmentSize, 3.0f) / 16.0f, 0.0f, 1.0f));
|
alEffectf(effect, AL_REVERB_DENSITY, clampF(powf(props->flEnvironmentSize, 3.0f) / 16.0f, 0.0f, 1.0f));
|
||||||
reAlEffectf(effect, AL_REVERB_DIFFUSION, props->flEnvironmentDiffusion);
|
alEffectf(effect, AL_REVERB_DIFFUSION, props->flEnvironmentDiffusion);
|
||||||
reAlEffectf(effect, AL_REVERB_GAIN, mB_to_gain((float)props->lRoom));
|
alEffectf(effect, AL_REVERB_GAIN, mB_to_gain((float)props->lRoom));
|
||||||
reAlEffectf(effect, AL_REVERB_GAINHF, mB_to_gain((float)props->lRoomHF));
|
alEffectf(effect, AL_REVERB_GAINHF, mB_to_gain((float)props->lRoomHF));
|
||||||
reAlEffectf(effect, AL_REVERB_DECAY_TIME, props->flDecayTime);
|
alEffectf(effect, AL_REVERB_DECAY_TIME, props->flDecayTime);
|
||||||
reAlEffectf(effect, AL_REVERB_DECAY_HFRATIO, props->flDecayHFRatio);
|
alEffectf(effect, AL_REVERB_DECAY_HFRATIO, props->flDecayHFRatio);
|
||||||
reAlEffectf(effect, AL_REVERB_REFLECTIONS_GAIN, clampF(mB_to_gain((float)props->lReflections), AL_EAXREVERB_MIN_REFLECTIONS_GAIN, AL_EAXREVERB_MAX_REFLECTIONS_GAIN));
|
alEffectf(effect, AL_REVERB_REFLECTIONS_GAIN, clampF(mB_to_gain((float)props->lReflections), AL_EAXREVERB_MIN_REFLECTIONS_GAIN, AL_EAXREVERB_MAX_REFLECTIONS_GAIN));
|
||||||
reAlEffectf(effect, AL_REVERB_REFLECTIONS_DELAY, props->flReflectionsDelay);
|
alEffectf(effect, AL_REVERB_REFLECTIONS_DELAY, props->flReflectionsDelay);
|
||||||
reAlEffectf(effect, AL_REVERB_LATE_REVERB_GAIN, clampF(mB_to_gain((float)props->lReverb), AL_EAXREVERB_MIN_LATE_REVERB_GAIN, AL_EAXREVERB_MAX_LATE_REVERB_GAIN));
|
alEffectf(effect, AL_REVERB_LATE_REVERB_GAIN, clampF(mB_to_gain((float)props->lReverb), AL_EAXREVERB_MIN_LATE_REVERB_GAIN, AL_EAXREVERB_MAX_LATE_REVERB_GAIN));
|
||||||
reAlEffectf(effect, AL_REVERB_LATE_REVERB_DELAY, props->flReverbDelay);
|
alEffectf(effect, AL_REVERB_LATE_REVERB_DELAY, props->flReverbDelay);
|
||||||
reAlEffectf(effect, AL_REVERB_AIR_ABSORPTION_GAINHF, clampF(mB_to_gain(props->flAirAbsorptionHF), AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF, AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF));
|
alEffectf(effect, AL_REVERB_AIR_ABSORPTION_GAINHF, clampF(mB_to_gain(props->flAirAbsorptionHF), AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF, AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF));
|
||||||
reAlEffectf(effect, AL_REVERB_ROOM_ROLLOFF_FACTOR, props->flRoomRolloffFactor);
|
alEffectf(effect, AL_REVERB_ROOM_ROLLOFF_FACTOR, props->flRoomRolloffFactor);
|
||||||
reAlEffecti(effect, AL_REVERB_DECAY_HFLIMIT, (props->ulFlags&EAXLISTENERFLAGS_DECAYHFLIMIT) ? AL_TRUE : AL_FALSE);
|
alEffecti(effect, AL_REVERB_DECAY_HFLIMIT, (props->ulFlags&EAXLISTENERFLAGS_DECAYHFLIMIT) ? AL_TRUE : AL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EAX3_SetReverbMix(ALuint filter, float mix)
|
void EAX3_SetReverbMix(ALuint filter, float mix)
|
||||||
@ -163,9 +167,9 @@ void EAX3_SetReverbMix(ALuint filter, float mix)
|
|||||||
float mb = mbvol;
|
float mb = mbvol;
|
||||||
float mbhf = mbvol;
|
float mbhf = mbvol;
|
||||||
|
|
||||||
reAlFilteri(filter, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
|
alFilteri(filter, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
|
||||||
reAlFilterf(filter, AL_LOWPASS_GAIN, mB_to_gain(Min(mb, 0.0f)));
|
alFilterf(filter, AL_LOWPASS_GAIN, mB_to_gain(Min(mb, 0.0f)));
|
||||||
reAlFilterf(filter, AL_LOWPASS_GAINHF, mB_to_gain(mbhf));
|
alFilterf(filter, AL_LOWPASS_GAINHF, mB_to_gain(mbhf));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -11,37 +11,37 @@ void EFX_Set(ALuint effect, const EAXLISTENERPROPERTIES *props);
|
|||||||
void EAX3_SetReverbMix(ALuint filter, float mix);
|
void EAX3_SetReverbMix(ALuint filter, float mix);
|
||||||
void SetEffectsLevel(ALuint uiFilter, float level);
|
void SetEffectsLevel(ALuint uiFilter, float level);
|
||||||
|
|
||||||
extern LPALGENEFFECTS reAlGenEffects;
|
extern LPALGENEFFECTS alGenEffects;
|
||||||
extern LPALDELETEEFFECTS reAlDeleteEffects;
|
extern LPALDELETEEFFECTS alDeleteEffects;
|
||||||
extern LPALISEFFECT reAlIsEffect;
|
extern LPALISEFFECT alIsEffect;
|
||||||
extern LPALEFFECTI reAlEffecti;
|
extern LPALEFFECTI alEffecti;
|
||||||
extern LPALEFFECTIV reAlEffectiv;
|
extern LPALEFFECTIV alEffectiv;
|
||||||
extern LPALEFFECTF reAlEffectf;
|
extern LPALEFFECTF alEffectf;
|
||||||
extern LPALEFFECTFV reAlEffectfv;
|
extern LPALEFFECTFV alEffectfv;
|
||||||
extern LPALGETEFFECTI reAlGetEffecti;
|
extern LPALGETEFFECTI alGetEffecti;
|
||||||
extern LPALGETEFFECTIV reAlGetEffectiv;
|
extern LPALGETEFFECTIV alGetEffectiv;
|
||||||
extern LPALGETEFFECTF reAlGetEffectf;
|
extern LPALGETEFFECTF alGetEffectf;
|
||||||
extern LPALGETEFFECTFV reAlGetEffectfv;
|
extern LPALGETEFFECTFV alGetEffectfv;
|
||||||
extern LPALGENAUXILIARYEFFECTSLOTS reAlGenAuxiliaryEffectSlots;
|
extern LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots;
|
||||||
extern LPALDELETEAUXILIARYEFFECTSLOTS reAlDeleteAuxiliaryEffectSlots;
|
extern LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots;
|
||||||
extern LPALISAUXILIARYEFFECTSLOT reAlIsAuxiliaryEffectSlot;
|
extern LPALISAUXILIARYEFFECTSLOT alIsAuxiliaryEffectSlot;
|
||||||
extern LPALAUXILIARYEFFECTSLOTI reAlAuxiliaryEffectSloti;
|
extern LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti;
|
||||||
extern LPALAUXILIARYEFFECTSLOTIV reAlAuxiliaryEffectSlotiv;
|
extern LPALAUXILIARYEFFECTSLOTIV alAuxiliaryEffectSlotiv;
|
||||||
extern LPALAUXILIARYEFFECTSLOTF reAlAuxiliaryEffectSlotf;
|
extern LPALAUXILIARYEFFECTSLOTF alAuxiliaryEffectSlotf;
|
||||||
extern LPALAUXILIARYEFFECTSLOTFV reAlAuxiliaryEffectSlotfv;
|
extern LPALAUXILIARYEFFECTSLOTFV alAuxiliaryEffectSlotfv;
|
||||||
extern LPALGETAUXILIARYEFFECTSLOTI reAlGetAuxiliaryEffectSloti;
|
extern LPALGETAUXILIARYEFFECTSLOTI alGetAuxiliaryEffectSloti;
|
||||||
extern LPALGETAUXILIARYEFFECTSLOTIV reAlGetAuxiliaryEffectSlotiv;
|
extern LPALGETAUXILIARYEFFECTSLOTIV alGetAuxiliaryEffectSlotiv;
|
||||||
extern LPALGETAUXILIARYEFFECTSLOTF reAlGetAuxiliaryEffectSlotf;
|
extern LPALGETAUXILIARYEFFECTSLOTF alGetAuxiliaryEffectSlotf;
|
||||||
extern LPALGETAUXILIARYEFFECTSLOTFV reAlGetAuxiliaryEffectSlotfv;
|
extern LPALGETAUXILIARYEFFECTSLOTFV alGetAuxiliaryEffectSlotfv;
|
||||||
extern LPALGENFILTERS reAlGenFilters;
|
extern LPALGENFILTERS alGenFilters;
|
||||||
extern LPALDELETEFILTERS reAlDeleteFilters;
|
extern LPALDELETEFILTERS alDeleteFilters;
|
||||||
extern LPALISFILTER reAlIsFilter;
|
extern LPALISFILTER alIsFilter;
|
||||||
extern LPALFILTERI reAlFilteri;
|
extern LPALFILTERI alFilteri;
|
||||||
extern LPALFILTERIV reAlFilteriv;
|
extern LPALFILTERIV alFilteriv;
|
||||||
extern LPALFILTERF reAlFilterf;
|
extern LPALFILTERF alFilterf;
|
||||||
extern LPALFILTERFV reAlFilterfv;
|
extern LPALFILTERFV alFilterfv;
|
||||||
extern LPALGETFILTERI reAlGetFilteri;
|
extern LPALGETFILTERI alGetFilteri;
|
||||||
extern LPALGETFILTERIV reAlGetFilteriv;
|
extern LPALGETFILTERIV alGetFilteriv;
|
||||||
extern LPALGETFILTERF reAlGetFilterf;
|
extern LPALGETFILTERF alGetFilterf;
|
||||||
extern LPALGETFILTERFV reAlGetFilterfv;
|
extern LPALGETFILTERFV alGetFilterfv;
|
||||||
#endif
|
#endif
|
||||||
|
@ -107,7 +107,11 @@ enum
|
|||||||
|
|
||||||
#define MAX_STREAMS 2
|
#define MAX_STREAMS 2
|
||||||
|
|
||||||
|
#ifndef __WIIU__
|
||||||
#define DIGITALRATE 32000
|
#define DIGITALRATE 32000
|
||||||
|
#else
|
||||||
|
#define DIGITALRATE 44100
|
||||||
|
#endif
|
||||||
#define DIGITALBITS 16
|
#define DIGITALBITS 16
|
||||||
#define DIGITALCHANNELS 2
|
#define DIGITALCHANNELS 2
|
||||||
|
|
||||||
|
@ -229,18 +229,18 @@ release_existing()
|
|||||||
|
|
||||||
if ( IsFXSupported() )
|
if ( IsFXSupported() )
|
||||||
{
|
{
|
||||||
if ( reAlIsEffect(ALEffect) )
|
if ( alIsEffect(ALEffect) )
|
||||||
{
|
{
|
||||||
reAlEffecti(ALEffect, AL_EFFECT_TYPE, AL_EFFECT_NULL);
|
alEffecti(ALEffect, AL_EFFECT_TYPE, AL_EFFECT_NULL);
|
||||||
reAlDeleteEffects(1, &ALEffect);
|
alDeleteEffects(1, &ALEffect);
|
||||||
ALEffect = AL_EFFECT_NULL;
|
ALEffect = AL_EFFECT_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reAlIsAuxiliaryEffectSlot(ALEffectSlot))
|
if (alIsAuxiliaryEffectSlot(ALEffectSlot))
|
||||||
{
|
{
|
||||||
reAlAuxiliaryEffectSloti(ALEffectSlot, AL_EFFECTSLOT_EFFECT, AL_EFFECT_NULL);
|
alAuxiliaryEffectSloti(ALEffectSlot, AL_EFFECTSLOT_EFFECT, AL_EFFECT_NULL);
|
||||||
|
|
||||||
reAlDeleteAuxiliaryEffectSlots(1, &ALEffectSlot);
|
alDeleteAuxiliaryEffectSlots(1, &ALEffectSlot);
|
||||||
ALEffectSlot = AL_EFFECTSLOT_NULL;
|
ALEffectSlot = AL_EFFECTSLOT_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -325,11 +325,13 @@ set_new_provider(int index)
|
|||||||
|
|
||||||
alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED);
|
alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED);
|
||||||
|
|
||||||
|
#ifndef __WIIU__
|
||||||
if ( alcIsExtensionPresent(ALDevice, (ALCchar*)ALC_EXT_EFX_NAME) )
|
if ( alcIsExtensionPresent(ALDevice, (ALCchar*)ALC_EXT_EFX_NAME) )
|
||||||
{
|
{
|
||||||
reAlGenAuxiliaryEffectSlots(1, &ALEffectSlot);
|
alGenAuxiliaryEffectSlots(1, &ALEffectSlot);
|
||||||
reAlGenEffects(1, &ALEffect);
|
alGenEffects(1, &ALEffect);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for ( int32 i = 0; i < MAX_STREAMS; i++ )
|
for ( int32 i = 0; i < MAX_STREAMS; i++ )
|
||||||
{
|
{
|
||||||
@ -352,6 +354,7 @@ set_new_provider(int index)
|
|||||||
usingEAX3 = 0;
|
usingEAX3 = 0;
|
||||||
_usingEFX = false;
|
_usingEFX = false;
|
||||||
|
|
||||||
|
#ifndef __WIIU__
|
||||||
if ( !strcmp(&providers[index].name[strlen(providers[index].name) - strlen(" EAX3")], " EAX3")
|
if ( !strcmp(&providers[index].name[strlen(providers[index].name) - strlen(" EAX3")], " EAX3")
|
||||||
&& alcIsExtensionPresent(ALDevice, (ALCchar*)ALC_EXT_EFX_NAME) )
|
&& alcIsExtensionPresent(ALDevice, (ALCchar*)ALC_EXT_EFX_NAME) )
|
||||||
{
|
{
|
||||||
@ -377,6 +380,7 @@ set_new_provider(int index)
|
|||||||
DEV("EFX\n");
|
DEV("EFX\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//SampleManager.SetSpeakerConfig(speaker_type);
|
//SampleManager.SetSpeakerConfig(speaker_type);
|
||||||
|
|
||||||
@ -387,7 +391,7 @@ set_new_provider(int index)
|
|||||||
if ( IsFXSupported() )
|
if ( IsFXSupported() )
|
||||||
{
|
{
|
||||||
/**/
|
/**/
|
||||||
reAlAuxiliaryEffectSloti(ALEffectSlot, AL_EFFECTSLOT_EFFECT, ALEffect);
|
alAuxiliaryEffectSloti(ALEffectSlot, AL_EFFECTSLOT_EFFECT, ALEffect);
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
for ( int32 i = 0; i < MAXCHANNELS; i++ )
|
for ( int32 i = 0; i < MAXCHANNELS; i++ )
|
||||||
@ -899,6 +903,13 @@ cSampleManager::LoadPedComment(uint32 nComment)
|
|||||||
#endif
|
#endif
|
||||||
nPedSlotSfx[nCurrentPedSlot] = nComment;
|
nPedSlotSfx[nCurrentPedSlot] = nComment;
|
||||||
|
|
||||||
|
#ifdef BIGENDIAN
|
||||||
|
void* data = (void *)(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE*nCurrentPedSlot);
|
||||||
|
for (int i = 0; i < m_aSamples[nComment].nSize/sizeof(uint16); i++) {
|
||||||
|
((uint16*)data)[i] = BSWAP16(((uint16*)data)[i]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
alBufferData(pedBuffers[nCurrentPedSlot],
|
alBufferData(pedBuffers[nCurrentPedSlot],
|
||||||
AL_FORMAT_MONO16,
|
AL_FORMAT_MONO16,
|
||||||
(void *)(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE*nCurrentPedSlot),
|
(void *)(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE*nCurrentPedSlot),
|
||||||
@ -1025,7 +1036,7 @@ cSampleManager::SetChannelReverbFlag(uint32 nChannel, uint8 nReverbFlag)
|
|||||||
{
|
{
|
||||||
if ( IsFXSupported() )
|
if ( IsFXSupported() )
|
||||||
{
|
{
|
||||||
reAlAuxiliaryEffectSloti(ALEffectSlot, AL_EFFECTSLOT_EFFECT, ALEffect);
|
alAuxiliaryEffectSloti(ALEffectSlot, AL_EFFECTSLOT_EFFECT, ALEffect);
|
||||||
|
|
||||||
if ( nReverbFlag != 0 )
|
if ( nReverbFlag != 0 )
|
||||||
aChannel[nChannel].SetReverbMix(ALEffectSlot, _fEffectsLevel);
|
aChannel[nChannel].SetReverbMix(ALEffectSlot, _fEffectsLevel);
|
||||||
@ -1049,17 +1060,26 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
|
|||||||
|
|
||||||
uintptr addr = nSampleBankMemoryStartAddress[nBank] + m_aSamples[nSfx].nOffset - m_aSamples[BankStartOffset[nBank]].nOffset;
|
uintptr addr = nSampleBankMemoryStartAddress[nBank] + m_aSamples[nSfx].nOffset - m_aSamples[BankStartOffset[nBank]].nOffset;
|
||||||
|
|
||||||
#ifdef BIGENDIAN
|
|
||||||
for (int i = 0; i < m_aSamples[nSfx].nSize / sizeof(uint16); i++)
|
|
||||||
((uint16*)addr)[i] = BSWAP16(((uint16*)addr)[i]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( ALBuffers[nSfx].IsEmpty() )
|
if ( ALBuffers[nSfx].IsEmpty() )
|
||||||
{
|
{
|
||||||
|
#ifdef BIGENDIAN
|
||||||
|
void* swapBuf = malloc(m_aSamples[nSfx].nSize);
|
||||||
|
memcpy(swapBuf, (void*)addr, m_aSamples[nSfx].nSize);
|
||||||
|
for (int i = 0; i < m_aSamples[nSfx].nSize / sizeof(uint16); i++) {
|
||||||
|
((uint16*)swapBuf)[i] = BSWAP16(((uint16*)swapBuf)[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void* swapBuf = (void *)addr;
|
||||||
|
#endif
|
||||||
|
|
||||||
ALuint buf;
|
ALuint buf;
|
||||||
alGenBuffers(1, &buf);
|
alGenBuffers(1, &buf);
|
||||||
alBufferData(buf, AL_FORMAT_MONO16, (void *)addr, m_aSamples[nSfx].nSize, m_aSamples[nSfx].nFrequency);
|
alBufferData(buf, AL_FORMAT_MONO16, swapBuf, m_aSamples[nSfx].nSize, m_aSamples[nSfx].nFrequency);
|
||||||
ALBuffers[nSfx].Set(buf);
|
ALBuffers[nSfx].Set(buf);
|
||||||
|
|
||||||
|
#ifdef BIGENDIAN
|
||||||
|
free(swapBuf);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
ALBuffers[nSfx].Wait();
|
ALBuffers[nSfx].Wait();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user