Audio in Torque 3d

Expanding and utilizing the engine via C++.
  • 1
  • 2
16 posts Page 2 of 2
marauder2k9
Posts: 194
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Sun Oct 14, 2018 12:36 am
that worked 100% thank you!!!

Now to test if the effect actually gets applied lol
marauder2k9
Posts: 194
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Sun Oct 14, 2018 12:44 am
its crashing each time i go to play a sound, think i might have to create a separate file for effects such as reverb etc
marauder2k9
Posts: 194
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Sun Oct 14, 2018 1:02 pm
Okay i have it stable now but no reverb effect is being made. I think the function to create the reverb isnt being called:

in sfxALDevice.cpp i have
ALuint SFXALDevice::setReverb(EFXEAXREVERBPROPERTIES *reverb)
{
	ALuint effect = 0;

		mOpenAL.alGenEffects(1, &effect);

		mOpenAL.alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_REVERB);

		mOpenAL.alEffectf(effect, AL_REVERB_DENSITY, reverb->flDensity);
		mOpenAL.alEffectf(effect, AL_REVERB_DIFFUSION, reverb->flDiffusion);
		mOpenAL.alEffectf(effect, AL_REVERB_GAIN, reverb->flGain);
		mOpenAL.alEffectf(effect, AL_REVERB_GAINHF, reverb->flGainHF);
		mOpenAL.alEffectf(effect, AL_REVERB_DECAY_TIME, reverb->flDecayTime);
		mOpenAL.alEffectf(effect, AL_REVERB_DECAY_HFRATIO, reverb->flDecayHFRatio);
		mOpenAL.alEffectf(effect, AL_REVERB_REFLECTIONS_GAIN, reverb->flReflectionsGain);
		mOpenAL.alEffectf(effect, AL_REVERB_REFLECTIONS_DELAY, reverb->flReflectionsDelay);
		mOpenAL.alEffectf(effect, AL_REVERB_LATE_REVERB_GAIN, reverb->flLateReverbGain);
		mOpenAL.alEffectf(effect, AL_REVERB_LATE_REVERB_DELAY, reverb->flLateReverbDelay);
		mOpenAL.alEffectf(effect, AL_REVERB_AIR_ABSORPTION_GAINHF, reverb->flAirAbsorptionGainHF);
		mOpenAL.alEffectf(effect, AL_REVERB_ROOM_ROLLOFF_FACTOR, reverb->flRoomRolloffFactor);
		mOpenAL.alEffecti(effect, AL_REVERB_DECAY_HFLIMIT, reverb->iDecayHFLimit);

	/* Check if an error occured, and clean up if so. */


	return effect;
}

This defines the effect and brings in all the details available to openal to create a reverb effect

In sfxALVoice.cpp i have
void SFXALVoice::setReverb(SFXALDevice* device)
{
	EFXEAXREVERBPROPERTIES reverb = EFX_REVERB_PRESET_ARENA;
	AL_SANITY_CHECK();
	ALuint effect, slot;
	effect = device->setReverb(&reverb);
	slot = 0;

	mOpenAL.alGenAuxiliaryEffectSlots(1, &slot);
	mOpenAL.alAuxiliaryEffectSloti(slot, AL_EFFECTSLOT_EFFECT, effect);

	mOpenAL.alSource3i(mSourceName, AL_AUXILIARY_SEND_FILTER, slot, 0, AL_FILTER_NULL);
}
EFXEAXREVERBPROPERTIES reverb = EFX_REVERB_PRESET_ARENA this loads a preset in openal and adds the values into sfxALDevice setReverb then creates the required effect slots for openal to create the effect with the source, this is stable and doesnt crash everytime a sound is played but i think that is becuase the function isnt being called =/
marauder2k9
Posts: 194
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Mon Oct 15, 2018 1:31 am
Okay, downloaded the openal sdk installed it and now it works lol stupid me forgot to download the sdk, now i have openal32.dll in my directory and hopefully it will work
marauder2k9
Posts: 194
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Mon Oct 15, 2018 1:38 am
it still crashes when trying to call the code inside create voice but at least now i know it is loading all the function addresses
marauder2k9
Posts: 194
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Mon Oct 15, 2018 3:24 am
Such a good feeling when u get something working :D now to link it up with torques gui

  • 1
  • 2
16 posts Page 2 of 2

Who is online

Users browsing this forum: No registered users and 7 guests