mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-25 21:23:42 -04:00
Add functions to get string names for sample types and channel configs
This commit is contained in:
parent
4a0b5b7918
commit
dc6354b2f9
@ -44,7 +44,7 @@ static ALenum getALFormat(ChannelConfig chans, SampleType type)
|
||||
if(fmtlist[i].chans == chans && fmtlist[i].type == type)
|
||||
return fmtlist[i].format;
|
||||
}
|
||||
fail("Unsupported sound format");
|
||||
fail(std::string("Unsupported sound format (")+getChannelConfigName(chans)+", "+getSampleTypeName(type)+")");
|
||||
return AL_NONE;
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,13 @@ namespace MWSound
|
||||
SampleType_UInt8,
|
||||
SampleType_Int16
|
||||
};
|
||||
const char *getSampleTypeName(SampleType type);
|
||||
|
||||
enum ChannelConfig {
|
||||
ChannelConfig_Mono,
|
||||
ChannelConfig_Stereo
|
||||
};
|
||||
const char *getChannelConfigName(ChannelConfig config);
|
||||
|
||||
class Sound_Decoder
|
||||
{
|
||||
|
@ -464,4 +464,25 @@ namespace MWSound
|
||||
|
||||
updateRegionSound(duration);
|
||||
}
|
||||
|
||||
|
||||
const char *getSampleTypeName(SampleType type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case SampleType_UInt8: return "U8";
|
||||
case SampleType_Int16: return "S16";
|
||||
}
|
||||
return "(unknown sample type)";
|
||||
}
|
||||
|
||||
const char *getChannelConfigName(ChannelConfig config)
|
||||
{
|
||||
switch(config)
|
||||
{
|
||||
case ChannelConfig_Mono: return "Mono";
|
||||
case ChannelConfig_Stereo: return "Stereo";
|
||||
}
|
||||
return "(unknown channel config)";
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user