diff options
| author | Joshua Reisenauer <kd7tck@msn.com> | 2016-04-25 18:40:19 -0700 |
|---|---|---|
| committer | Joshua Reisenauer <kd7tck@msn.com> | 2016-04-25 18:40:19 -0700 |
| commit | f12754b01f107913b722c80f0d957bdcdfb68c81 (patch) | |
| tree | 1c0074769c537b080e13f8ce26464cb392b6b4ca /src | |
| parent | 62087d21cc9c3ab166fd0e4e54401c907374a46a (diff) | |
| download | raylib-f12754b01f107913b722c80f0d957bdcdfb68c81.tar.gz raylib-f12754b01f107913b722c80f0d957bdcdfb68c81.zip | |
quick fix
Boolean errors
Diffstat (limited to 'src')
| -rw-r--r-- | src/audio.c | 20 | ||||
| -rw-r--r-- | src/jar_xm.h | 3 | ||||
| -rw-r--r-- | src/raylib.h | 3 |
3 files changed, 14 insertions, 12 deletions
diff --git a/src/audio.c b/src/audio.c index 93b83599..5953cd40 100644 --- a/src/audio.c +++ b/src/audio.c @@ -42,9 +42,6 @@ #include <string.h> // Required for strcmp() #include <stdio.h> // Used for .WAV loading -#define JAR_XM_IMPLEMENTATION -#include "jar_xm.h" // For playing .xm files - #if defined(AUDIO_STANDALONE) #include <stdarg.h> // Used for functions with variable number of parameters (TraceLog()) #else @@ -53,7 +50,10 @@ #endif //#define STB_VORBIS_HEADER_ONLY -#include "stb_vorbis.h" // OGG loading functions +#include "stb_vorbis.h" // OGG loading functions + +#define JAR_XM_IMPLEMENTATION +#include "jar_xm.h" // For playing .xm files //---------------------------------------------------------------------------------- // Defines and Macros @@ -576,11 +576,11 @@ void PlayMusicStream(char *fileName) currentMusic.loop = true; // only stereo/float is supported for xm - if(info.channels == 2 && !jar_xm_create_context_from_file(¤tMusic.chipctx, currentMusic.sampleRate, fileName)) + if(!jar_xm_create_context_from_file(¤tMusic.chipctx, currentMusic.sampleRate, fileName)) { - currentMusic.format = AL_FORMAT_STEREO_FLOAT32; - jar_xm_set_max_loop_count(currentMusic.chipctx, 0); //infinite number of loops - //currentMusic.totalSamplesLeft = ; // Unsure of how to calculate this + currentMusic.format = AL_FORMAT_STEREO16; // AL_FORMAT_STEREO_FLOAT32; + jar_xm_set_max_loop_count(currentMusic.chipctx, 0); // infinite number of loops + currentMusic.totalSamplesLeft = jar_xm_get_remaining_samples(currentMusic.chipctx); musicEnabled = true; } } @@ -712,8 +712,8 @@ static bool BufferMusicStream(ALuint buffer) { if (currentMusic.chipTune) { - jar_xm_generate_samples(currentMusic.chipctx, pcm + size, (MUSIC_BUFFER_SIZE - size) / 2); - streamedBytes = (MUSIC_BUFFER_SIZE - size)/2; // There is no end of stream for xmfiles, once the end is reached zeros are generated for non looped chiptunes. + jar_xm_generate_samples_16bit(currentMusic.chipctx, pcm + size, (MUSIC_BUFFER_SIZE - size) / 2); + streamedBytes = (MUSIC_BUFFER_SIZE - size) * 2; // There is no end of stream for xmfiles, once the end is reached zeros are generated for non looped chiptunes. } else { diff --git a/src/jar_xm.h b/src/jar_xm.h index 4fda948b..062b88da 100644 --- a/src/jar_xm.h +++ b/src/jar_xm.h @@ -59,10 +59,11 @@ #include <stdio.h> #include <stdlib.h> #include <stdint.h> -#include <stdbool.h> #include <limits.h> #include <string.h> + + //------------------------------------------------------------------------------- #ifdef __cplusplus extern "C" { diff --git a/src/raylib.h b/src/raylib.h index 0c80b957..de157087 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -261,7 +261,8 @@ //---------------------------------------------------------------------------------- #ifndef __cplusplus // Boolean type -typedef enum { false, true } bool; +#include <stdbool.h> +//typedef enum { false, true } bool; #endif // byte type |
