Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap sound direction and some more EFX properties #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/OALWrapper/OAL_Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class cOAL_Device : public iOAL_LoggerObject
void SetListenerPosition (const float* apPos );
void SetListenerVelocity (const float* apVel );
void SetListenerOrientation (const float* apForward, const float* apUp);
void SetListenerMetersPerUnit (const float afValue );


////////////////////////////////////////////////////////
Expand Down
6 changes: 6 additions & 0 deletions include/OALWrapper/OAL_EFX.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ void OAL_Source_SetDirectFilter( int alSourceHandle, cOAL_Filter* apFilter );
void OAL_Source_SetAuxSend ( int alSourceHandle, int alAuxSend, int alSlotHandle, cOAL_Filter* apFilter );
void OAL_Source_SetAuxSendSlot ( int alSourceHandle, int alAuxSend, int alSlotHandle);
void OAL_Source_SetAuxSendFilter ( int alSourceHandle, int alAuxSend, cOAL_Filter* apFilter );
void OAL_Source_SetConeOuterGainHF ( const int alSourceHandle, const float afGain );
void OAL_Source_SetAirAbsorptionFactor ( const int alSourceHandle, const float afFactor );
void OAL_Source_SetRoomRolloffFactor ( const int alSourceHandle, const float afFactor );
void OAL_Source_SetDirectFilterGainHFAuto ( const int alSourceHandle, bool abAuto = true );
void OAL_Source_SetAuxSendFilterGainAuto ( const int alSourceHandle, bool abAuto = true);
void OAL_Source_SetAuxSendFilterGainHFAuto ( const int alSourceHandle, bool abAuto = true );

void OAL_Source_SetFiltering( int alSourceHandle, bool abEnabled, int alFlags);
void OAL_Source_SetFilterType( int alSourceHandle, eOALFilterType aeType);
Expand Down
6 changes: 5 additions & 1 deletion include/OALWrapper/OAL_Playback.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ void OAL_Source_SetAttributes ( const int alSource, const float* apPos, const f
void OAL_Source_SetMinMaxDistance ( const int alSource, const float afMin, const float afMax );
void OAL_Source_SetPositionRelative ( const int alSource, const bool abRelative );
void OAL_Source_SetPriority ( const int alSource, const unsigned int alPriority );
void OAL_Source_SetConeOuterGain ( const int alSource, const float afGain );
void OAL_Source_setConeInnerAngle ( const int alSource, const float afAngle );
void OAL_Source_setConeOuterAngle ( const int alSource, const float afAngle );
void OAL_Source_SetDirection ( const int alSource, const float* apDir );

unsigned int OAL_Source_GetPriority ( const int alSource );
float OAL_Source_GetPitch(const int alSource);
Expand All @@ -49,7 +53,7 @@ const bool OAL_Source_IsBufferUnderrun ( const int alSource );

void OAL_Listener_SetAttributes ( const float* apPos, const float* apVel, const float* apForward, const float* apUpward );
void OAL_Listener_SetMasterVolume ( const float afVolume );

void OAL_Listener_SetMetersPerUnit (const float afValue );

void OAL_Source_SetElapsedTime( const int alSource, double afTime );
double OAL_Source_GetElapsedTime( const int alSource );
Expand Down
10 changes: 10 additions & 0 deletions include/OALWrapper/OAL_Source.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ class cOAL_Source : public iOAL_LowLevelObject
void SetVelocity(const float* apVel);
void SetLoop(bool abLoop);
void SetMinMaxDistance(const float afMin, const float afMax);
void SetConeOuterGain(const float afGain);
void setConeInnerAngle(const float afAngle);
void setConeOuterAngle(const float afAngle);
void SetDirection(const float* apDir);

void SetElapsedTime(double afTime);

Expand Down Expand Up @@ -134,6 +138,12 @@ class cOAL_Source : public iOAL_LowLevelObject
void SetAuxSend(int alSendId, cOAL_EffectSlot* apSlot, cOAL_Filter* apFilter);
void SetAuxSendSlot(int alSendId, cOAL_EffectSlot* apSlot );
void SetAuxSendFilter(int alSendId, cOAL_Filter* apFilter );
void SetConeOuterGainHF(const float afGain);
void SetAirAbsorptionFactor(const float afFactor);
void SetRoomRolloffFactor(const float afFactor);
void SetDirectFilterGainHFAuto(bool abAuto = true);
void SetAuxSendFilterGainAuto(bool abAuto = true);
void SetAuxSendFilterGainHFAuto(bool abAuto = true);

// Built in filter methods
void SetFilterType ( eOALFilterType aeType );
Expand Down
12 changes: 12 additions & 0 deletions sources/OAL_Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,18 @@ void cOAL_Device::SetListenerOrientation(const float* apForward, const float* ap

//-------------------------------------------------------------------------

void cOAL_Device::SetListenerMetersPerUnit (const float afValue )
{
if (!mbEFXActive)
return;
DEF_FUNC_NAME ("cOAL_Device::SetListenerMetersPerUnit()");
FUNC_USES_AL;

RUN_AL_FUNC(alListenerf ( AL_METERS_PER_UNIT, afValue ));
}

//-------------------------------------------------------------------------

/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
// Playback Management
Expand Down
90 changes: 90 additions & 0 deletions sources/OAL_EFX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,96 @@ void OAL_Source_SetFilterGainHF( int alSourceHandle, float afGainHF)
}
}

void OAL_Source_SetConeOuterGainHF ( const int alSourceHandle, const float afGain )
{
if (gpDevice == NULL)
return;

cOAL_Source* pSource = gpDevice->GetSource(alSourceHandle);

if (pSource)
{
pSource->Lock();
pSource->SetConeOuterGainHF(afGain);
pSource->Unlock();
}
}

void OAL_Source_SetAirAbsorptionFactor ( const int alSourceHandle, const float afFactor )
{
if (gpDevice == NULL)
return;

cOAL_Source* pSource = gpDevice->GetSource(alSourceHandle);

if (pSource)
{
pSource->Lock();
pSource->SetAirAbsorptionFactor(afFactor);
pSource->Unlock();
}
}

void OAL_Source_SetRoomRolloffFactor ( const int alSourceHandle, const float afFactor )
{
if (gpDevice == NULL)
return;

cOAL_Source* pSource = gpDevice->GetSource(alSourceHandle);

if (pSource)
{
pSource->Lock();
pSource->SetRoomRolloffFactor(afFactor);
pSource->Unlock();
}
}

void OAL_Source_SetDirectFilterGainHFAuto ( const int alSourceHandle, bool abAuto )
{
if (gpDevice == NULL)
return;

cOAL_Source* pSource = gpDevice->GetSource(alSourceHandle);

if (pSource)
{
pSource->Lock();
pSource->SetDirectFilterGainHFAuto(abAuto);
pSource->Unlock();
}
}

void OAL_Source_SetAuxSendFilterGainAuto ( const int alSourceHandle, bool abAuto )
{
if (gpDevice == NULL)
return;

cOAL_Source* pSource = gpDevice->GetSource(alSourceHandle);

if (pSource)
{
pSource->Lock();
pSource->SetAuxSendFilterGainAuto(abAuto);
pSource->Unlock();
}
}

void OAL_Source_SetAuxSendFilterGainHFAuto ( const int alSourceHandle, bool abAuto )
{
if (gpDevice == NULL)
return;

cOAL_Source* pSource = gpDevice->GetSource(alSourceHandle);

if (pSource)
{
pSource->Lock();
pSource->SetAuxSendFilterGainHFAuto(abAuto);
pSource->Unlock();
}
}


///////////////////////////////////////////////////////////////
/*
Expand Down
79 changes: 79 additions & 0 deletions sources/OAL_Playback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,17 @@ void OAL_Listener_SetMasterVolume ( float afVolume )
gpDevice->SetListenerGain(afVolume);
}

///////////////////////////////////////////////////////////
//// void OAL_Listener_SetMetersPerUnit (const float afValue )
//// - the relationship between the units passed to OpenAL calls such as positions and the real-world
///////////////////////////////////////////////////////////

void OAL_Listener_SetMetersPerUnit (const float afValue )
{
if (gpDevice == NULL) return;
gpDevice->SetListenerMetersPerUnit(afValue);
}

///////////////////////////////////////////////////////////
//// void OAL_Source_SetPriority ( const int alSource, const unsigned int alPriority )
//// - Sets the priority of the specified source
Expand Down Expand Up @@ -333,6 +344,74 @@ unsigned int OAL_Source_GetPriority ( const int alSource )

}

///////////////////////////////////////////////////////////
//// void OAL_Source_SetConeOuterGain ( const int alSource, const float afGain )
//// - the factor with which AL_GAIN is multiplied to determine the effective gain outside the cone defined by the outer angle
///////////////////////////////////////////////////////////

void OAL_Source_SetConeOuterGain ( const int alSource, const float afGain )
{
if (gpDevice == NULL) return;
cOAL_Source* pSource = gpDevice->GetSource(alSource);
if (pSource)
{
pSource->Lock();
pSource->SetConeOuterGain(afGain);
pSource->Unlock();
}
}

///////////////////////////////////////////////////////////
//// void OAL_Source_setConeInnerAngle ( const int alSource, const float afAngle )
//// - Sets inner angle of the sound cone, in degrees
///////////////////////////////////////////////////////////

void OAL_Source_setConeInnerAngle ( const int alSource, const float afAngle )
{
if (gpDevice == NULL) return;
cOAL_Source* pSource = gpDevice->GetSource(alSource);
if (pSource)
{
pSource->Lock();
pSource->setConeInnerAngle(afAngle);
pSource->Unlock();
}
}

///////////////////////////////////////////////////////////
//// void OAL_Source_setConeOuterAngle ( const int alSource, const float afAngle )
//// - Sets outer angle of the sound cone, in degrees
///////////////////////////////////////////////////////////

void OAL_Source_setConeOuterAngle ( const int alSource, const float afAngle )
{
if (gpDevice == NULL) return;
cOAL_Source* pSource = gpDevice->GetSource(alSource);
if (pSource)
{
pSource->Lock();
pSource->setConeOuterAngle(afAngle);
pSource->Unlock();
}
}

///////////////////////////////////////////////////////////
//// void OAL_Source_SetDirection ( const int alSource, const float* apDir )
//// - Sets sound direction for the source
///////////////////////////////////////////////////////////

void OAL_Source_SetDirection ( const int alSource, const float* apDir )
{
if (gpDevice == NULL) return;
cOAL_Source* pSource = gpDevice->GetSource(alSource);
if (pSource)
{
pSource->Lock();
pSource->SetDirection(apDir);
pSource->Unlock();
}
}

///////////////////////////////////////////////////////////
//// const bool OAL_Source_IsPlaying ( const int alSource )
//// - Returns true if the specified source is playing audio
Expand Down
Loading