浏览代码

[raudio] Add 24 bits samples support for FLAC format (#4058)

Similarly to how it's done for WAV format, by forcing the conversion
to s16 on UpdateMusicStream().
Alexey Kutepov 1 年之前
父节点
当前提交
33c598123c
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/raudio.c

+ 3 - 1
src/raudio.c

@@ -1428,7 +1428,9 @@ Music LoadMusicStream(const char *fileName)
         {
             music.ctxType = MUSIC_AUDIO_FLAC;
             music.ctxData = ctxFlac;
-            music.stream = LoadAudioStream(ctxFlac->sampleRate, ctxFlac->bitsPerSample, ctxFlac->channels);
+            int sampleSize = ctxFlac->bitsPerSample;
+            if (ctxFlac->bitsPerSample == 24) sampleSize = 16;   // Forcing conversion to s16 on UpdateMusicStream()
+            music.stream = LoadAudioStream(ctxFlac->sampleRate, sampleSize, ctxFlac->channels);
             music.frameCount = (unsigned int)ctxFlac->totalPCMFrameCount;
             music.looping = true;   // Looping enabled by default
             musicLoaded = true;