Ver código fonte

quick fix

Boolean errors
pull/110/head
Joshua Reisenauer 9 anos atrás
pai
commit
f12754b01f
3 arquivos alterados com 14 adições e 12 exclusões
  1. +10
    -10
      src/audio.c
  2. +2
    -1
      src/jar_xm.h
  3. +2
    -1
      src/raylib.h

+ 10
- 10
src/audio.c Ver arquivo

@ -42,9 +42,6 @@
#include <string.h> // Required for strcmp() #include <string.h> // Required for strcmp()
#include <stdio.h> // Used for .WAV loading #include <stdio.h> // Used for .WAV loading
#define JAR_XM_IMPLEMENTATION
#include "jar_xm.h" // For playing .xm files
#if defined(AUDIO_STANDALONE) #if defined(AUDIO_STANDALONE)
#include <stdarg.h> // Used for functions with variable number of parameters (TraceLog()) #include <stdarg.h> // Used for functions with variable number of parameters (TraceLog())
#else #else
@ -53,7 +50,10 @@
#endif #endif
//#define STB_VORBIS_HEADER_ONLY //#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 // Defines and Macros
@ -576,11 +576,11 @@ void PlayMusicStream(char *fileName)
currentMusic.loop = true; currentMusic.loop = true;
// only stereo/float is supported for xm // only stereo/float is supported for xm
if(n">info.channels == 2 && !jar_xm_create_context_from_file(&currentMusic.chipctx, currentMusic.sampleRate, fileName))
if(!jar_xm_create_context_from_file(&currentMusic.chipctx, currentMusic.sampleRate, fileName))
{ {
currentMusic.format = AL_FORMAT_STEREO_FLOAT32;
jar_xm_set_max_loop_count(currentMusic.chipctx, 0); //infinite number of loops
o">//currentMusic.totalSamplesLeft = p">; // 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 = n">jar_xm_get_remaining_samples(currentMusic.chipctx);
musicEnabled = true; musicEnabled = true;
} }
} }
@ -712,8 +712,8 @@ static bool BufferMusicStream(ALuint buffer)
{ {
if (currentMusic.chipTune) 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 else
{ {

+ 2
- 1
src/jar_xm.h Ver arquivo

@ -59,10 +59,11 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h>
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

+ 2
- 1
src/raylib.h Ver arquivo

@ -261,7 +261,8 @@
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#ifndef __cplusplus #ifndef __cplusplus
// Boolean type // Boolean type
typedef enum { false, true } bool;
#include <stdbool.h>
//typedef enum { false, true } bool;
#endif #endif
// byte type // byte type

Carregando…
Cancelar
Salvar