]> git.mxchange.org Git - simgear.git/commitdiff
Reluctantly add support for stereo files again: there are external hangars which...
authorErik Hofman <erik@ehofman.com>
Tue, 19 Jul 2016 08:44:46 +0000 (10:44 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 13 Aug 2016 08:21:16 +0000 (10:21 +0200)
simgear/sound/readwav.cxx
simgear/sound/sample.hxx
simgear/sound/soundmgr_openal.cxx

index 3661fe47a5587bd7e31588bcfbd6e321db28eab6..9026e7fc525558460f0190236cf6132142ec6b5d 100644 (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;
   }
index 1980eb71ad490c4e13f04c21decfc628c78fec9c..13da128d2b5f985c6d4403925f8ae84b3f34dad7 100644 (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)
 };
 
 
index 497fe3b3373b796387eab4c5c080a12f6a2927b0..6064a0be035c37081766629048c5124a0f8da022 100644 (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;