Reluctantly add support for stereo files again: there are external hangars which did not update to the mono-files only principle

This commit is contained in:
Erik Hofman 2016-07-19 10:44:46 +02:00
parent c48a28beb9
commit 9b4f1b0ff8
3 changed files with 14 additions and 1 deletions

View File

@ -59,9 +59,13 @@ namespace
if (!compressed) {
if (numChannels == 1 && bitsPerSample == 16) rv = SG_SAMPLE_MONO16;
else if (numChannels == 1 && bitsPerSample == 8) rv = SG_SAMPLE_MONO8;
else if (numChannels == 2 && bitsPerSample == 16) rv = SG_SAMPLE_STEREO16;
else if (numChannels == 2 && bitsPerSample == 8) rv = SG_SAMPLE_STEREO8;
else throw sg_exception("Unsupported audio format");
} else {
if (numChannels == 1 && bitsPerSample == 4) rv = SG_SAMPLE_ADPCM;
else if (numChannels == 1 && bitsPerSample == 8) rv = SG_SAMPLE_MULAW;
else throw sg_exception("Unsupported audio format");
}
return rv;
}

View File

@ -47,7 +47,10 @@ enum {
SG_SAMPLE_MONO8 = (SG_SAMPLE_MONO|SG_SAMPLE_8BITS),
SG_SAMPLE_MONO16 = (SG_SAMPLE_MONO|SG_SAMPLE_16BITS),
SG_SAMPLE_MULAW = (SG_SAMPLE_MONO|SG_SAMPLE_8BITS|SG_SAMPLE_COMPRESSED),
SG_SAMPLE_ADPCM = (SG_SAMPLE_MONO|SG_SAMPLE_4BITS|SG_SAMPLE_COMPRESSED)
SG_SAMPLE_ADPCM = (SG_SAMPLE_MONO|SG_SAMPLE_4BITS|SG_SAMPLE_COMPRESSED),
SG_SAMPLE_STEREO8 = (SG_SAMPLE_STEREO|SG_SAMPLE_8BITS),
SG_SAMPLE_STEREO16 = (SG_SAMPLE_STEREO|SG_SAMPLE_16BITS)
};

View File

@ -586,6 +586,12 @@ unsigned int SGSoundMgr::request_buffer(SGSoundSample *sample)
case SG_SAMPLE_ADPCM:
format = AL_FORMAT_MONO_IMA4;
break;
case SG_SAMPLE_STEREO16:
format = AL_FORMAT_STEREO16;
break;
case SG_SAMPLE_STEREO8:
format = AL_FORMAT_STEREO8;
default:
SG_LOG(SG_SOUND, SG_ALERT, "unsupported audio format");
return buffer;