summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRay <[email protected]>2023-03-05 13:49:18 +0100
committerRay <[email protected]>2023-03-05 13:49:18 +0100
commit9614d3353b81b95adcfd01392c62326a8c512aee (patch)
treefcacfa804b9a4dd1e28141098f82ecce1e6c30d1
parentab14ad5d754f7bbccbf8845b8062c8ece018b3e0 (diff)
downloadraylib-9614d3353b81b95adcfd01392c62326a8c512aee.tar.gz
raylib-9614d3353b81b95adcfd01392c62326a8c512aee.zip
REVIEWED: QOA audio file export
-rw-r--r--src/raudio.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/raudio.c b/src/raudio.c
index b4b8b64e..207c0c49 100644
--- a/src/raudio.c
+++ b/src/raudio.c
@@ -1003,13 +1003,17 @@ bool ExportWave(Wave wave, const char *fileName)
#if defined(SUPPORT_FILEFORMAT_QOA)
else if (IsFileExtension(fileName, ".qoa"))
{
- qoa_desc qoa = { 0 };
- qoa.channels = wave.channels;
- qoa.samplerate = wave.sampleRate;
- qoa.samples = wave.frameCount;
+ if (wave.sampleSize == 16)
+ {
+ qoa_desc qoa = { 0 };
+ qoa.channels = wave.channels;
+ qoa.samplerate = wave.sampleRate;
+ qoa.samples = wave.frameCount;
- // TODO: Review wave.data format required for export
- success = qoa_write(fileName, wave.data, &qoa);
+ int bytesWritten = qoa_write(fileName, wave.data, &qoa);
+ if (bytesWritten > 0) success = true;
+ }
+ else TRACELOG(LOG_WARNING, "AUDIO: Wave data must be 16 bit per sample for QOA format export");
}
#endif
else if (IsFileExtension(fileName, ".raw"))