Review QOA sound loading -WIP-
This commit is contained in:
parent
ff70a04bf5
commit
c91190fc6e
1 changed files with 19 additions and 9 deletions
18
src/raudio.c
18
src/raudio.c
|
@ -829,7 +829,15 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
|
|||
{
|
||||
qoa_desc qoa = { 0 };
|
||||
|
||||
// NOTE: Returned sample data is always 16 bit?
|
||||
unsigned int result = qoa_decode_header(fileData, dataSize, &qoa);
|
||||
|
||||
if (result > 0)
|
||||
{
|
||||
|
||||
// Calculate the total audio frame count
|
||||
wave.frameCount = qoa.samples;
|
||||
|
||||
// NOTE: Returned sample data is always 16 bit
|
||||
wave.data = qoa_decode(fileData, dataSize, &qoa);
|
||||
wave.sampleSize = 16;
|
||||
|
||||
|
@ -837,10 +845,10 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
|
|||
{
|
||||
wave.channels = qoa.channels;
|
||||
wave.sampleRate = qoa.samplerate;
|
||||
wave.frameCount = qoa.samples;
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "WAVE: Failed to load QOA data");
|
||||
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "WAVE: Failed to load QOA data");
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_FLAC)
|
||||
|
@ -1380,6 +1388,7 @@ Music LoadMusicStream(const char *fileName)
|
|||
qoa_desc *ctxQoa = RL_CALLOC(1, sizeof(qoa_desc));
|
||||
|
||||
// TODO: QOA stream support: Init context from file
|
||||
int result = 0;
|
||||
|
||||
music.ctxType = MUSIC_AUDIO_QOA;
|
||||
music.ctxData = ctxQoa;
|
||||
|
@ -1578,11 +1587,12 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
|||
qoa_desc *ctxQoa = RL_CALLOC(1, sizeof(qoa_desc));
|
||||
|
||||
// TODO: Init QOA context data
|
||||
int result = 0;
|
||||
|
||||
music.ctxType = MUSIC_AUDIO_QOA;
|
||||
music.ctxData = ctxQoa;
|
||||
|
||||
if (success)
|
||||
if (result > 0)
|
||||
{
|
||||
music.stream = LoadAudioStream(ctxQoa->samplerate, 16, ctxQoa->channels);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue