mirror of
				https://github.com/raysan5/raylib.git
				synced 2025-10-26 12:27:01 +00:00 
			
		
		
		
	Support mulstiple WAV sampleSize for MusicStream #1340
24bit per sample is not supported internally and automatically converted 16bit
This commit is contained in:
		| @@ -1094,7 +1094,10 @@ Music LoadMusicStream(const char *fileName) | ||||
|             music.ctxType = MUSIC_AUDIO_WAV; | ||||
|             music.ctxData = ctxWav; | ||||
|              | ||||
|             music.stream = InitAudioStream(ctxWav->sampleRate, ctxWav->bitsPerSample, ctxWav->channels); | ||||
|             int sampleSize = ctxWav->bitsPerSample; | ||||
|             if (ctxWav->bitsPerSample == 24) sampleSize = 16;   // Forcing conversion to s16 on UpdateMusicStream() | ||||
|  | ||||
|             music.stream = InitAudioStream(ctxWav->sampleRate, sampleSize, ctxWav->channels); | ||||
|             music.sampleCount = (unsigned int)ctxWav->totalPCMFrameCount*ctxWav->channels; | ||||
|             music.looping = true;   // Looping enabled by default | ||||
|             musicLoaded = true; | ||||
| @@ -1351,7 +1354,8 @@ void UpdateMusicStream(Music music) | ||||
|             case MUSIC_AUDIO_WAV: | ||||
|             { | ||||
|                 // NOTE: Returns the number of samples to process (not required) | ||||
|                 drwav_read_pcm_frames_s16((drwav *)music.ctxData, samplesCount/music.stream.channels, (short *)pcm); | ||||
|                 if (music.stream.sampleSize == 16) drwav_read_pcm_frames_s16((drwav *)music.ctxData, samplesCount/music.stream.channels, (short *)pcm); | ||||
|                 else if (music.stream.sampleSize == 32) drwav_read_pcm_frames_f32((drwav *)music.ctxData, samplesCount/music.stream.channels, (float *)pcm); | ||||
|  | ||||
|             } break; | ||||
|         #endif | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 raysan5
					raysan5