Add MUSIC_AUDIO_NONE to MusicContextType and format fixes

- Useful to check the context type to see if the format is recognized. Defaulting to wav causes issues where formats are assumed to
be wav.
This commit is contained in:
ChrisDill 2021-02-13 09:31:37 +00:00
parent 6037adcace
commit 90f810ddb7

View File

@ -275,7 +275,8 @@ typedef struct tagBITMAPINFOHEADER {
// NOTE: Depends on data structure provided by the library // NOTE: Depends on data structure provided by the library
// in charge of reading the different file types // in charge of reading the different file types
typedef enum { typedef enum {
MUSIC_AUDIO_WAV = 0, MUSIC_AUDIO_NONE = 0,
MUSIC_AUDIO_WAV,
MUSIC_AUDIO_OGG, MUSIC_AUDIO_OGG,
MUSIC_AUDIO_FLAC, MUSIC_AUDIO_FLAC,
MUSIC_AUDIO_MP3, MUSIC_AUDIO_MP3,
@ -1112,9 +1113,9 @@ float *LoadWaveSamples(Wave wave)
for (unsigned int i = 0; i < wave.sampleCount; i++) for (unsigned int i = 0; i < wave.sampleCount; i++)
{ {
if (wave.sampleSize == 8) samples[i] = (float)(((unsigned char *)wave.data)[i] - 127)/256.0f; if (wave.sampleSize == 8) samples[i] = (float)(((unsigned char *)wave.data)[i] - 127)/256.0f;
else if (wave.sampleSize == 16) samples[i] = (float)(((short *)wave.data)[i])/32767.0f; else if (wave.sampleSize == 16) samples[i] = (float)(((short *)wave.data)[i])/32767.0f;
else if (wave.sampleSize == 32) samples[i] = ((float *)wave.data)[i]; else if (wave.sampleSize == 32) samples[i] = ((float *)wave.data)[i];
} }
return samples; return samples;