Commit Graph

125 Commits

Author SHA1 Message Date
Ray 581bd0eb02 Remove trailing spaces 2021-04-18 23:50:32 +02:00
Jeffery Myers f6f9a3d925 use xm streams in the same sample sample size as the output device (#1716) 2021-04-09 11:00:21 +02:00
Ray 551944e15b Minor comment tweaks 2021-04-06 13:04:15 +02:00
raysan5 aed0fee2ca Remove trailing spaces 2021-04-01 20:24:33 +02:00
raysan5 8f1d81df0f Review code formatting 2021-03-31 17:55:46 +02:00
Ray 24dae29a03 Review latest PR and some formatting 2021-03-22 20:41:33 +01:00
Jeffery Myers 2c0a533948 [AUDIO] Music Looping enhancements (#1665)
* Add loop functions for music files.
Tell xm tracker to loop tracker when loop state changes.
Don't let looped xm tracker streams restart, they are infinite
Use modulo to make time tracker for xm looped streams work correctly.

* Remove loop functions, set XM loop in update based on flag.
Formatting cleanups.

Co-authored-by: Jeffery Myers <JefMyers@blizzard.com>
2021-03-22 20:36:13 +01:00
Jeffery Myers b573ff3e7a [AUDIO] Use device native sample rates (#1660)
* Init MinAudio to a sample rate of 0 to let the device pick the rate.
Read the rate from the device after it starts up.
Convert AUDIO_DEVICE_SAMPLE_RATE from a #def into an int, that is set from the device's rate
Set all sample systems to use the AUDIO_DEVICE_SAMPLE_RATE as the target rate to minimize resampling.

* use device sample rate instead of separate var
let config define a device sample rate if it wants to, but let the default be 0 for native rate.

* Don't use fixed sample rates for tracker files.
Remove config default audio buffer size and replace with a function that computes one for a reasonable frame rate at the output sample rate.
2021-03-21 22:07:55 +01:00
Ray 9909068714 Removed trailing spaces 2021-03-19 19:43:44 +01:00
Ray a1d9987e7c WARNING: BREAKING: REVIEWED some enums naming
Now enum names are more consistent between them.
2021-03-19 13:19:54 +01:00
Ray 1ed72b7812 Minor struct organization tweak 2021-03-04 12:08:54 +01:00
Ray bcc4418ff0 REVIEWED: GetFileExtension() to include the dot #1523 2021-03-02 01:07:08 +01:00
Agnis "NeZvērs" Aldiņš ead339fa96 LoadMusicStreamFromMemory OGG support (#1613) 2021-02-25 11:55:08 +01:00
Agnis "NeZvērs" Aldiņš 24839c7cfb jar_xm_create_context_safe requesting const char* (#1611)
Fixing compiler warning for passing (unsigned char*) to (const char*)
2021-02-24 12:23:39 +01:00
Agnis "NeZvērs" Aldiņš 0cb748f30b LoadMusicStreamFromMemory wav mp3 flac support (#1609) 2021-02-24 09:22:21 +01:00
Agnis "NeZvērs" Aldiņš 209445ccde LoadMusicStreamFromMemory (#1606)
* define SUPPORT_FILEFORMAT_MOD in config.h

* RLAPI LoadModuleFromData() definition in raylib.h

* LoadModuleFromData() definition in raudio.h

* LoadModuleFromData implementation in raudio.c

* Rename API to LoadMusicStreamFromMemory & default unload.

* raudio.c tabs to spaces

* Styling curly bracket and removing dev debugging TRACELOG

Co-authored-by: nezvers <agnis16@inbox.lv>
2021-02-22 19:45:52 +01:00
Chris ccb083af52 [raudio] Fix load and unload issues with Music (#1588)
* 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.

* Fix memory issues with LoadMusicStream and UnloadMusicStream
- Set ctxType and ctxData even if the format fails to load.
- Set ctxData to NULL if it fails and check for null inside UnloadMusicStream.
- Change RL_MALLOC when loading formats to RL_CALLOC to prevent undefined behavior.
- Add NULL check when unloading xm file.
2021-02-14 17:37:34 +01:00
raysan5 c49ce58f02 REVIEWED: Multichannel sound system #1548
I don't like this solution but I think it's valid in the meantime....
2021-02-07 19:20:30 +01:00
raysan5 edb54c6cb1 REVIEWED: CloseAudioBufferPool(), uninit buffers properly #1548 2021-02-05 19:45:13 +01:00
raysan5 5663c81803 REVIEWED: raudio: Some LOG_ERROR -> LOG_WARNING #1562 2021-02-05 19:19:44 +01:00
raysan5 ed9c10a3e6 Update raudio.c 2021-02-02 11:42:49 +01:00
Ray b7f275efb3 Review warning 2021-01-15 00:20:23 +01:00
raysan5 d7b4b9e485 Update year to 2021 2021-01-02 18:15:13 +01:00
Victor Gallet 9fe153ae29 Avoid dereferencing a null pointer in the 'LoadSounsFromWave' function if the audioBuffer is null (#1499) 2020-12-31 13:28:16 +01:00
raysan5 0a9e080998 Remove trailing spaces 2020-12-23 15:03:26 +01:00
Ray e07bc372a1 WARNING: RENAMED several functions for consistency #1440
This is a BREAKING CHANGE!

To address the linked issue, several functions have been renamed and couterpart functions have been created to free loaded memory:
 - RENAMED: GetImageData() -> LoadImageColors()
 - RENAMED: GetImagePalette() -> LoadImagePalette()
 - RENAMED: GetWaveData() -> LoadWaveSamples()
 - ADDED: UnloadImageColors()
 - ADDED: UnloadImagePalette()
 - ADDED: UnloadWaveSamples()
2020-12-18 21:03:08 +01:00
Ray e6ae4879f6 Added security check to pitch change #1450 2020-12-12 13:07:46 +01:00
Ray 459c4754dc Reviewed SetAudioBufferPitch() #1450 2020-12-12 13:01:31 +01:00
Jeffery Myers df249f5513 Fix typecast warnings in raylib code as reported by visual studio 2019 (#1443) 2020-11-30 08:14:11 +01:00
Ray bb9d734f69 Exposing some file access results to user layer #1420 2020-11-22 00:10:16 +01:00
Ray 7f6cd93d62 WARNING: Multiple funcs reviewed!
There were some problems about frameCount vs sampleCount that could cause some breaks.

raylib audio structs stores sampleCount = frameCount*channels.

Most libraries return framesCount instead of sampleCount.

stb_vorbis seems to refer to framesCount as samples.

All required functions have been reviewed.
2020-11-19 20:11:11 +01:00
Ray f448542dd2 Review issues with FLAC loading 2020-11-16 12:20:50 +01:00
raysan5 321f55bce1 Update audio libraries #1423
miniaudio -> v0.10.25
dr_wav -> v0.12.14
dr_mp3 -> v0.6.19
dr_flac -> v0.12.22
2020-11-15 14:04:28 +01:00
Ray 3e1cd487df Remove trailing spaces 2020-11-03 23:47:33 +01:00
raysan5 43d82c1f21 Add security checks when loading data from memory 2020-09-16 11:33:56 +02:00
raysan5 2d96196d25 REVIEWED: SaveWAV() to use memory write insted of file 2020-09-15 13:17:10 +02:00
Ray 8cf0be4b6c Review memory loading functions signesness 2020-09-14 19:20:38 +02:00
Ray 5b60a743bd ADDED: LoadWaveFromMemory() #1327 2020-09-13 15:38:57 +02:00
raysan5 ad1b3330b7 Support mulstiple WAV sampleSize for MusicStream #1340
24bit per sample is not supported internally and automatically converted 16bit
2020-08-11 19:08:07 +02:00
raysan5 6e9e7bd6bc LoadSound(): Use memory loading (WAV, OGG, MP3, FLAC) #1312 2020-07-31 12:13:04 +02:00
raysan5 bf429a0058 Remove conditional __EMSCRIPTEN__
Not required anymore
2020-07-13 18:57:46 +02:00
raysan5 fa7799143e Update miniaudio to v0.10.12, solves #1288 2020-07-10 13:29:42 +02:00
Random 86a8f1d5d5 Chromium needs a larger audio buffer (#1300)
* Chromium needs a larger audio buffer: https://github.com/dr-soft/miniaudio/issues/150

* changed PLATFORM_WEB to __EMSCRIPTEN__
2020-07-10 12:34:35 +02:00
Ray 5986eee6ab Expose additional configuration options
Some internal defines have been exposed in config.h
2020-06-30 11:05:09 +02:00
raysan5 1c5df677e1 REDESIGNED: ExportWaveAsCode() to use memory buffer 2020-05-24 15:48:07 +02:00
raysan5 8120547639 Added LoadWAV()/SaveWAV() memory buffer sample code
It could be useful in a future...
2020-05-24 00:20:32 +02:00
raysan5 a6fcd32339 Support WAV music streaming #1198
Switched custom WAV laoding/saving funtionality to drwav library, it also provides the required mechanisms to stream wav data.
2020-05-23 23:19:59 +02:00
raysan5 94789dd24a Review usage of sizeof(), unify conventions
All functions requiring sizeof() now follow the same convention:

NUM_ELEMENTS*NUM_SUBELEMENTS*sizeof()
2020-05-23 19:23:40 +02:00
raysan5 a2955bc5b3 Corrected issue with multichannel on CloseAudioDevice() 2020-05-22 00:32:23 +02:00
raysan5 257f232d41 WARNING: BREAKING CHANGE: Review audio looping system
Current looping system was broken, `loopCount` has been converted to `bool looping` and user can enable/disable with `music.looping = false`. `SetMusicLoopCount()` has been removed.
2020-05-14 14:00:37 +02:00