diff options
| author | Ray <[email protected]> | 2018-07-19 23:15:46 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2018-07-19 23:15:46 +0200 |
| commit | 6e812cf14700d4106ab941c3b2da02da06b0fb45 (patch) | |
| tree | c5f928f7f5c027439a7b9f0530704b57e292ceec /src/audio.c | |
| parent | 103044926bc904a11c145f1d12cf22001a2c085b (diff) | |
| download | raylib-6e812cf14700d4106ab941c3b2da02da06b0fb45.tar.gz raylib-6e812cf14700d4106ab941c3b2da02da06b0fb45.zip | |
Working on MP3 support
Diffstat (limited to 'src/audio.c')
| -rw-r--r-- | src/audio.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/audio.c b/src/audio.c index 31a56215..b6e2e4c6 100644 --- a/src/audio.c +++ b/src/audio.c @@ -1373,13 +1373,13 @@ Music LoadMusicStream(const char *fileName) #if defined(SUPPORT_FILEFORMAT_MP3) else if (IsFileExtension(fileName, ".mp3")) { - drmp3_init_file(&music->ctxMp3, fileName, NULL) + drmp3_init_file(&music->ctxMp3, fileName, NULL); - if (music->ctxMp3 == NULL) TraceLog(LOG_WARNING, "[%s] MP3 audio file could not be opened", fileName); + if (music->ctxMp3.framesRemaining <= 0) TraceLog(LOG_WARNING, "[%s] MP3 audio file could not be opened", fileName); else { music->stream = InitAudioStream(music->ctxMp3.sampleRate, 16, music->ctxMp3.channels); - //music->totalSamples = (unsigned int)music->ctxMp3.totalSampleCount/music->ctxMp3.channels; //TODO! + music->totalSamples = (unsigned int)music->ctxMp3.framesRemaining*music->ctxMp3.channels; music->samplesLeft = music->totalSamples; music->ctxType = MUSIC_AUDIO_MP3; music->loopCount = -1; // Infinite loop by default @@ -1594,7 +1594,7 @@ void UpdateMusicStream(Music music) case MUSIC_AUDIO_MP3: { // NOTE: Returns the number of samples to process - unsigned int numSamplesMp3 = (unsigned int)drmp3_read_f32(music->ctxMp3, samplesCount*music->stream.channels, (short *)pcm); + unsigned int numSamplesMp3 = (unsigned int)drmp3_read_f32(&music->ctxMp3, samplesCount*music->stream.channels, (float *)pcm); } break; #endif |
