Commit graph

256 commits

Author SHA1 Message Date
konstruktor227
b0c3013b51
[raudio] Support 24-bit FLACs in LoadMusicStreamFromMemory (#4279)
Force conversion to 16-bit, same as how it is done in `LoadMusicStream`.
This fixes the problem where 24-bit FLACs play silence or broken sound.
2024-08-23 22:51:29 +02:00
Ray
3abe728712 Minor tweaks 2024-07-08 22:54:19 +02:00
Ray
17cbc75aa7 REVIEWED: Formatting, follow raylib coding conventions 2024-06-30 11:07:38 +02:00
listeria
df849d2fb0
[raudio] fix mapping of wave data in LoadWaveSamples() (#4062)
Co-authored-by: Listeria monocytogenes <listeria@disroot.org>
2024-06-13 16:05:22 +02:00
Alexey Kutepov
33c598123c
[raudio] Add 24 bits samples support for FLAC format (#4058)
Similarly to how it's done for WAV format, by forcing the conversion
to s16 on UpdateMusicStream().
2024-06-12 11:42:41 +02:00
listeria
b429dbdc4b
fix WaveCrop(): update wave->frameCount (#4003)
also allow `finalFrame = wave->frameCount' as the range of frames does
not include it.

Co-authored-by: Listeria monocytogenes <listeria@disroot.org>
2024-05-24 18:24:40 +02:00
listeria
bb9bd73f43
fix WaveCrop() and use frames instead of samples (#3994)
Co-authored-by: Listeria monocytogenes <listeria@disroot.org>
2024-05-21 08:13:46 +02:00
FishingHacks
3d70d6179c
[raudio] Removed drwav_uninit in LoadMusicStream to fix a crash (#3986) 2024-05-16 19:47:39 +02:00
veins1
1aa3559155
Fixes for loading Music (#3966)
* Fixes for loading Music

Fix for #3889
Fixes for QOA crashes.
Memory leak FIX on unsuccessful .wav loading.

* Added comments
2024-05-07 20:44:41 +02:00
Ray
3caa424ad4 Review formatting 2024-04-21 12:29:09 +02:00
Ray
c1943f0f7c REVIEWED: Move some functions, made them static 2024-04-20 20:30:35 +02:00
Christian Haas
d80a622972
[raudio] Fix 3664: crash in raudio from multithreading issues (#3907)
* Flip release of buffer;

First it needs to be taken out of the processing chain, then it can be released. The inverse of the initialization.

* Add mutex locks to audio buffer functions; Separate those used from both threads

* Flip release of buffer;

First it needs to be taken out of the processing chain, then it can be released. The inverse of the initialization.

* Remove TODO marker; The buffer is in stopped state and its data won't be accessed

* Add mutex locks to music/stream functions directly operating on buffer

* Secure UpdateMusicStream/PlayMusicStream/UpdateAudioStream;

This change is twofold:
* Add locks to UpdateMusicStream/UpdateAudioStream (second one needed separation)
* Remove unnecessary hack to restart music - inlining the statements resulted in a no-op

Especially the second part made it easier to ensure thread-safety overall

* Remove redundant check; Already checked at beginning of function
2024-04-20 20:15:09 +02:00
Ray
29ce13b777 Code gardening
- Review formatting
 - Improve readability for some functions result return
 - Minimize early returns
 - Align LoadFileData() to UnloadFileData()
2024-04-20 13:53:13 +02:00
veins1
289e7d3a6c
Reset music.ctxType if loading wasn't succesful (#3917)
Fixes some crashes, e.g. calling StopMusicStream after trying to load Music from a non-existant .mp3 file
2024-04-14 00:15:50 +02:00
Ray
646d70e93a Remove trailing spaces 2024-04-02 09:38:06 +02:00
IoIxD
7ec43022c1
Fix segfault in ExportWaveAsCode (#3769)
`char *txtData = (char *)RL_CALLOC(waveDataSize * 6 + 2000, sizeof(char));`

assumes every chunk being added to txtData is 6 bytes. This is not always true, sometimes a newline is involved and the data becomes 12 bytes instead, and this can cause a random segfault.

This commit changes `6` to `12`, and explains why in the comment.
2024-02-01 21:16:57 +01:00
Alessandro Nikolaev
cf10cdd6b3
Added missing "standalone" functions to raudio.c & fixed return bug (#3760)
* Added GetFileNameWithoutExt, GetFileName & strprbrk to raudio.c

* Gave return values to SaveFileData & SaveFileText in raudio.c
2024-01-28 13:46:27 +01:00
Idir Carlos Aliane
6f1c31b25d
Change some minor comments to align with comments style (#3755) 2024-01-22 21:26:18 +01:00
Ray
c95b71d40d Update raudio.c 2024-01-05 22:33:02 +01:00
Ray
3f1e59a7cf Update copyright to 2024 2024-01-02 20:58:12 +01:00
Alexandre Almeida
f6de0358e1
Disable unused miniaudio features (#3544)
* Disable unused miniaudio features

* Fix mistakes
2023-11-18 20:06:19 +01:00
Ray
f88604e6d5 Reviewed QOA seek PR 2023-10-31 15:54:38 +01:00
veins1
6842012748
Fix QOA seeking (#3494) 2023-10-31 15:48:24 +01:00
Lukas
daf227a185
Fixes a memory leak as a result of creating an AudioBuffer* with the old source.frameCount. This internally allocates memory to the structs data pointer which is then later overridden by the correct sound data of the source sound. (#3458)
Additionally added a volume assignment from old to new as currently there is no way to get the volume of a sound and the AudioBuffer struct is not reachable from user code due to opaque definition.
2023-10-23 18:16:28 +02:00
Alexey Kutepov
d7d04a07a2
[raudio] Implement GetMasterVolume() (#3434)
It feels a little unfinished when you can SetMasterVolume but can't
really Get it. So to finish the symmetry here is the GetMasterVolume
implementation.
2023-10-17 23:35:38 +02:00
Daniil Kisel
5a0d9c8d43
Fix UpdateSound parameter name (#3405) 2023-10-13 19:54:43 +02:00
Ray
f93d0ff9bc Update raudio.c 2023-10-09 11:17:09 +02:00
Le Juez Victor
4d2906b0a5
Move mutex initialization before ma_device_start() (#3325) 2023-09-18 18:50:22 +02:00
Ray
0f447f1fb6 REVIEWED: Data size type consistency between functions #3168 2023-09-02 12:05:34 +02:00
Ray
93f59a6f59 Review tabs and trail-spaces 2023-08-10 22:47:17 +02:00
Ray
42cfabc670 REVIEWED: Old pragma formating 2023-08-09 10:00:26 +02:00
Jeffery Myers
601cadbae6
[AUDIO] Add a function to make an alias of a sound and share it's sample data (#3219)
* Add a function to clone a sound and share data with another sound.

* rename items based on feedback

* PR Feedback, use custom unload for sound alias, not variant of normal sound unloading
2023-08-04 16:40:10 +02:00
Ray
7d68aa6869 REVIEWED: Modules description layout 2023-05-01 14:04:22 +02:00
Ray
838fc7e303 REVIEWED: Some old TODOs 2023-04-22 21:17:53 +02:00
RadsammyT
e2da32e2da
[raudio] Rewritten ExportWaveAsCode() file saving to be more like rtextures ExportImageAsCode() (#3013)
* Update raudio.c

Review `raudio.c`: rewritten `ExportWaveAsCode()` to be more like rtextures.c `ExportImageAsCode()'

* no tab november

accidentally inserted a tab somewhere. corrected it.
2023-04-15 10:58:00 +02:00
Ray
709b14180a Make assets loading extension case insensitive #3008 2023-04-13 23:08:32 +02:00
Jeffery Myers
e57ee9c0e8
Fix warnings in raylib for MSVC (#3004) 2023-04-09 22:42:15 +02:00
Webfra
08670ecea1
Add const qualifier to char * path argument in qoaplay_open() (#2972)
* Add const qualifier to char * path argument
in qoa_open()

* Remove unnecessary cast
2023-03-19 20:34:22 +01:00
Rob Loach
c14c7f0b69
raudio: Fix warning on discarded const qualifier (#2967)
The `qoaplay_open()` function expects a `char *`, but we are passing in a `const char *`. While this works just fine, it does issue a compiler warning when strict:

```
src/raudio.c: In function ‘LoadMusicStream’:
src/raudio.c:1290:45: warning: passing argument 1 of ‘qoaplay_open’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 1290 |         qoaplay_desc *ctxQoa = qoaplay_open(fileName);
      |                                             ^~~~~~~~
In file included from src/raudio.c:233:
src/external/qoaplay.c:86:34: note: expected ‘char *’ but argument is of type ‘const char *’
   86 | qoaplay_desc *qoaplay_open(char *path)
      |                            ~~~~~~^~~~
```

This change casts the argument to a `char *` to fix the warning.
2023-03-19 11:16:52 +01:00
veins1
cf04425bc2
Spelling (#2957) 2023-03-14 19:23:17 +01:00
Ray
ab1e246367 REVIEWED: Data types validation 2023-03-07 20:33:45 +01:00
Ray
ae53600d31 WARNING: REMOVED: Multichannel audio support API 2023-03-07 19:54:53 +01:00
Ray
1b873b028f WARNING: REMOVED: Multichannel audio support API
It was quite restrictive and hacky implementation, just load multiple types same sound to play multiple instances.
2023-03-07 19:48:47 +01:00
Ray
aae7ab64c7 Update raudio.c 2023-03-06 13:00:30 +01:00
Ray
68ee0bb8dd ADDED: QOA music streaming (with auxiliar lib)
Some format tweaks
2023-03-06 12:33:49 +01:00
Ray
9614d3353b REVIEWED: QOA audio file export 2023-03-05 13:49:18 +01:00
Ray
5492f52adc Change default threading model for COM objects
It shouldn't matter much but it could avoid some conflicts with other libraries in the future (like `tinyfiledialogs`).
2023-03-05 00:09:56 +01:00
Ray
d5a31168ce REVIEWED: Data validation 2023-02-23 18:08:15 +01:00
hkc
d26a56d4e1
Added mixed audio processor (#2929)
* Use RL_QUADS/RL_TRIANGLES for single-pixel drawing

Addresses problem mentioned in
https://github.com/raysan5/raylib/issues/2744#issuecomment-1273568263
(in short: when drawing pixels using DrawPixel{,V} in camera mode,
upscaled pixel becomes a line instead of bigger pixel)

* [rtextures] Fixed scaling down in ImageTextEx

Closes #2755

* Added global audio processor

* Renamed struct member to follow naming conventions

* Added example for AttachAudioMixedProcessor
2023-02-20 11:13:24 +01:00
Julio C. Galindo
6ae21d6581
Fixed some grammar mistakes and typos. (#2914)
* Fixed some grammar mistakes.

* Fixed some typos.
2023-02-09 13:17:47 +01:00