fix sample init size way too big

This commit is contained in:
Eknous-P 2025-10-06 00:40:18 +04:00
parent 78a86e3d08
commit 2739b5af54
2 changed files with 3 additions and 2 deletions

View file

@ -543,7 +543,7 @@ bool DivSample::saveRaw(const char* path) {
}
// 16-bit memory is padded to 512, to make things easier for ADPCM-A/B.
bool DivSample::initInternal(DivSampleDepth d, int count) {
bool DivSample::initInternal(DivSampleDepth d, unsigned int count) {
logV("initInternal(%d,%d)",(int)d,count);
switch (d) {
case DIV_SAMPLE_DEPTH_1BIT: // 1-bit
@ -651,6 +651,7 @@ bool DivSample::initInternal(DivSampleDepth d, int count) {
}
bool DivSample::init(unsigned int count) {
if (count>16777215) return false;
if (!initInternal(depth,count)) return false;
setSampleCount(count);
return true;

View file

@ -236,7 +236,7 @@ struct DivSample {
* @param count number of samples.
* @return whether it was successful.
*/
bool initInternal(DivSampleDepth d, int count);
bool initInternal(DivSampleDepth d, unsigned int count);
/**
* initialize sample data. make sure you have set `depth` before doing so.