1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-25 02:04:23 +00:00

New classes: Reverb and ReverbAudioSource. Fixes for component alpha levels, mac file chooser, MemoryInputStream.

This commit is contained in:
Julian Storer 2011-05-23 18:17:03 +01:00
parent 94b07cb09b
commit e6f64740d9
36 changed files with 1170 additions and 258 deletions

View file

@ -39,10 +39,7 @@ MemoryInputStream::MemoryInputStream (const void* const sourceData,
position (0)
{
if (keepInternalCopy)
{
internalCopy.append (data, sourceDataSize);
data = static_cast <const char*> (internalCopy.getData());
}
createInternalCopy();
}
MemoryInputStream::MemoryInputStream (const MemoryBlock& sourceData,
@ -52,10 +49,14 @@ MemoryInputStream::MemoryInputStream (const MemoryBlock& sourceData,
position (0)
{
if (keepInternalCopy)
{
internalCopy = sourceData;
data = static_cast <const char*> (internalCopy.getData());
}
createInternalCopy();
}
void MemoryInputStream::createInternalCopy()
{
internalCopy.malloc (dataSize);
memcpy (internalCopy, data, dataSize);
data = internalCopy;
}
MemoryInputStream::~MemoryInputStream()
@ -71,6 +72,9 @@ int MemoryInputStream::read (void* const buffer, const int howMany)
{
jassert (howMany >= 0);
const int num = jmin (howMany, (int) (dataSize - position));
if (num <= 0)
return 0;
memcpy (buffer, data + position, num);
position += num;
return (int) num;
@ -78,7 +82,7 @@ int MemoryInputStream::read (void* const buffer, const int howMany)
bool MemoryInputStream::isExhausted()
{
return (position >= dataSize);
return position >= dataSize;
}
bool MemoryInputStream::setPosition (const int64 pos)
@ -93,6 +97,7 @@ int64 MemoryInputStream::getPosition()
}
//==============================================================================
#if JUCE_UNIT_TESTS
#include "../../utilities/juce_UnitTest.h"