188 |
|
|
189 |
|
|
190 |
#if USE_DISK_STREAMING |
#if USE_DISK_STREAMING |
|
if (pSample->Compressed) { // hack |
|
|
pSample->BitDepth = 16; |
|
|
pSample->FrameSize = 4; |
|
|
} |
|
|
|
|
191 |
long neededsize = (pSample->Compressed) ? 10485760 /* 10 MB buffer */ |
long neededsize = (pSample->Compressed) ? 10485760 /* 10 MB buffer */ |
192 |
: pSample->SamplesTotal * pSample->FrameSize; |
: pSample->SamplesTotal * pSample->FrameSize; |
193 |
if (BufferSize < neededsize) { |
if (BufferSize < neededsize) { |
202 |
uint8_t* pSamplePiece = pWave; |
uint8_t* pSamplePiece = pWave; |
203 |
do { // we read the sample in small pieces and increment the size with each run just to test streaming capability |
do { // we read the sample in small pieces and increment the size with each run just to test streaming capability |
204 |
readinthisrun = pSample->Read(pSamplePiece, ++samplepiecesize); |
readinthisrun = pSample->Read(pSamplePiece, ++samplepiecesize); |
205 |
pSamplePiece += readinthisrun * pSample->FrameSize; |
// 24 bit is truncated to 16 by Sample::Read at the moment |
206 |
|
pSamplePiece += readinthisrun * (2 * pSample->Channels); // readinthisrun * pSample->FrameSize; |
207 |
readsamples += readinthisrun; |
readsamples += readinthisrun; |
208 |
} while (readinthisrun == samplepiecesize); |
} while (readinthisrun == samplepiecesize); |
209 |
|
|
210 |
if (pSample->Compressed) { // hack |
if (pSample->Compressed) { // hack |
211 |
pSample->SamplesTotal = readsamples; |
pSample->SamplesTotal = readsamples; |
212 |
|
pSample->BitDepth = 16; |
213 |
} |
} |
214 |
# else // read in one piece |
# else // read in one piece |
215 |
if (pSample->Compressed) { |
if (pSample->Compressed) { |