Show the name of unsupported sound formats with OpenAL

This commit is contained in:
Chris Robinson 2014-06-28 01:25:25 -07:00
parent afcada4a3b
commit 7f3be7bf14
3 changed files with 28 additions and 2 deletions

View File

@ -304,6 +304,27 @@ void I_ShutdownSound()
}
}
const char *GetSampleTypeName(enum SampleType type)
{
switch(type)
{
case SampleType_UInt8: return "Unsigned 8-bit";
case SampleType_Int16: return "Signed 16-bit";
}
return "(invalid sample type)";
}
const char *GetChannelConfigName(enum ChannelConfig chan)
{
switch(chan)
{
case ChannelConfig_Mono: return "Mono";
case ChannelConfig_Stereo: return "Stereo";
}
return "(invalid channel config)";
}
CCMD (snd_status)
{
GSnd->PrintStatus ();

View File

@ -119,6 +119,9 @@ enum ChannelConfig
ChannelConfig_Stereo
};
const char *GetSampleTypeName(enum SampleType type);
const char *GetChannelConfigName(enum ChannelConfig chan);
struct SoundDecoder
{
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type) = 0;

View File

@ -545,7 +545,8 @@ public:
if(Format == AL_NONE)
{
Printf("Unsupported audio format (0x%x / 0x%x)\n", chans, type);
Printf("Unsupported audio format: %s, %s\n", GetChannelConfigName(chans),
GetSampleTypeName(type));
return false;
}
SampleRate = srate;
@ -1019,7 +1020,8 @@ SoundHandle OpenALSoundRenderer::LoadSound(BYTE *sfxdata, int length)
if(format == AL_NONE)
{
Printf("Unsupported audio format (0x%x / 0x%x)\n", chans, type);
Printf("Unsupported audio format: %s, %s\n", GetChannelConfigName(chans),
GetSampleTypeName(type));
return retval;
}