Review latest PR and some formatting
This commit is contained in:
parent
2c0a533948
commit
24dae29a03
@ -761,7 +761,7 @@ Model LoadModel(const char *fileName)
|
|||||||
|
|
||||||
if (model.meshMaterial == NULL) model.meshMaterial = (int *)RL_CALLOC(model.meshCount, sizeof(int));
|
if (model.meshMaterial == NULL) model.meshMaterial = (int *)RL_CALLOC(model.meshCount, sizeof(int));
|
||||||
}
|
}
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
27
src/raudio.c
27
src/raudio.c
@ -1313,7 +1313,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int d
|
|||||||
else if (TextIsEqual(fileExtLower, ".wav"))
|
else if (TextIsEqual(fileExtLower, ".wav"))
|
||||||
{
|
{
|
||||||
drwav *ctxWav = RL_CALLOC(1, sizeof(drwav));
|
drwav *ctxWav = RL_CALLOC(1, sizeof(drwav));
|
||||||
|
|
||||||
bool success = drwav_init_memory(ctxWav, (const void*)data, dataSize, NULL);
|
bool success = drwav_init_memory(ctxWav, (const void*)data, dataSize, NULL);
|
||||||
|
|
||||||
music.ctxType = MUSIC_AUDIO_WAV;
|
music.ctxType = MUSIC_AUDIO_WAV;
|
||||||
@ -1419,7 +1419,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int d
|
|||||||
|
|
||||||
// copy data to allocated memory for default UnloadMusicStream
|
// copy data to allocated memory for default UnloadMusicStream
|
||||||
unsigned char *newData = RL_MALLOC(dataSize);
|
unsigned char *newData = RL_MALLOC(dataSize);
|
||||||
int it = dataSize / sizeof(unsigned char);
|
int it = dataSize/sizeof(unsigned char);
|
||||||
for (int i = 0; i < it; i++){
|
for (int i = 0; i < it; i++){
|
||||||
newData[i] = data[i];
|
newData[i] = data[i];
|
||||||
}
|
}
|
||||||
@ -1437,7 +1437,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int d
|
|||||||
music.ctxType = MUSIC_MODULE_MOD;
|
music.ctxType = MUSIC_MODULE_MOD;
|
||||||
|
|
||||||
// NOTE: Only stereo is supported for MOD
|
// NOTE: Only stereo is supported for MOD
|
||||||
music.stream = InitAudioStream(AUDIO.System.device.sampleRate, 16, 2);
|
music.stream = InitAudioStream(AUDIO.System.device.sampleRate, 16, 2);
|
||||||
music.sampleCount = (unsigned int)jar_mod_max_samples(ctxMod)*2; // 2 channels
|
music.sampleCount = (unsigned int)jar_mod_max_samples(ctxMod)*2; // 2 channels
|
||||||
music.looping = true; // Looping enabled by default
|
music.looping = true; // Looping enabled by default
|
||||||
musicLoaded = true;
|
musicLoaded = true;
|
||||||
@ -1464,7 +1464,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int d
|
|||||||
#if defined(SUPPORT_FILEFORMAT_OGG)
|
#if defined(SUPPORT_FILEFORMAT_OGG)
|
||||||
else if (music.ctxType == MUSIC_AUDIO_OGG) stb_vorbis_close((stb_vorbis *)music.ctxData);
|
else if (music.ctxType == MUSIC_AUDIO_OGG) stb_vorbis_close((stb_vorbis *)music.ctxData);
|
||||||
#endif
|
#endif
|
||||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
#if defined(SUPPORT_FILEFORMAT_XM)
|
||||||
else if (music.ctxType == MUSIC_MODULE_XM) jar_xm_free_context((jar_xm_context_t *)music.ctxData);
|
else if (music.ctxType == MUSIC_MODULE_XM) jar_xm_free_context((jar_xm_context_t *)music.ctxData);
|
||||||
#endif
|
#endif
|
||||||
#if defined(SUPPORT_FILEFORMAT_MOD)
|
#if defined(SUPPORT_FILEFORMAT_MOD)
|
||||||
@ -1657,8 +1657,8 @@ void UpdateMusicStream(Music music)
|
|||||||
|
|
||||||
if ((music.ctxType == MUSIC_MODULE_XM) || music.ctxType == MUSIC_MODULE_MOD)
|
if ((music.ctxType == MUSIC_MODULE_XM) || music.ctxType == MUSIC_MODULE_MOD)
|
||||||
{
|
{
|
||||||
if (samplesCount > 1) sampleLeft -= samplesCount / 2;
|
if (samplesCount > 1) sampleLeft -= samplesCount/2;
|
||||||
else sampleLeft -= samplesCount;
|
else sampleLeft -= samplesCount;
|
||||||
}
|
}
|
||||||
else sampleLeft -= samplesCount;
|
else sampleLeft -= samplesCount;
|
||||||
|
|
||||||
@ -1718,14 +1718,14 @@ float GetMusicTimeLength(Music music)
|
|||||||
float GetMusicTimePlayed(Music music)
|
float GetMusicTimePlayed(Music music)
|
||||||
{
|
{
|
||||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
#if defined(SUPPORT_FILEFORMAT_XM)
|
||||||
if (music.ctxType == MUSIC_MODULE_XM)
|
if (music.ctxType == MUSIC_MODULE_XM)
|
||||||
{
|
{
|
||||||
uint64_t samples = 0;
|
uint64_t samples = 0;
|
||||||
jar_xm_get_position(music.ctxData, NULL, NULL, NULL, &samples);
|
jar_xm_get_position(music.ctxData, NULL, NULL, NULL, &samples);
|
||||||
samples = samples % (music.sampleCount);
|
samples = samples % (music.sampleCount);
|
||||||
|
|
||||||
return (float)(samples) / (music.stream.sampleRate * music.stream.channels);
|
return (float)(samples)/(music.stream.sampleRate*music.stream.channels);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
float secondsPlayed = 0.0f;
|
float secondsPlayed = 0.0f;
|
||||||
if (music.stream.buffer != NULL)
|
if (music.stream.buffer != NULL)
|
||||||
@ -1890,10 +1890,11 @@ int GetAudioStreamBufferSizeDefault()
|
|||||||
{
|
{
|
||||||
// if the buffer is not set, compute one that would give us a buffer good enough for a decent frame rate
|
// if the buffer is not set, compute one that would give us a buffer good enough for a decent frame rate
|
||||||
if (AUDIO.Buffer.defaultSize == 0)
|
if (AUDIO.Buffer.defaultSize == 0)
|
||||||
AUDIO.Buffer.defaultSize = AUDIO.System.device.sampleRate / 30;
|
AUDIO.Buffer.defaultSize = AUDIO.System.device.sampleRate/30;
|
||||||
|
|
||||||
return AUDIO.Buffer.defaultSize;
|
return AUDIO.Buffer.defaultSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module specific Functions Definition
|
// Module specific Functions Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
@ -2014,7 +2015,7 @@ static ma_uint32 ReadAudioBufferFramesInMixingFormat(AudioBuffer *audioBuffer, f
|
|||||||
inputFramesToProcessThisIteration = inputBufferFrameCap;
|
inputFramesToProcessThisIteration = inputBufferFrameCap;
|
||||||
}
|
}
|
||||||
|
|
||||||
float *runningFramesOut = framesOut + (totalOutputFramesProcessed * audioBuffer->converter.config.channelsOut);
|
float *runningFramesOut = framesOut + (totalOutputFramesProcessed*audioBuffer->converter.config.channelsOut);
|
||||||
|
|
||||||
/* At this point we can convert the data to our mixing format. */
|
/* At this point we can convert the data to our mixing format. */
|
||||||
ma_uint64 inputFramesProcessedThisIteration = ReadAudioBufferFramesInInternalFormat(audioBuffer, inputBuffer, (ma_uint32)inputFramesToProcessThisIteration); /* Safe cast. */
|
ma_uint64 inputFramesProcessedThisIteration = ReadAudioBufferFramesInInternalFormat(audioBuffer, inputBuffer, (ma_uint32)inputFramesToProcessThisIteration); /* Safe cast. */
|
||||||
|
@ -1236,7 +1236,7 @@ RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 posi
|
|||||||
// NOTE: These functions require GPU access
|
// NOTE: These functions require GPU access
|
||||||
RLAPI Texture2D LoadTexture(const char *fileName); // Load texture from file into GPU memory (VRAM)
|
RLAPI Texture2D LoadTexture(const char *fileName); // Load texture from file into GPU memory (VRAM)
|
||||||
RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data
|
RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data
|
||||||
RLAPI TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported
|
RLAPI TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported
|
||||||
RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
|
RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
|
||||||
RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
|
RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
|
||||||
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
|
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
|
||||||
@ -1485,13 +1485,13 @@ RLAPI Music LoadMusicStream(const char *fileName); // Load mu
|
|||||||
RLAPI Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int dataSize); // Load module music from data
|
RLAPI Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int dataSize); // Load module music from data
|
||||||
RLAPI void UnloadMusicStream(Music music); // Unload music stream
|
RLAPI void UnloadMusicStream(Music music); // Unload music stream
|
||||||
RLAPI void PlayMusicStream(Music music); // Start music playing
|
RLAPI void PlayMusicStream(Music music); // Start music playing
|
||||||
|
RLAPI bool IsMusicPlaying(Music music); // Check if music is playing
|
||||||
RLAPI void UpdateMusicStream(Music music); // Updates buffers for music streaming
|
RLAPI void UpdateMusicStream(Music music); // Updates buffers for music streaming
|
||||||
RLAPI void StopMusicStream(Music music); // Stop music playing
|
RLAPI void StopMusicStream(Music music); // Stop music playing
|
||||||
RLAPI void PauseMusicStream(Music music); // Pause music playing
|
RLAPI void PauseMusicStream(Music music); // Pause music playing
|
||||||
RLAPI void ResumeMusicStream(Music music); // Resume playing paused music
|
RLAPI void ResumeMusicStream(Music music); // Resume playing paused music
|
||||||
RLAPI void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level)
|
RLAPI void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level)
|
||||||
RLAPI void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level)
|
RLAPI void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level)
|
||||||
RLAPI void SetMusicLooping(Music *music, bool loop); // Set the music to loop or not
|
|
||||||
RLAPI float GetMusicTimeLength(Music music); // Get music time length (in seconds)
|
RLAPI float GetMusicTimeLength(Music music); // Get music time length (in seconds)
|
||||||
RLAPI float GetMusicTimePlayed(Music music); // Get current music time played (in seconds)
|
RLAPI float GetMusicTimePlayed(Music music); // Get current music time played (in seconds)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user