Skip to content

Commit

Permalink
[raudio] Add 24 bits samples support for FLAC format
Browse files Browse the repository at this point in the history
Similarly to how it's done for WAV format, by forcing the conversion
to s16 on UpdateMusicStream().
  • Loading branch information
rexim committed Jun 12, 2024
1 parent fffae1a commit 27d972c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/raudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 27d972c

Please sign in to comment.