Skip to content

Commit

Permalink
[kawashima] Enabled converting looped HCA audio files. (solves #1)
Browse files Browse the repository at this point in the history
  • Loading branch information
hozuki committed Nov 14, 2016
1 parent 3bb0dfc commit ed11273
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/lib/kawashima/hca/CHcaDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <memory.h>
#include <string.h>
#include <cstdio>
#include "CHcaDecoder.h"
#include "HcaNative.h"
#include "Magic.h"
Expand Down Expand Up @@ -657,21 +658,17 @@ KS_RESULT CHcaDecoder::ConvertData(uint8 *pData, uint32 dwAudioDataSize, uint32
uint8 *dataCursor = pData + dwDataCursor;
dwAudioDataSize -= dwDataCursor;

if (!_hcaInfo.loopExists) {
KS_RESULT result;
for (uint32 i = 0; i < totalBlockCount; ++i) {
if (processedDataSize >= dwAudioDataSize) {
return KS_ERR_BUFFER_TOO_SMALL;
}
result = ConvertBlock(dataCursor, blockSize);
if (!KS_CALL_SUCCESSFUL(result)) {
return result;
}
processedDataSize += blockSize;
dataCursor += blockSize;
KS_RESULT result;
for (uint32 i = 0; i < totalBlockCount; ++i) {
if (processedDataSize >= dwAudioDataSize) {
return KS_ERR_BUFFER_TOO_SMALL;
}
} else {
return KS_ERR_NOT_IMPLEMENTED;
result = ConvertBlock(dataCursor, blockSize);
if (!KS_CALL_SUCCESSFUL(result)) {
return result;
}
processedDataSize += blockSize;
dataCursor += blockSize;
}

return KS_ERR_OK;
Expand Down

0 comments on commit ed11273

Please sign in to comment.