Disabled unused OpenAL code requiring the AL_SOFT_buffer_samples extension

This commit is contained in:
Robert Beckebans 2013-01-08 18:08:24 +01:00
parent 44cc05651c
commit 83b3439e87
3 changed files with 23 additions and 48 deletions

View file

@ -292,14 +292,13 @@ void idSoundSample_OpenAL::CreateOpenALBuffer()
{ {
CheckALErrors(); CheckALErrors();
// RB: TODO decode idWaveFile::FORMAT_ADPCM to idWaveFile::FORMAT_PCM
// and build one big OpenAL buffer using the alBufferSubData extension
void* buffer = NULL; void* buffer = NULL;
uint32 bufferSize = 0; uint32 bufferSize = 0;
if( format.basic.formatTag == idWaveFile::FORMAT_ADPCM ) if( format.basic.formatTag == idWaveFile::FORMAT_ADPCM )
{ {
// RB: decode idWaveFile::FORMAT_ADPCM to idWaveFile::FORMAT_PCM
buffer = buffers[0].buffer; buffer = buffers[0].buffer;
bufferSize = buffers[0].bufferSize; bufferSize = buffers[0].bufferSize;
@ -315,10 +314,12 @@ void idSoundSample_OpenAL::CreateOpenALBuffer()
} }
else if( format.basic.formatTag == idWaveFile::FORMAT_XMA2 ) else if( format.basic.formatTag == idWaveFile::FORMAT_XMA2 )
{ {
// RB: not used in the PC version of the BFG edition
common->Error( "idSoundSample_OpenAL::CreateOpenALBuffer: could not decode XMA2 '%s' to 16 bit format", GetName() ); common->Error( "idSoundSample_OpenAL::CreateOpenALBuffer: could not decode XMA2 '%s' to 16 bit format", GetName() );
} }
else if( format.basic.formatTag == idWaveFile::FORMAT_EXTENSIBLE ) else if( format.basic.formatTag == idWaveFile::FORMAT_EXTENSIBLE )
{ {
// RB: not used in the PC version of the BFG edition
common->Error( "idSoundSample_OpenAL::CreateOpenALBuffer: could not decode extensible WAV format '%s' to 16 bit format", GetName() ); common->Error( "idSoundSample_OpenAL::CreateOpenALBuffer: could not decode extensible WAV format '%s' to 16 bit format", GetName() );
} }
else else
@ -331,7 +332,7 @@ void idSoundSample_OpenAL::CreateOpenALBuffer()
bufferSize = buffers[0].bufferSize; bufferSize = buffers[0].bufferSize;
} }
#if 0 #if 0 //#if defined(AL_SOFT_buffer_samples)
if( alIsExtensionPresent( "AL_SOFT_buffer_samples" ) ) if( alIsExtensionPresent( "AL_SOFT_buffer_samples" ) )
{ {
ALenum type = AL_SHORT_SOFT; ALenum type = AL_SHORT_SOFT;
@ -683,6 +684,7 @@ float idSoundSample_OpenAL::GetAmplitude( int timeMS ) const
} }
#if 0 //defined(AL_SOFT_buffer_samples)
const char* idSoundSample_OpenAL::OpenALSoftChannelsName( ALenum chans ) const const char* idSoundSample_OpenAL::OpenALSoftChannelsName( ALenum chans ) const
{ {
switch( chans ) switch( chans )
@ -952,40 +954,12 @@ ALenum idSoundSample_OpenAL::GetOpenALSoftFormat( ALenum channels, ALenum type )
return format; return format;
} }
#endif // #if defined(AL_SOFT_buffer_samples)
ALenum idSoundSample_OpenAL::GetOpenALBufferFormat() const ALenum idSoundSample_OpenAL::GetOpenALBufferFormat() const
{ {
ALenum alFormat; ALenum alFormat;
#if 0
if( alIsExtensionPresent( "AL_SOFT_buffer_samples" ) )
{
if( format.basic.formatTag == idWaveFile::FORMAT_PCM )
{
alFormat = NumChannels() == 1 ? AL_MONO16_SOFT : AL_STEREO16_SOFT;
}
else if( format.basic.formatTag == idWaveFile::FORMAT_ADPCM )
{
alFormat = NumChannels() == 1 ? AL_MONO8_SOFT : AL_STEREO8_SOFT;
//alFormat = NumChannels() == 1 ? AL_MONO16_SOFT : AL_STEREO16_SOFT;
}
else if( format.basic.formatTag == idWaveFile::FORMAT_XMA2 )
{
alFormat = NumChannels() == 1 ? AL_MONO16_SOFT : AL_STEREO16_SOFT;
}
else
{
alFormat = NumChannels() == 1 ? AL_MONO16_SOFT : AL_STEREO16_SOFT;
}
if( !alIsBufferFormatSupportedSOFT( alFormat ) )
{
alFormat = NumChannels() == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;
}
}
else
#endif
{
if( format.basic.formatTag == idWaveFile::FORMAT_PCM ) if( format.basic.formatTag == idWaveFile::FORMAT_PCM )
{ {
alFormat = NumChannels() == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16; alFormat = NumChannels() == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;
@ -1004,7 +978,6 @@ ALenum idSoundSample_OpenAL::GetOpenALBufferFormat() const
{ {
alFormat = NumChannels() == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16; alFormat = NumChannels() == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;
} }
}
return alFormat; return alFormat;
} }

View file

@ -130,6 +130,7 @@ public:
float GetAmplitude( int timeMS ) const; float GetAmplitude( int timeMS ) const;
#if 0 //defined(AL_SOFT_buffer_samples)
const char* OpenALSoftChannelsName( ALenum chans ) const; const char* OpenALSoftChannelsName( ALenum chans ) const;
const char* OpenALSoftTypeName( ALenum type ) const; const char* OpenALSoftTypeName( ALenum type ) const;
@ -143,6 +144,7 @@ public:
* AL_SOFT_buffer_samples. Returns AL_NONE (0) if no supported format can be * AL_SOFT_buffer_samples. Returns AL_NONE (0) if no supported format can be
* found. */ * found. */
ALenum GetOpenALSoftFormat( ALenum channels, ALenum type ) const; ALenum GetOpenALSoftFormat( ALenum channels, ALenum type ) const;
#endif
ALenum GetOpenALBufferFormat() const; ALenum GetOpenALBufferFormat() const;

View file

@ -95,7 +95,7 @@ typedef enum
#if defined(USE_OPENAL) #if defined(USE_OPENAL)
#define AL_ALEXT_PROTOTYPES //#define AL_ALEXT_PROTOTYPES
#include <AL/al.h> #include <AL/al.h>
#include <AL/alc.h> #include <AL/alc.h>