1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

AudioFormat: Use int64 for ogg/flac reservoir sizes

This commit is contained in:
reuk 2021-01-15 16:54:59 +00:00
parent fac6116441
commit 37d1cc9394
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
2 changed files with 8 additions and 8 deletions

View file

@ -250,7 +250,7 @@ public:
samplesInReservoir = 0;
}
else if (startSampleInFile < reservoirStart
|| startSampleInFile > reservoirStart + jmax (samplesInReservoir, 511))
|| startSampleInFile > reservoirStart + jmax (samplesInReservoir, (int64) 511))
{
// had some problems with flac crashing if the read pos is aligned more
// accurately than this. Probably fixed in newer versions of the library, though.
@ -367,7 +367,7 @@ public:
private:
FlacNamespace::FLAC__StreamDecoder* decoder;
AudioBuffer<float> reservoir;
int reservoirStart = 0, samplesInReservoir = 0;
int64 reservoirStart = 0, samplesInReservoir = 0;
bool ok = false, scanningForLength = false;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FlacReader)

View file

@ -160,13 +160,13 @@ public:
{
while (numSamples > 0)
{
auto numAvailable = (int) (reservoirStart + samplesInReservoir - startSampleInFile);
auto numAvailable = (reservoirStart + samplesInReservoir - startSampleInFile);
if (startSampleInFile >= reservoirStart && numAvailable > 0)
{
// got a few samples overlapping, so use them before seeking..
auto numToUse = jmin (numSamples, numAvailable);
auto numToUse = jmin ((int64) numSamples, numAvailable);
for (int i = jmin (numDestChannels, reservoir.getNumChannels()); --i >= 0;)
if (destSamples[i] != nullptr)
@ -175,8 +175,8 @@ public:
(size_t) numToUse * sizeof (float));
startSampleInFile += numToUse;
numSamples -= numToUse;
startOffsetInDestBuffer += numToUse;
numSamples -= (int) numToUse;
startOffsetInDestBuffer += (int) numToUse;
if (numSamples == 0)
break;
@ -194,7 +194,7 @@ public:
int bitStream = 0;
int offset = 0;
int numToRead = samplesInReservoir;
int numToRead = (int) samplesInReservoir;
while (numToRead > 0)
{
@ -261,7 +261,7 @@ private:
OggVorbisNamespace::OggVorbis_File ovFile;
OggVorbisNamespace::ov_callbacks callbacks;
AudioBuffer<float> reservoir;
int reservoirStart = 0, samplesInReservoir = 0;
int64 reservoirStart = 0, samplesInReservoir = 0;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OggReader)
};