1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-04 03:40:07 +00:00

Workarounds for VC6.

This commit is contained in:
Julian Storer 2010-11-17 14:01:14 +00:00
parent cc607e0a38
commit b952084419
44 changed files with 851 additions and 686 deletions

View file

@ -170,7 +170,19 @@
#elif defined (_MSC_VER)
#define JUCE_MSVC 1
#if _MSC_VER >= 1400
#if _MSC_VER < 1500
#define JUCE_VC8_OR_EARLIER 1
#if _MSC_VER < 1400
#define JUCE_VC7_OR_EARLIER 1
#if _MSC_VER < 1300
#define JUCE_VC6 1
#endif
#endif
#endif
#if ! JUCE_VC7_OR_EARLIER
#define JUCE_USE_INTRINSICS 1
#endif
#else
@ -4686,6 +4698,11 @@ class Expression::Helpers
public:
typedef ReferenceCountedObjectPtr<Term> TermPtr;
// This helper function is needed to work around VC6 scoping bugs
static const TermPtr& getTermFor (const Expression& exp) throw() { return exp.term; }
friend class Expression::Term; // (also only needed as a VC6 workaround)
class Constant : public Term
{
public:
@ -4735,7 +4752,7 @@ public:
try
{
return c.getSymbolValue (mainSymbol, member).term->evaluate (c, recursionDepth);
return getTermFor (c.getSymbolValue (mainSymbol, member))->evaluate (c, recursionDepth);
}
catch (...)
{}
@ -4765,7 +4782,7 @@ public:
try
{
return c != 0 && c->getSymbolValue (mainSymbol, member).term->referencesSymbol (s, c, recursionDepth);
return c != 0 && getTermFor (c->getSymbolValue (mainSymbol, member))->referencesSymbol (s, c, recursionDepth);
}
catch (EvaluationError&)
{
@ -12105,11 +12122,11 @@ namespace NumberToStringConverters
juce_wchar getDecimalPoint()
{
#if JUCE_MSVC && _MSC_VER < 1400
#if JUCE_VC7_OR_EARLIER
static juce_wchar dp = std::_USE (std::locale(), std::numpunct <wchar_t>).decimal_point();
#else
#else
static juce_wchar dp = std::use_facet <std::numpunct <wchar_t> > (std::locale()).decimal_point();
#endif
#endif
return dp;
}
@ -12141,15 +12158,15 @@ namespace NumberToStringConverters
}
else
{
#if JUCE_WINDOWS
#if (JUCE_MSVC && _MSC_VER <= 1400) || JUCE_MINGW
#if JUCE_WINDOWS
#if JUCE_VC8_OR_EARLIER || JUCE_MINGW
len = _snwprintf (buffer, numChars, L"%.9g", n);
#else
#else
len = _snwprintf_s (buffer, numChars, _TRUNCATE, L"%.9g", n);
#endif
#else
#endif
#else
len = swprintf (buffer, numChars, L"%.9g", n);
#endif
#endif
return buffer;
}
}
@ -18994,7 +19011,7 @@ bool Value::operator!= (const Value& other) const
return value != other.value && value->getValue() != other.getValue();
}
void Value::addListener (Listener* const listener)
void Value::addListener (ValueListener* const listener)
{
if (listener != 0)
{
@ -19005,7 +19022,7 @@ void Value::addListener (Listener* const listener)
}
}
void Value::removeListener (Listener* const listener)
void Value::removeListener (ValueListener* const listener)
{
listeners.remove (listener);
@ -19016,7 +19033,7 @@ void Value::removeListener (Listener* const listener)
void Value::callListeners()
{
Value v (*this); // (create a copy in case this gets deleted by a callback)
listeners.call (&Value::Listener::valueChanged, v);
listeners.call (&ValueListener::valueChanged, v);
}
OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value)
@ -25148,7 +25165,7 @@ void ResamplingAudioSource::createLowPass (const double frequencyRatio)
const double proportionalRate = (frequencyRatio > 1.0) ? 0.5 / frequencyRatio
: 0.5 * frequencyRatio;
const double n = 1.0 / tan (double_Pi * jmax (0.001, proportionalRate));
const double n = 1.0 / std::tan (double_Pi * jmax (0.001, proportionalRate));
const double nSquared = n * n;
const double c1 = 1.0 / (1.0 + std::sqrt (2.0) * n + nSquared);
@ -40045,7 +40062,9 @@ Component::Component (const String& name)
Component::~Component()
{
#if ! JUCE_VC6 // (access to private union not allowed in VC6)
static_jassert (sizeof (flags) <= sizeof (componentFlags_));
#endif
componentListeners.call (&ComponentListener::componentBeingDeleted, *this);
@ -43714,12 +43733,12 @@ void Button::handleCommandMessage (int commandId)
}
}
void Button::addButtonListener (Listener* const newListener)
void Button::addButtonListener (ButtonListener* const newListener)
{
buttonListeners.add (newListener);
}
void Button::removeButtonListener (Listener* const listener)
void Button::removeButtonListener (ButtonListener* const listener)
{
buttonListeners.remove (listener);
}
@ -48105,12 +48124,12 @@ void ComboBox::mouseUp (const MouseEvent& e2)
}
}
void ComboBox::addListener (Listener* const listener)
void ComboBox::addListener (ComboBoxListener* const listener)
{
listeners.add (listener);
}
void ComboBox::removeListener (Listener* const listener)
void ComboBox::removeListener (ComboBoxListener* const listener)
{
listeners.remove (listener);
}
@ -48491,12 +48510,12 @@ KeyboardFocusTraverser* Label::createFocusTraverser()
return new LabelKeyboardFocusTraverser();
}
void Label::addListener (Listener* const listener)
void Label::addListener (LabelListener* const listener)
{
listeners.add (listener);
}
void Label::removeListener (Listener* const listener)
void Label::removeListener (LabelListener* const listener)
{
listeners.remove (listener);
}
@ -49375,7 +49394,7 @@ void ListBox::setOutlineThickness (const int outlineThickness_)
void ListBox::setHeaderComponent (Component* const newHeaderComponent)
{
if (newHeaderComponent != headerComponent)
if (headerComponent != newHeaderComponent)
{
headerComponent = newHeaderComponent;
@ -49706,12 +49725,12 @@ void Slider::sendDragEnd()
listeners.callChecked (checker, &SliderListener::sliderDragEnded, this);
}
void Slider::addListener (Listener* const listener)
void Slider::addListener (SliderListener* const listener)
{
listeners.add (listener);
}
void Slider::removeListener (Listener* const listener)
void Slider::removeListener (SliderListener* const listener)
{
listeners.remove (listener);
}
@ -53140,7 +53159,7 @@ public:
class TextEditor::TextHolderComponent : public Component,
public Timer,
public Value::Listener
public ValueListener
{
public:
TextHolderComponent (TextEditor& owner_)
@ -53541,12 +53560,12 @@ void TextEditor::escapePressed()
postCommandMessage (TextEditorDefs::escapeKeyMessageId);
}
void TextEditor::addListener (Listener* const newListener)
void TextEditor::addListener (TextEditorListener* const newListener)
{
listeners.add (newListener);
}
void TextEditor::removeListener (Listener* const listenerToRemove)
void TextEditor::removeListener (TextEditorListener* const listenerToRemove)
{
listeners.remove (listenerToRemove);
}
@ -54463,19 +54482,19 @@ void TextEditor::handleCommandMessage (const int commandId)
switch (commandId)
{
case TextEditorDefs::textChangeMessageId:
listeners.callChecked (checker, &TextEditor::Listener::textEditorTextChanged, (TextEditor&) *this);
listeners.callChecked (checker, &TextEditorListener::textEditorTextChanged, (TextEditor&) *this);
break;
case TextEditorDefs::returnKeyMessageId:
listeners.callChecked (checker, &TextEditor::Listener::textEditorReturnKeyPressed, (TextEditor&) *this);
listeners.callChecked (checker, &TextEditorListener::textEditorReturnKeyPressed, (TextEditor&) *this);
break;
case TextEditorDefs::escapeKeyMessageId:
listeners.callChecked (checker, &TextEditor::Listener::textEditorEscapeKeyPressed, (TextEditor&) *this);
listeners.callChecked (checker, &TextEditorListener::textEditorEscapeKeyPressed, (TextEditor&) *this);
break;
case TextEditorDefs::focusLossMessageId:
listeners.callChecked (checker, &TextEditor::Listener::textEditorFocusLost, (TextEditor&) *this);
listeners.callChecked (checker, &TextEditorListener::textEditorFocusLost, (TextEditor&) *this);
break;
default:
@ -55511,7 +55530,7 @@ void Toolbar::itemDropped (const String&, Component* sourceComponent, int, int)
tc->setState (Button::buttonNormal);
}
void Toolbar::mouseDown (const MouseEvent& e)
void Toolbar::mouseDown (const MouseEvent&)
{
}
@ -63831,7 +63850,7 @@ public:
repaint();
}
void buttonClicked (Button* button)
void buttonClicked (Button*)
{
owner.showExtraItemsMenu();
}
@ -72020,7 +72039,7 @@ END_JUCE_NAMESPACE
BEGIN_JUCE_NAMESPACE
class ChoicePropertyComponent::RemapperValueSource : public Value::ValueSource,
public Value::Listener
public ValueListener
{
public:
RemapperValueSource (const Value& sourceValue_, const Array<var>& mappings_)
@ -83564,7 +83583,7 @@ private:
GradientEdgeTableRenderer& operator= (const GradientEdgeTableRenderer&);
};
namespace
namespace RenderingHelpers
{
forcedinline int safeModulo (int n, const int divisor) throw()
{
@ -83585,8 +83604,8 @@ public:
: destData (destData_),
srcData (srcData_),
extraAlpha (extraAlpha_ + 1),
xOffset (repeatPattern ? safeModulo (x, srcData_.width) - srcData_.width : x),
yOffset (repeatPattern ? safeModulo (y, srcData_.height) - srcData_.height : y)
xOffset (repeatPattern ? RenderingHelpers::safeModulo (x, srcData_.width) - srcData_.width : x),
yOffset (repeatPattern ? RenderingHelpers::safeModulo (y, srcData_.height) - srcData_.height : y)
{
}
@ -83828,8 +83847,8 @@ private:
if (repeatPattern)
{
loResX = safeModulo (loResX, srcData.width);
loResY = safeModulo (loResY, srcData.height);
loResX = RenderingHelpers::safeModulo (loResX, srcData.width);
loResY = RenderingHelpers::safeModulo (loResY, srcData.height);
}
if (betterQuality)
@ -86307,10 +86326,10 @@ bool DrawableComposite::Marker::operator!= (const DrawableComposite::Marker& oth
return name != other.name || position != other.position;
}
const char* const DrawableComposite::contentLeftMarkerName ("left");
const char* const DrawableComposite::contentRightMarkerName ("right");
const char* const DrawableComposite::contentTopMarkerName ("top");
const char* const DrawableComposite::contentBottomMarkerName ("bottom");
const char* const DrawableComposite::contentLeftMarkerName = "left";
const char* const DrawableComposite::contentRightMarkerName = "right";
const char* const DrawableComposite::contentTopMarkerName = "top";
const char* const DrawableComposite::contentBottomMarkerName = "bottom";
const RelativeRectangle DrawableComposite::getContentArea() const
{
@ -86746,7 +86765,7 @@ void DrawableComposite::ValueTreeWrapper::removeMarker (bool xAxis, const ValueT
&& state [nameProperty].toString() != contentRightMarkerName
&& state [nameProperty].toString() != contentTopMarkerName
&& state [nameProperty].toString() != contentBottomMarkerName)
return getMarkerList (xAxis).removeChild (state, undoManager);
getMarkerList (xAxis).removeChild (state, undoManager);
}
const Rectangle<float> DrawableComposite::refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider)
@ -87301,7 +87320,7 @@ Value DrawablePath::ValueTreeWrapper::Element::getControlPointValue (int index,
void DrawablePath::ValueTreeWrapper::Element::setControlPoint (const int index, const RelativePoint& point, UndoManager* undoManager)
{
jassert (index >= 0 && index < getNumControlPoints());
return state.setProperty (index == 0 ? point1 : (index == 1 ? point2 : point3), point.toString(), undoManager);
state.setProperty (index == 0 ? point1 : (index == 1 ? point2 : point3), point.toString(), undoManager);
}
const RelativePoint DrawablePath::ValueTreeWrapper::Element::getStartPoint() const
@ -95143,7 +95162,7 @@ public:
return new LowLevelGraphicsSoftwareRenderer (Image (this));
}
SharedImage* clone()
Image::SharedImage* clone()
{
SoftwareSharedImage* s = new SoftwareSharedImage (format, width, height, false);
memcpy (s->imageData, imageData, lineStride * height);
@ -95186,7 +95205,7 @@ public:
return g;
}
SharedImage* clone()
Image::SharedImage* clone()
{
return new SubsectionSharedImage (image->clone(), area);
}
@ -238124,11 +238143,11 @@ __int64 juce_InterlockedCompareExchange64 (volatile __int64* value, __int64 newV
CriticalSection::CriticalSection() throw()
{
// (just to check the MS haven't changed this structure and broken things...)
#if _MSC_VER >= 1400
static_jassert (sizeof (CRITICAL_SECTION) <= sizeof (internal));
#else
#if JUCE_VC7_OR_EARLIER
static_jassert (sizeof (CRITICAL_SECTION) <= 24);
#endif
#else
static_jassert (sizeof (CRITICAL_SECTION) <= sizeof (internal));
#endif
InitializeCriticalSection ((CRITICAL_SECTION*) internal);
}
@ -241663,7 +241682,7 @@ public:
return new LowLevelGraphicsSoftwareRenderer (Image (this));
}
SharedImage* clone()
Image::SharedImage* clone()
{
WindowsBitmapImage* im = new WindowsBitmapImage (format, width, height, false);

View file

@ -64,7 +64,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 91
#define JUCE_BUILDNUMBER 92
/** Current Juce version number.
@ -208,7 +208,19 @@
#elif defined (_MSC_VER)
#define JUCE_MSVC 1
#if _MSC_VER >= 1400
#if _MSC_VER < 1500
#define JUCE_VC8_OR_EARLIER 1
#if _MSC_VER < 1400
#define JUCE_VC7_OR_EARLIER 1
#if _MSC_VER < 1300
#define JUCE_VC6 1
#endif
#endif
#endif
#if ! JUCE_VC7_OR_EARLIER
#define JUCE_USE_INTRINSICS 1
#endif
#else
@ -698,8 +710,20 @@
// Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
#if JUCE_MSVC
#if (defined(_MSC_VER) && (_MSC_VER <= 1200))
#if JUCE_VC6
#pragma warning (disable: 4284 4786) // (spurious VC6 warnings)
namespace std // VC6 doesn't have sqrt/sin/cos/tan/abs in std, so declare them here:
{
template <typename Type> Type abs (Type a) { if (a < 0) return -a; return a; }
template <typename Type> Type tan (Type a) { return static_cast<Type> (::tan (static_cast<double> (a))); }
template <typename Type> Type sin (Type a) { return static_cast<Type> (::sin (static_cast<double> (a))); }
template <typename Type> Type cos (Type a) { return static_cast<Type> (::cos (static_cast<double> (a))); }
template <typename Type> Type sqrt (Type a) { return static_cast<Type> (::sqrt (static_cast<double> (a))); }
template <typename Type> Type floor (Type a) { return static_cast<Type> (::floor (static_cast<double> (a))); }
template <typename Type> Type ceil (Type a) { return static_cast<Type> (::ceil (static_cast<double> (a))); }
template <typename Type> Type atan2 (Type a, Type b) { return static_cast<Type> (::atan2 (static_cast<double> (a), static_cast<double> (b))); }
}
#endif
#pragma warning (push)
@ -1035,7 +1059,7 @@ typedef unsigned int uint32;
typedef int64 pointer_sized_int;
/** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
typedef uint64 pointer_sized_uint;
#elif _MSC_VER >= 1300
#elif JUCE_MSVC && ! JUCE_VC6
/** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
typedef _W64 int pointer_sized_int;
/** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
@ -1114,22 +1138,26 @@ inline void swapVariables (Type& variable1, Type& variable2)
variable2 = tempVal;
}
/** Handy function for getting the number of elements in a simple const C array.
#if JUCE_VC6
#define numElementsInArray(X) (sizeof((X)) / sizeof(0[X]))
#else
/** Handy function for getting the number of elements in a simple const C array.
E.g.
@code
static int myArray[] = { 1, 2, 3 };
E.g.
@code
static int myArray[] = { 1, 2, 3 };
int numElements = numElementsInArray (myArray) // returns 3
@endcode
*/
template <typename Type, int N>
inline int numElementsInArray (Type (&array)[N])
{
(void) array; // (required to avoid a spurious warning in MS compilers)
sizeof (0[array]); // This line should cause an error if you pass an object with a user-defined subscript operator
return N;
}
int numElements = numElementsInArray (myArray) // returns 3
@endcode
*/
template <typename Type, int N>
inline int numElementsInArray (Type (&array)[N])
{
(void) array; // (required to avoid a spurious warning in MS compilers)
sizeof (0[array]); // This line should cause an error if you pass an object with a user-defined subscript operator
return N;
}
#endif
// Some useful maths functions that aren't always present with all compilers and build settings.
@ -1271,9 +1299,9 @@ inline int roundFloatToInt (const float value) throw()
*/
namespace TypeHelpers
{
#if defined (_MSC_VER) && _MSC_VER <= 1400
#if JUCE_VC8_OR_EARLIER
#define PARAMETER_TYPE(a) a
#else
#else
/** The ParameterType struct is used to find the best type to use when passing some kind
of object as a parameter.
@ -1288,7 +1316,7 @@ namespace TypeHelpers
*/
template <typename Type> struct ParameterType { typedef const Type& type; };
#if ! DOXYGEN
#if ! DOXYGEN
template <typename Type> struct ParameterType <Type&> { typedef Type& type; };
template <typename Type> struct ParameterType <Type*> { typedef Type* type; };
template <> struct ParameterType <char> { typedef char type; };
@ -1304,13 +1332,13 @@ namespace TypeHelpers
template <> struct ParameterType <bool> { typedef bool type; };
template <> struct ParameterType <float> { typedef float type; };
template <> struct ParameterType <double> { typedef double type; };
#endif
#endif
/** A helpful macro to simplify the use of the ParameterType template.
@see ParameterType
*/
#define PARAMETER_TYPE(a) typename TypeHelpers::ParameterType<a>::type
#endif
#endif
}
#endif // __JUCE_MATHSFUNCTIONS_JUCEHEADER__
@ -4016,7 +4044,7 @@ template <typename ElementType,
class Array
{
private:
#if defined (_MSC_VER) && _MSC_VER <= 1400
#if JUCE_VC8_OR_EARLIER
typedef const ElementType& ParameterType;
#else
typedef PARAMETER_TYPE (ElementType) ParameterType;
@ -6776,7 +6804,7 @@ private:
This can be handy for checking whether this is a null pointer.
*/
template <class ObjectType>
inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
bool operator== (const ScopedPointer<ObjectType>& pointer1, ObjectType* const pointer2) throw()
{
return static_cast <ObjectType*> (pointer1) == pointer2;
}
@ -6785,7 +6813,7 @@ inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectT
This can be handy for checking whether this is a null pointer.
*/
template <class ObjectType>
inline bool operator!= (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
bool operator!= (const ScopedPointer<ObjectType>& pointer1, ObjectType* const pointer2) throw()
{
return static_cast <ObjectType*> (pointer1) != pointer2;
}
@ -12500,7 +12528,7 @@ template <class ListenerClass,
class ListenerList
{
// Horrible macros required to support VC6/7..
#if defined (_MSC_VER) && _MSC_VER <= 1400
#if JUCE_VC8_OR_EARLIER
#define LL_TEMPLATE(a) typename P##a, typename Q##a
#define LL_PARAM(a) Q##a& param##a
#else
@ -12940,6 +12968,9 @@ private:
/** Writes a Value to an OutputStream as a UTF8 string. */
OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value);
/** This typedef is just for compatibility with old code - newer code should use the Value::Listener class directly. */
typedef Value::Listener ValueListener;
#endif // __JUCE_VALUE_JUCEHEADER__
/*** End of inlined file: juce_Value.h ***/
@ -25546,7 +25577,7 @@ public:
protected:
friend class Image;
friend class Image::BitmapData;
friend class BitmapData;
const PixelFormat format;
const int width, height;
int pixelStride, lineStride;
@ -25565,6 +25596,9 @@ public:
juce_UseDebuggingNewOperator
private:
friend class SharedImage;
friend class BitmapData;
ReferenceCountedObjectPtr<SharedImage> image;
};
@ -30099,6 +30133,240 @@ public:
class NonConst; /**< Used as a template parameter for AudioData::Pointer. Indicates that the pointer can be used for non-const data. */
class Const; /**< Used as a template parameter for AudioData::Pointer. Indicates that the samples can only be used for const data.. */
#ifndef DOXYGEN
class BigEndian
{
public:
template <class SampleFormatType> static inline float getAsFloat (SampleFormatType& s) throw() { return s.getAsFloatBE(); }
template <class SampleFormatType> static inline void setAsFloat (SampleFormatType& s, float newValue) throw() { s.setAsFloatBE (newValue); }
template <class SampleFormatType> static inline int32 getAsInt32 (SampleFormatType& s) throw() { return s.getAsInt32BE(); }
template <class SampleFormatType> static inline void setAsInt32 (SampleFormatType& s, int32 newValue) throw() { s.setAsInt32BE (newValue); }
template <class SourceType, class DestType> static inline void copyFrom (DestType& dest, SourceType& source) throw() { dest.copyFromBE (source); }
enum { isBigEndian = 1 };
};
class LittleEndian
{
public:
template <class SampleFormatType> static inline float getAsFloat (SampleFormatType& s) throw() { return s.getAsFloatLE(); }
template <class SampleFormatType> static inline void setAsFloat (SampleFormatType& s, float newValue) throw() { s.setAsFloatLE (newValue); }
template <class SampleFormatType> static inline int32 getAsInt32 (SampleFormatType& s) throw() { return s.getAsInt32LE(); }
template <class SampleFormatType> static inline void setAsInt32 (SampleFormatType& s, int32 newValue) throw() { s.setAsInt32LE (newValue); }
template <class SourceType, class DestType> static inline void copyFrom (DestType& dest, SourceType& source) throw() { dest.copyFromLE (source); }
enum { isBigEndian = 0 };
};
#if JUCE_BIG_ENDIAN
class NativeEndian : public BigEndian {};
#else
class NativeEndian : public LittleEndian {};
#endif
class Int8
{
public:
inline Int8 (void* data_) throw() : data (static_cast <int8*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) (*data * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatBE() const throw() { return getAsFloatLE(); }
inline void setAsFloatLE (float newValue) throw() { *data = (int8) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))); }
inline void setAsFloatBE (float newValue) throw() { setAsFloatLE (newValue); }
inline int32 getAsInt32LE() const throw() { return (int) (*data << 24); }
inline int32 getAsInt32BE() const throw() { return getAsInt32LE(); }
inline void setAsInt32LE (int newValue) throw() { *data = (int8) (newValue >> 24); }
inline void setAsInt32BE (int newValue) throw() { setAsInt32LE (newValue); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int8& source) throw() { *data = *source.data; }
int8* data;
enum { bytesPerSample = 1, maxValue = 0x7f, resolution = (1 << 24), isFloat = 0 };
};
class UInt8
{
public:
inline UInt8 (void* data_) throw() : data (static_cast <uint8*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) ((*data - 128) * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatBE() const throw() { return getAsFloatLE(); }
inline void setAsFloatLE (float newValue) throw() { *data = (uint8) jlimit (0, 255, 128 + roundToInt (newValue * (1.0 + maxValue))); }
inline void setAsFloatBE (float newValue) throw() { setAsFloatLE (newValue); }
inline int32 getAsInt32LE() const throw() { return (int) ((*data - 128) << 24); }
inline int32 getAsInt32BE() const throw() { return getAsInt32LE(); }
inline void setAsInt32LE (int newValue) throw() { *data = (uint8) (128 + (newValue >> 24)); }
inline void setAsInt32BE (int newValue) throw() { setAsInt32LE (newValue); }
inline void clear() throw() { *data = 128; }
inline void clearMultiple (int num) throw() { memset (data, 128, num) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (UInt8& source) throw() { *data = *source.data; }
uint8* data;
enum { bytesPerSample = 1, maxValue = 0x7f, resolution = (1 << 24), isFloat = 0 };
};
class Int16
{
public:
inline Int16 (void* data_) throw() : data (static_cast <uint16*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int16) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int16) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint16) jlimit ((int16) -maxValue, (int16) maxValue, (int16) roundToInt (newValue * (1.0 + maxValue)))); }
inline void setAsFloatBE (float newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint16) jlimit ((int16) -maxValue, (int16) maxValue, (int16) roundToInt (newValue * (1.0 + maxValue)))); }
inline int32 getAsInt32LE() const throw() { return (int32) (ByteOrder::swapIfBigEndian ((uint16) *data) << 16); }
inline int32 getAsInt32BE() const throw() { return (int32) (ByteOrder::swapIfLittleEndian ((uint16) *data) << 16); }
inline void setAsInt32LE (int32 newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint16) (newValue >> 16)); }
inline void setAsInt32BE (int32 newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint16) (newValue >> 16)); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int16& source) throw() { *data = *source.data; }
uint16* data;
enum { bytesPerSample = 2, maxValue = 0x7fff, resolution = (1 << 16), isFloat = 0 };
};
class Int24
{
public:
inline Int24 (void* data_) throw() : data (static_cast <char*> (data_)) {}
inline void advance() throw() { data += 3; }
inline void skip (int numSamples) throw() { data += 3 * numSamples; }
inline float getAsFloatLE() const throw() { return (float) (ByteOrder::littleEndian24Bit (data) * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatBE() const throw() { return (float) (ByteOrder::bigEndian24Bit (data) * (1.0 / (1.0 + maxValue))); }
inline void setAsFloatLE (float newValue) throw() { ByteOrder::littleEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))), data); }
inline void setAsFloatBE (float newValue) throw() { ByteOrder::bigEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))), data); }
inline int32 getAsInt32LE() const throw() { return (int32) ByteOrder::littleEndian24Bit (data) << 8; }
inline int32 getAsInt32BE() const throw() { return (int32) ByteOrder::bigEndian24Bit (data) << 8; }
inline void setAsInt32LE (int32 newValue) throw() { ByteOrder::littleEndian24BitToChars (newValue >> 8, data); }
inline void setAsInt32BE (int32 newValue) throw() { ByteOrder::bigEndian24BitToChars (newValue >> 8, data); }
inline void clear() throw() { data[0] = 0; data[1] = 0; data[2] = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int24& source) throw() { data[0] = source.data[0]; data[1] = source.data[1]; data[2] = source.data[2]; }
char* data;
enum { bytesPerSample = 3, maxValue = 0x7fffff, resolution = (1 << 8), isFloat = 0 };
};
class Int32
{
public:
inline Int32 (void* data_) throw() : data (static_cast <uint32*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
inline void setAsFloatBE (float newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint32) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
inline int32 getAsInt32LE() const throw() { return (int32) ByteOrder::swapIfBigEndian (*data); }
inline int32 getAsInt32BE() const throw() { return (int32) ByteOrder::swapIfLittleEndian (*data); }
inline void setAsInt32LE (int32 newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) newValue); }
inline void setAsInt32BE (int32 newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint32) newValue); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int32& source) throw() { *data = *source.data; }
uint32* data;
enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = 1, isFloat = 0 };
};
class Float32
{
public:
inline Float32 (void* data_) throw() : data (static_cast <float*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
#if JUCE_BIG_ENDIAN
inline float getAsFloatBE() const throw() { return *data; }
inline void setAsFloatBE (float newValue) throw() { *data = newValue; }
inline float getAsFloatLE() const throw() { union { uint32 asInt; float asFloat; } n; n.asInt = ByteOrder::swap (*(uint32*) data); return n.asFloat; }
inline void setAsFloatLE (float newValue) throw() { union { uint32 asInt; float asFloat; } n; n.asFloat = newValue; *(uint32*) data = ByteOrder::swap (n.asInt); }
#else
inline float getAsFloatLE() const throw() { return *data; }
inline void setAsFloatLE (float newValue) throw() { *data = newValue; }
inline float getAsFloatBE() const throw() { union { uint32 asInt; float asFloat; } n; n.asInt = ByteOrder::swap (*(uint32*) data); return n.asFloat; }
inline void setAsFloatBE (float newValue) throw() { union { uint32 asInt; float asFloat; } n; n.asFloat = newValue; *(uint32*) data = ByteOrder::swap (n.asInt); }
#endif
inline int32 getAsInt32LE() const throw() { return (int32) roundToInt (jlimit (-1.0f, 1.0f, getAsFloatLE()) * (1.0 + maxValue)); }
inline int32 getAsInt32BE() const throw() { return (int32) roundToInt (jlimit (-1.0f, 1.0f, getAsFloatBE()) * (1.0 + maxValue)); }
inline void setAsInt32LE (int32 newValue) throw() { setAsFloatLE ((float) (newValue * (1.0 / (1.0 + maxValue)))); }
inline void setAsInt32BE (int32 newValue) throw() { setAsFloatBE ((float) (newValue * (1.0 / (1.0 + maxValue)))); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsFloatLE (source.getAsFloat()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsFloatBE (source.getAsFloat()); }
inline void copyFromSameType (Float32& source) throw() { *data = *source.data; }
float* data;
enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = (1 << 8), isFloat = 1 };
};
class NonInterleaved
{
public:
inline NonInterleaved() throw() {}
inline NonInterleaved (const NonInterleaved&) throw() {}
inline NonInterleaved (const int) throw() {}
inline void copyFrom (const NonInterleaved&) throw() {}
template <class SampleFormatType> inline void advanceData (SampleFormatType& s) throw() { s.advance(); }
template <class SampleFormatType> inline void advanceDataBy (SampleFormatType& s, int numSamples) throw() { s.skip (numSamples); }
template <class SampleFormatType> inline void clear (SampleFormatType& s, int numSamples) throw() { s.clearMultiple (numSamples); }
template <class SampleFormatType> inline static int getNumBytesBetweenSamples (const SampleFormatType&) throw() { return SampleFormatType::bytesPerSample; }
enum { isInterleavedType = 0, numInterleavedChannels = 1 };
};
class Interleaved
{
public:
inline Interleaved() throw() : numInterleavedChannels (1) {}
inline Interleaved (const Interleaved& other) throw() : numInterleavedChannels (other.numInterleavedChannels) {}
inline Interleaved (const int numInterleavedChannels_) throw() : numInterleavedChannels (numInterleavedChannels_) {}
inline void copyFrom (const Interleaved& other) throw() { numInterleavedChannels = other.numInterleavedChannels; }
template <class SampleFormatType> inline void advanceData (SampleFormatType& s) throw() { s.skip (numInterleavedChannels); }
template <class SampleFormatType> inline void advanceDataBy (SampleFormatType& s, int numSamples) throw() { s.skip (numInterleavedChannels * numSamples); }
template <class SampleFormatType> inline void clear (SampleFormatType& s, int numSamples) throw() { while (--numSamples >= 0) { s.clear(); s.skip (numInterleavedChannels); } }
template <class SampleFormatType> inline int getNumBytesBetweenSamples (const SampleFormatType&) const throw() { return numInterleavedChannels * SampleFormatType::bytesPerSample; }
int numInterleavedChannels;
enum { isInterleavedType = 1 };
};
class NonConst
{
public:
typedef void VoidType;
static inline void* toVoidPtr (VoidType* v) throw() { return v; }
enum { isConst = 0 };
};
class Const
{
public:
typedef const void VoidType;
static inline void* toVoidPtr (VoidType* v) throw() { return const_cast<void*> (v); }
enum { isConst = 1 };
};
#endif
/**
A pointer to a block of audio data with a particular encoding.
@ -30127,7 +30395,7 @@ public:
typename Endianness,
typename InterleavingType,
typename Constness>
class Pointer : private InterleavingType
class Pointer
{
public:
@ -30147,22 +30415,22 @@ public:
For non-interleaved data, use the other constructor.
*/
Pointer (typename Constness::VoidType* sourceData, int numInterleavedChannels) throw()
: InterleavingType (numInterleavedChannels),
data (Constness::toVoidPtr (sourceData))
: data (Constness::toVoidPtr (sourceData)),
interleaving (numInterleavedChannels)
{
}
/** Creates a copy of another pointer. */
Pointer (const Pointer& other) throw()
: InterleavingType (other),
data (other.data)
: data (other.data),
interleaving (other.interleaving)
{
}
Pointer& operator= (const Pointer& other) throw()
{
data = other.data;
InterleavingType::copyFrom (other);
interleaving.copyFrom (other.interleaving);
return *this;
}
@ -30206,10 +30474,10 @@ public:
inline Pointer& operator++() throw() { advance(); return *this; }
/** Moves the pointer back to the previous sample. */
inline Pointer& operator--() throw() { advanceDataBy (data, -1); return *this; }
inline Pointer& operator--() throw() { interleaving.advanceDataBy (data, -1); return *this; }
/** Adds a number of samples to the pointer's position. */
Pointer& operator+= (int samplesToJump) throw() { advanceDataBy (data, samplesToJump); return *this; }
Pointer& operator+= (int samplesToJump) throw() { interleaving.advanceDataBy (data, samplesToJump); return *this; }
/** Writes a stream of samples into this pointer from another pointer.
This will copy the specified number of samples, converting between formats appropriately.
@ -30260,7 +30528,7 @@ public:
void clearSamples (int numSamples) const throw()
{
Pointer dest (*this);
dest.clear (dest.data, numSamples);
dest.interleaving.clear (dest.data, numSamples);
}
/** Returns true if the pointer is using a floating-point format. */
@ -30276,7 +30544,7 @@ public:
int getNumInterleavedChannels() const throw() { return (int) this->numInterleavedChannels; }
/** Returns the number of bytes between the start address of each sample. */
int getNumBytesBetweenSamples() const throw() { return InterleavingType::getNumBytesBetweenSamples (data); }
int getNumBytesBetweenSamples() const throw() { return interleaving.getNumBytesBetweenSamples (data); }
/** Returns the accuracy of this format when represented as a 32-bit integer.
This is the smallest number above 0 that can be represented in the sample format, converted to
@ -30291,8 +30559,10 @@ public:
private:
SampleFormat data;
InterleavingType interleaving; // annoyingly, making the interleaving type a superclass to take
// advantage of EBCO causes an internal compiler error in VC6..
inline void advance() throw() { advanceData (data); }
inline void advance() throw() { interleaving.advanceData (data); }
Pointer operator++ (int); // private to force you to use the more efficient pre-increment!
Pointer operator-- (int);
@ -30365,241 +30635,6 @@ public:
};
};
#ifndef DOXYGEN
class AudioData::BigEndian
{
public:
template <class SampleFormatType> static inline float getAsFloat (SampleFormatType& s) throw() { return s.getAsFloatBE(); }
template <class SampleFormatType> static inline void setAsFloat (SampleFormatType& s, float newValue) throw() { s.setAsFloatBE (newValue); }
template <class SampleFormatType> static inline int32 getAsInt32 (SampleFormatType& s) throw() { return s.getAsInt32BE(); }
template <class SampleFormatType> static inline void setAsInt32 (SampleFormatType& s, int32 newValue) throw() { s.setAsInt32BE (newValue); }
template <class SourceType, class DestType> static inline void copyFrom (DestType& dest, SourceType& source) throw() { dest.copyFromBE (source); }
enum { isBigEndian = 1 };
};
class AudioData::LittleEndian
{
public:
template <class SampleFormatType> static inline float getAsFloat (SampleFormatType& s) throw() { return s.getAsFloatLE(); }
template <class SampleFormatType> static inline void setAsFloat (SampleFormatType& s, float newValue) throw() { s.setAsFloatLE (newValue); }
template <class SampleFormatType> static inline int32 getAsInt32 (SampleFormatType& s) throw() { return s.getAsInt32LE(); }
template <class SampleFormatType> static inline void setAsInt32 (SampleFormatType& s, int32 newValue) throw() { s.setAsInt32LE (newValue); }
template <class SourceType, class DestType> static inline void copyFrom (DestType& dest, SourceType& source) throw() { dest.copyFromLE (source); }
enum { isBigEndian = 0 };
};
#if JUCE_BIG_ENDIAN
class AudioData::NativeEndian : public AudioData::BigEndian {};
#else
class AudioData::NativeEndian : public AudioData::LittleEndian {};
#endif
class AudioData::Int8
{
public:
inline Int8 (void* data_) throw() : data (static_cast <int8*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) (*data * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatBE() const throw() { return getAsFloatLE(); }
inline void setAsFloatLE (float newValue) throw() { *data = (int8) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))); }
inline void setAsFloatBE (float newValue) throw() { setAsFloatLE (newValue); }
inline int32 getAsInt32LE() const throw() { return (int) (*data << 24); }
inline int32 getAsInt32BE() const throw() { return getAsInt32LE(); }
inline void setAsInt32LE (int newValue) throw() { *data = (int8) (newValue >> 24); }
inline void setAsInt32BE (int newValue) throw() { setAsInt32LE (newValue); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int8& source) throw() { *data = *source.data; }
int8* data;
enum { bytesPerSample = 1, maxValue = 0x7f, resolution = (1 << 24), isFloat = 0 };
};
class AudioData::UInt8
{
public:
inline UInt8 (void* data_) throw() : data (static_cast <uint8*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) ((*data - 128) * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatBE() const throw() { return getAsFloatLE(); }
inline void setAsFloatLE (float newValue) throw() { *data = (uint8) jlimit (0, 255, 128 + roundToInt (newValue * (1.0 + maxValue))); }
inline void setAsFloatBE (float newValue) throw() { setAsFloatLE (newValue); }
inline int32 getAsInt32LE() const throw() { return (int) ((*data - 128) << 24); }
inline int32 getAsInt32BE() const throw() { return getAsInt32LE(); }
inline void setAsInt32LE (int newValue) throw() { *data = (uint8) (128 + (newValue >> 24)); }
inline void setAsInt32BE (int newValue) throw() { setAsInt32LE (newValue); }
inline void clear() throw() { *data = 128; }
inline void clearMultiple (int num) throw() { memset (data, 128, num) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (UInt8& source) throw() { *data = *source.data; }
uint8* data;
enum { bytesPerSample = 1, maxValue = 0x7f, resolution = (1 << 24), isFloat = 0 };
};
class AudioData::Int16
{
public:
inline Int16 (void* data_) throw() : data (static_cast <uint16*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int16) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int16) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint16) jlimit ((int16) -maxValue, (int16) maxValue, (int16) roundToInt (newValue * (1.0 + maxValue)))); }
inline void setAsFloatBE (float newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint16) jlimit ((int16) -maxValue, (int16) maxValue, (int16) roundToInt (newValue * (1.0 + maxValue)))); }
inline int32 getAsInt32LE() const throw() { return (int32) (ByteOrder::swapIfBigEndian ((uint16) *data) << 16); }
inline int32 getAsInt32BE() const throw() { return (int32) (ByteOrder::swapIfLittleEndian ((uint16) *data) << 16); }
inline void setAsInt32LE (int32 newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint16) (newValue >> 16)); }
inline void setAsInt32BE (int32 newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint16) (newValue >> 16)); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int16& source) throw() { *data = *source.data; }
uint16* data;
enum { bytesPerSample = 2, maxValue = 0x7fff, resolution = (1 << 16), isFloat = 0 };
};
class AudioData::Int24
{
public:
inline Int24 (void* data_) throw() : data (static_cast <char*> (data_)) {}
inline void advance() throw() { data += 3; }
inline void skip (int numSamples) throw() { data += 3 * numSamples; }
inline float getAsFloatLE() const throw() { return (float) (ByteOrder::littleEndian24Bit (data) * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatBE() const throw() { return (float) (ByteOrder::bigEndian24Bit (data) * (1.0 / (1.0 + maxValue))); }
inline void setAsFloatLE (float newValue) throw() { ByteOrder::littleEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))), data); }
inline void setAsFloatBE (float newValue) throw() { ByteOrder::bigEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))), data); }
inline int32 getAsInt32LE() const throw() { return (int32) ByteOrder::littleEndian24Bit (data) << 8; }
inline int32 getAsInt32BE() const throw() { return (int32) ByteOrder::bigEndian24Bit (data) << 8; }
inline void setAsInt32LE (int32 newValue) throw() { ByteOrder::littleEndian24BitToChars (newValue >> 8, data); }
inline void setAsInt32BE (int32 newValue) throw() { ByteOrder::bigEndian24BitToChars (newValue >> 8, data); }
inline void clear() throw() { data[0] = 0; data[1] = 0; data[2] = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int24& source) throw() { data[0] = source.data[0]; data[1] = source.data[1]; data[2] = source.data[2]; }
char* data;
enum { bytesPerSample = 3, maxValue = 0x7fffff, resolution = (1 << 8), isFloat = 0 };
};
class AudioData::Int32
{
public:
inline Int32 (void* data_) throw() : data (static_cast <uint32*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
inline void setAsFloatBE (float newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint32) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
inline int32 getAsInt32LE() const throw() { return (int32) ByteOrder::swapIfBigEndian (*data); }
inline int32 getAsInt32BE() const throw() { return (int32) ByteOrder::swapIfLittleEndian (*data); }
inline void setAsInt32LE (int32 newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) newValue); }
inline void setAsInt32BE (int32 newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint32) newValue); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int32& source) throw() { *data = *source.data; }
uint32* data;
enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = 1, isFloat = 0 };
};
class AudioData::Float32
{
public:
inline Float32 (void* data_) throw() : data (static_cast <float*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
#if JUCE_BIG_ENDIAN
inline float getAsFloatBE() const throw() { return *data; }
inline void setAsFloatBE (float newValue) throw() { *data = newValue; }
inline float getAsFloatLE() const throw() { union { uint32 asInt; float asFloat; } n; n.asInt = ByteOrder::swap (*(uint32*) data); return n.asFloat; }
inline void setAsFloatLE (float newValue) throw() { union { uint32 asInt; float asFloat; } n; n.asFloat = newValue; *(uint32*) data = ByteOrder::swap (n.asInt); }
#else
inline float getAsFloatLE() const throw() { return *data; }
inline void setAsFloatLE (float newValue) throw() { *data = newValue; }
inline float getAsFloatBE() const throw() { union { uint32 asInt; float asFloat; } n; n.asInt = ByteOrder::swap (*(uint32*) data); return n.asFloat; }
inline void setAsFloatBE (float newValue) throw() { union { uint32 asInt; float asFloat; } n; n.asFloat = newValue; *(uint32*) data = ByteOrder::swap (n.asInt); }
#endif
inline int32 getAsInt32LE() const throw() { return (int32) roundToInt (jlimit (-1.0f, 1.0f, getAsFloatLE()) * (1.0 + maxValue)); }
inline int32 getAsInt32BE() const throw() { return (int32) roundToInt (jlimit (-1.0f, 1.0f, getAsFloatBE()) * (1.0 + maxValue)); }
inline void setAsInt32LE (int32 newValue) throw() { setAsFloatLE ((float) (newValue * (1.0 / (1.0 + maxValue)))); }
inline void setAsInt32BE (int32 newValue) throw() { setAsFloatBE ((float) (newValue * (1.0 / (1.0 + maxValue)))); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsFloatLE (source.getAsFloat()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsFloatBE (source.getAsFloat()); }
inline void copyFromSameType (Float32& source) throw() { *data = *source.data; }
float* data;
enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = (1 << 8), isFloat = 1 };
};
class AudioData::NonInterleaved
{
public:
inline NonInterleaved() throw() {}
inline NonInterleaved (const NonInterleaved&) throw() {}
inline NonInterleaved (const int) throw() {}
inline void copyFrom (const NonInterleaved&) throw() {}
template <class SampleFormatType> inline void advanceData (SampleFormatType& s) throw() { s.advance(); }
template <class SampleFormatType> inline void advanceDataBy (SampleFormatType& s, int numSamples) throw() { s.skip (numSamples); }
template <class SampleFormatType> inline void clear (SampleFormatType& s, int numSamples) throw() { s.clearMultiple (numSamples); }
template <class SampleFormatType> inline static int getNumBytesBetweenSamples (const SampleFormatType&) throw() { return SampleFormatType::bytesPerSample; }
enum { isInterleavedType = 0, numInterleavedChannels = 1 };
};
class AudioData::Interleaved
{
public:
inline Interleaved() throw() : numInterleavedChannels (1) {}
inline Interleaved (const Interleaved& other) throw() : numInterleavedChannels (other.numInterleavedChannels) {}
inline Interleaved (const int numInterleavedChannels_) throw() : numInterleavedChannels (numInterleavedChannels_) {}
inline void copyFrom (const Interleaved& other) throw() { numInterleavedChannels = other.numInterleavedChannels; }
template <class SampleFormatType> inline void advanceData (SampleFormatType& s) throw() { s.skip (numInterleavedChannels); }
template <class SampleFormatType> inline void advanceDataBy (SampleFormatType& s, int numSamples) throw() { s.skip (numInterleavedChannels * numSamples); }
template <class SampleFormatType> inline void clear (SampleFormatType& s, int numSamples) throw() { while (--numSamples >= 0) { s.clear(); s.skip (numInterleavedChannels); } }
template <class SampleFormatType> inline int getNumBytesBetweenSamples (const SampleFormatType&) const throw() { return numInterleavedChannels * SampleFormatType::bytesPerSample; }
int numInterleavedChannels;
enum { isInterleavedType = 1 };
};
class AudioData::NonConst
{
public:
typedef void VoidType;
static inline void* toVoidPtr (VoidType* v) throw() { return v; }
enum { isConst = 0 };
};
class AudioData::Const
{
public:
typedef const void VoidType;
static inline void* toVoidPtr (VoidType* v) throw() { return const_cast<void*> (v); }
enum { isConst = 1 };
};
#endif
/**
A set of routines to convert buffers of 32-bit floating point data to and from
various integer formats.
@ -31569,8 +31604,10 @@ public:
*/
bool write (const float** data, int numSamples);
/** @internal */
class Buffer; // (only public for VC6 compatibility)
private:
class Buffer;
friend class ScopedPointer<Buffer>;
ScopedPointer<Buffer> buffer;
};
@ -31621,6 +31658,7 @@ protected:
private:
String formatName;
friend class ThreadedWriter;
AudioFormatWriter (const AudioFormatWriter&);
AudioFormatWriter& operator= (const AudioFormatWriter&);
@ -32076,8 +32114,11 @@ public:
*/
void ejectDisk();
static const int framesPerSecond = 75;
static const int samplesPerFrame = 44100 / framesPerSecond;
enum
{
framesPerSecond = 75,
samplesPerFrame = 44100 / framesPerSecond
};
juce_UseDebuggingNewOperator
@ -35776,6 +35817,10 @@ private:
#endif // __JUCE_TOOLTIPWINDOW_JUCEHEADER__
/*** End of inlined file: juce_TooltipWindow.h ***/
#if JUCE_VC6
#define Listener ButtonListener
#endif
/**
A base class for buttons.
@ -35788,7 +35833,7 @@ private:
class JUCE_API Button : public Component,
public SettableTooltipClient,
public ApplicationCommandManagerListener,
public Value::Listener,
public ValueListener,
private KeyListener
{
protected:
@ -35911,7 +35956,7 @@ public:
@see Button::addButtonListener, Button::removeButtonListener
*/
class JUCE_API Listener
class Listener
{
public:
/** Destructor. */
@ -36230,6 +36275,10 @@ private:
/** This typedef is just for compatibility with old code - newer code should use Button::Listener instead. */
typedef Button::Listener ButtonListener;
#if JUCE_VC6
#undef Listener
#endif
#endif // __JUCE_BUTTON_JUCEHEADER__
/*** End of inlined file: juce_Button.h ***/
@ -37833,15 +37882,19 @@ typedef TextEditor::Listener TextEditorListener;
#endif // __JUCE_TEXTEDITOR_JUCEHEADER__
/*** End of inlined file: juce_TextEditor.h ***/
#if JUCE_VC6
#define Listener ButtonListener
#endif
/**
A component that displays a text string, and can optionally become a text
editor when clicked.
*/
class JUCE_API Label : public Component,
public SettableTooltipClient,
protected TextEditor::Listener,
protected TextEditorListener,
private ComponentListener,
private Value::Listener
private ValueListener
{
public:
@ -38130,9 +38183,17 @@ private:
/** This typedef is just for compatibility with old code - newer code should use the Label::Listener class directly. */
typedef Label::Listener LabelListener;
#if JUCE_VC6
#undef Listener
#endif
#endif // __JUCE_LABEL_JUCEHEADER__
/*** End of inlined file: juce_Label.h ***/
#if JUCE_VC6
#define Listener SliderListener
#endif
/**
A component that lets the user choose from a drop-down list of choices.
@ -38150,7 +38211,7 @@ typedef Label::Listener LabelListener;
class JUCE_API ComboBox : public Component,
public SettableTooltipClient,
public LabelListener, // (can't use Label::Listener due to idiotic VC2005 bug)
public Value::Listener,
public ValueListener,
private AsyncUpdater
{
public:
@ -38491,6 +38552,10 @@ private:
/** This typedef is just for compatibility with old code - newer code should use the ComboBox::Listener class directly. */
typedef ComboBox::Listener ComboBoxListener;
#if JUCE_VC6
#undef Listener
#endif
#endif // __JUCE_COMBOBOX_JUCEHEADER__
/*** End of inlined file: juce_ComboBox.h ***/
@ -47168,6 +47233,10 @@ private:
#ifndef __JUCE_SLIDER_JUCEHEADER__
#define __JUCE_SLIDER_JUCEHEADER__
#if JUCE_VC6
#define Listener LabelListener
#endif
/**
A slider control for changing a value.
@ -47193,7 +47262,7 @@ class JUCE_API Slider : public Component,
public AsyncUpdater,
public ButtonListener, // (can't use Button::Listener due to idiotic VC2005 bug)
public LabelListener,
public Value::Listener
public ValueListener
{
public:
@ -47952,6 +48021,10 @@ private:
/** This typedef is just for compatibility with old code - newer code should use the Slider::Listener class directly. */
typedef Slider::Listener SliderListener;
#if JUCE_VC6
#undef Listener
#endif
#endif // __JUCE_SLIDER_JUCEHEADER__
/*** End of inlined file: juce_Slider.h ***/
@ -60576,7 +60649,7 @@ public:
const Expression getSymbolValue (const String& symbol, const String& member) const;
/** Internally-used class for wrapping a DrawableComposite's state into a ValueTree. */
class ValueTreeWrapper : public ValueTreeWrapperBase
class ValueTreeWrapper : public Drawable::ValueTreeWrapperBase
{
public:
ValueTreeWrapper (const ValueTree& state);
@ -60709,7 +60782,7 @@ public:
const Identifier getValueTreeType() const { return valueTreeType; }
/** Internally-used class for wrapping a DrawableImage's state into a ValueTree. */
class ValueTreeWrapper : public ValueTreeWrapperBase
class ValueTreeWrapper : public Drawable::ValueTreeWrapperBase
{
public:
ValueTreeWrapper (const ValueTree& state);
@ -60817,7 +60890,7 @@ public:
const PathStrokeType& getStrokeType() const throw() { return strokeType; }
/** @internal */
class FillAndStrokeState : public ValueTreeWrapperBase
class FillAndStrokeState : public Drawable::ValueTreeWrapperBase
{
public:
FillAndStrokeState (const ValueTree& state);
@ -60944,7 +61017,7 @@ public:
const Identifier getValueTreeType() const { return valueTreeType; }
/** Internally-used class for wrapping a DrawablePath's state into a ValueTree. */
class ValueTreeWrapper : public FillAndStrokeState
class ValueTreeWrapper : public DrawableShape::FillAndStrokeState
{
public:
ValueTreeWrapper (const ValueTree& state);
@ -61058,7 +61131,7 @@ public:
const Identifier getValueTreeType() const { return valueTreeType; }
/** Internally-used class for wrapping a DrawableRectangle's state into a ValueTree. */
class ValueTreeWrapper : public FillAndStrokeState
class ValueTreeWrapper : public DrawableShape::FillAndStrokeState
{
public:
ValueTreeWrapper (const ValueTree& state);
@ -61174,7 +61247,7 @@ public:
const Identifier getValueTreeType() const { return valueTreeType; }
/** Internally-used class for wrapping a DrawableText's state into a ValueTree. */
class ValueTreeWrapper : public ValueTreeWrapperBase
class ValueTreeWrapper : public Drawable::ValueTreeWrapperBase
{
public:
ValueTreeWrapper (const ValueTree& state);
@ -61948,6 +62021,7 @@ public:
private:
class Pimpl;
friend class Pimpl;
ImageCache();
ImageCache (const ImageCache&);

View file

@ -153,8 +153,11 @@ public:
void ejectDisk();
//==============================================================================
static const int framesPerSecond = 75;
static const int samplesPerFrame = 44100 / framesPerSecond;
enum
{
framesPerSecond = 75,
samplesPerFrame = 44100 / framesPerSecond
};
//==============================================================================
juce_UseDebuggingNewOperator

View file

@ -184,8 +184,10 @@ public:
*/
bool write (const float** data, int numSamples);
/** @internal */
class Buffer; // (only public for VC6 compatibility)
private:
class Buffer;
friend class ScopedPointer<Buffer>;
ScopedPointer<Buffer> buffer;
};
@ -237,6 +239,7 @@ protected:
private:
String formatName;
friend class ThreadedWriter;
AudioFormatWriter (const AudioFormatWriter&);
AudioFormatWriter& operator= (const AudioFormatWriter&);

View file

@ -205,7 +205,7 @@ void ResamplingAudioSource::createLowPass (const double frequencyRatio)
const double proportionalRate = (frequencyRatio > 1.0) ? 0.5 / frequencyRatio
: 0.5 * frequencyRatio;
const double n = 1.0 / tan (double_Pi * jmax (0.001, proportionalRate));
const double n = 1.0 / std::tan (double_Pi * jmax (0.001, proportionalRate));
const double nSquared = n * n;
const double c1 = 1.0 / (1.0 + std::sqrt (2.0) * n + nSquared);

View file

@ -66,6 +66,243 @@ public:
class NonConst; /**< Used as a template parameter for AudioData::Pointer. Indicates that the pointer can be used for non-const data. */
class Const; /**< Used as a template parameter for AudioData::Pointer. Indicates that the samples can only be used for const data.. */
#ifndef DOXYGEN
//==============================================================================
class BigEndian
{
public:
template <class SampleFormatType> static inline float getAsFloat (SampleFormatType& s) throw() { return s.getAsFloatBE(); }
template <class SampleFormatType> static inline void setAsFloat (SampleFormatType& s, float newValue) throw() { s.setAsFloatBE (newValue); }
template <class SampleFormatType> static inline int32 getAsInt32 (SampleFormatType& s) throw() { return s.getAsInt32BE(); }
template <class SampleFormatType> static inline void setAsInt32 (SampleFormatType& s, int32 newValue) throw() { s.setAsInt32BE (newValue); }
template <class SourceType, class DestType> static inline void copyFrom (DestType& dest, SourceType& source) throw() { dest.copyFromBE (source); }
enum { isBigEndian = 1 };
};
class LittleEndian
{
public:
template <class SampleFormatType> static inline float getAsFloat (SampleFormatType& s) throw() { return s.getAsFloatLE(); }
template <class SampleFormatType> static inline void setAsFloat (SampleFormatType& s, float newValue) throw() { s.setAsFloatLE (newValue); }
template <class SampleFormatType> static inline int32 getAsInt32 (SampleFormatType& s) throw() { return s.getAsInt32LE(); }
template <class SampleFormatType> static inline void setAsInt32 (SampleFormatType& s, int32 newValue) throw() { s.setAsInt32LE (newValue); }
template <class SourceType, class DestType> static inline void copyFrom (DestType& dest, SourceType& source) throw() { dest.copyFromLE (source); }
enum { isBigEndian = 0 };
};
#if JUCE_BIG_ENDIAN
class NativeEndian : public BigEndian {};
#else
class NativeEndian : public LittleEndian {};
#endif
//==============================================================================
class Int8
{
public:
inline Int8 (void* data_) throw() : data (static_cast <int8*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) (*data * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatBE() const throw() { return getAsFloatLE(); }
inline void setAsFloatLE (float newValue) throw() { *data = (int8) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))); }
inline void setAsFloatBE (float newValue) throw() { setAsFloatLE (newValue); }
inline int32 getAsInt32LE() const throw() { return (int) (*data << 24); }
inline int32 getAsInt32BE() const throw() { return getAsInt32LE(); }
inline void setAsInt32LE (int newValue) throw() { *data = (int8) (newValue >> 24); }
inline void setAsInt32BE (int newValue) throw() { setAsInt32LE (newValue); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int8& source) throw() { *data = *source.data; }
int8* data;
enum { bytesPerSample = 1, maxValue = 0x7f, resolution = (1 << 24), isFloat = 0 };
};
class UInt8
{
public:
inline UInt8 (void* data_) throw() : data (static_cast <uint8*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) ((*data - 128) * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatBE() const throw() { return getAsFloatLE(); }
inline void setAsFloatLE (float newValue) throw() { *data = (uint8) jlimit (0, 255, 128 + roundToInt (newValue * (1.0 + maxValue))); }
inline void setAsFloatBE (float newValue) throw() { setAsFloatLE (newValue); }
inline int32 getAsInt32LE() const throw() { return (int) ((*data - 128) << 24); }
inline int32 getAsInt32BE() const throw() { return getAsInt32LE(); }
inline void setAsInt32LE (int newValue) throw() { *data = (uint8) (128 + (newValue >> 24)); }
inline void setAsInt32BE (int newValue) throw() { setAsInt32LE (newValue); }
inline void clear() throw() { *data = 128; }
inline void clearMultiple (int num) throw() { memset (data, 128, num) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (UInt8& source) throw() { *data = *source.data; }
uint8* data;
enum { bytesPerSample = 1, maxValue = 0x7f, resolution = (1 << 24), isFloat = 0 };
};
class Int16
{
public:
inline Int16 (void* data_) throw() : data (static_cast <uint16*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int16) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int16) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint16) jlimit ((int16) -maxValue, (int16) maxValue, (int16) roundToInt (newValue * (1.0 + maxValue)))); }
inline void setAsFloatBE (float newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint16) jlimit ((int16) -maxValue, (int16) maxValue, (int16) roundToInt (newValue * (1.0 + maxValue)))); }
inline int32 getAsInt32LE() const throw() { return (int32) (ByteOrder::swapIfBigEndian ((uint16) *data) << 16); }
inline int32 getAsInt32BE() const throw() { return (int32) (ByteOrder::swapIfLittleEndian ((uint16) *data) << 16); }
inline void setAsInt32LE (int32 newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint16) (newValue >> 16)); }
inline void setAsInt32BE (int32 newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint16) (newValue >> 16)); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int16& source) throw() { *data = *source.data; }
uint16* data;
enum { bytesPerSample = 2, maxValue = 0x7fff, resolution = (1 << 16), isFloat = 0 };
};
class Int24
{
public:
inline Int24 (void* data_) throw() : data (static_cast <char*> (data_)) {}
inline void advance() throw() { data += 3; }
inline void skip (int numSamples) throw() { data += 3 * numSamples; }
inline float getAsFloatLE() const throw() { return (float) (ByteOrder::littleEndian24Bit (data) * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatBE() const throw() { return (float) (ByteOrder::bigEndian24Bit (data) * (1.0 / (1.0 + maxValue))); }
inline void setAsFloatLE (float newValue) throw() { ByteOrder::littleEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))), data); }
inline void setAsFloatBE (float newValue) throw() { ByteOrder::bigEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))), data); }
inline int32 getAsInt32LE() const throw() { return (int32) ByteOrder::littleEndian24Bit (data) << 8; }
inline int32 getAsInt32BE() const throw() { return (int32) ByteOrder::bigEndian24Bit (data) << 8; }
inline void setAsInt32LE (int32 newValue) throw() { ByteOrder::littleEndian24BitToChars (newValue >> 8, data); }
inline void setAsInt32BE (int32 newValue) throw() { ByteOrder::bigEndian24BitToChars (newValue >> 8, data); }
inline void clear() throw() { data[0] = 0; data[1] = 0; data[2] = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int24& source) throw() { data[0] = source.data[0]; data[1] = source.data[1]; data[2] = source.data[2]; }
char* data;
enum { bytesPerSample = 3, maxValue = 0x7fffff, resolution = (1 << 8), isFloat = 0 };
};
class Int32
{
public:
inline Int32 (void* data_) throw() : data (static_cast <uint32*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
inline void setAsFloatBE (float newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint32) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
inline int32 getAsInt32LE() const throw() { return (int32) ByteOrder::swapIfBigEndian (*data); }
inline int32 getAsInt32BE() const throw() { return (int32) ByteOrder::swapIfLittleEndian (*data); }
inline void setAsInt32LE (int32 newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) newValue); }
inline void setAsInt32BE (int32 newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint32) newValue); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int32& source) throw() { *data = *source.data; }
uint32* data;
enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = 1, isFloat = 0 };
};
class Float32
{
public:
inline Float32 (void* data_) throw() : data (static_cast <float*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
#if JUCE_BIG_ENDIAN
inline float getAsFloatBE() const throw() { return *data; }
inline void setAsFloatBE (float newValue) throw() { *data = newValue; }
inline float getAsFloatLE() const throw() { union { uint32 asInt; float asFloat; } n; n.asInt = ByteOrder::swap (*(uint32*) data); return n.asFloat; }
inline void setAsFloatLE (float newValue) throw() { union { uint32 asInt; float asFloat; } n; n.asFloat = newValue; *(uint32*) data = ByteOrder::swap (n.asInt); }
#else
inline float getAsFloatLE() const throw() { return *data; }
inline void setAsFloatLE (float newValue) throw() { *data = newValue; }
inline float getAsFloatBE() const throw() { union { uint32 asInt; float asFloat; } n; n.asInt = ByteOrder::swap (*(uint32*) data); return n.asFloat; }
inline void setAsFloatBE (float newValue) throw() { union { uint32 asInt; float asFloat; } n; n.asFloat = newValue; *(uint32*) data = ByteOrder::swap (n.asInt); }
#endif
inline int32 getAsInt32LE() const throw() { return (int32) roundToInt (jlimit (-1.0f, 1.0f, getAsFloatLE()) * (1.0 + maxValue)); }
inline int32 getAsInt32BE() const throw() { return (int32) roundToInt (jlimit (-1.0f, 1.0f, getAsFloatBE()) * (1.0 + maxValue)); }
inline void setAsInt32LE (int32 newValue) throw() { setAsFloatLE ((float) (newValue * (1.0 / (1.0 + maxValue)))); }
inline void setAsInt32BE (int32 newValue) throw() { setAsFloatBE ((float) (newValue * (1.0 / (1.0 + maxValue)))); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsFloatLE (source.getAsFloat()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsFloatBE (source.getAsFloat()); }
inline void copyFromSameType (Float32& source) throw() { *data = *source.data; }
float* data;
enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = (1 << 8), isFloat = 1 };
};
//==============================================================================
class NonInterleaved
{
public:
inline NonInterleaved() throw() {}
inline NonInterleaved (const NonInterleaved&) throw() {}
inline NonInterleaved (const int) throw() {}
inline void copyFrom (const NonInterleaved&) throw() {}
template <class SampleFormatType> inline void advanceData (SampleFormatType& s) throw() { s.advance(); }
template <class SampleFormatType> inline void advanceDataBy (SampleFormatType& s, int numSamples) throw() { s.skip (numSamples); }
template <class SampleFormatType> inline void clear (SampleFormatType& s, int numSamples) throw() { s.clearMultiple (numSamples); }
template <class SampleFormatType> inline static int getNumBytesBetweenSamples (const SampleFormatType&) throw() { return SampleFormatType::bytesPerSample; }
enum { isInterleavedType = 0, numInterleavedChannels = 1 };
};
class Interleaved
{
public:
inline Interleaved() throw() : numInterleavedChannels (1) {}
inline Interleaved (const Interleaved& other) throw() : numInterleavedChannels (other.numInterleavedChannels) {}
inline Interleaved (const int numInterleavedChannels_) throw() : numInterleavedChannels (numInterleavedChannels_) {}
inline void copyFrom (const Interleaved& other) throw() { numInterleavedChannels = other.numInterleavedChannels; }
template <class SampleFormatType> inline void advanceData (SampleFormatType& s) throw() { s.skip (numInterleavedChannels); }
template <class SampleFormatType> inline void advanceDataBy (SampleFormatType& s, int numSamples) throw() { s.skip (numInterleavedChannels * numSamples); }
template <class SampleFormatType> inline void clear (SampleFormatType& s, int numSamples) throw() { while (--numSamples >= 0) { s.clear(); s.skip (numInterleavedChannels); } }
template <class SampleFormatType> inline int getNumBytesBetweenSamples (const SampleFormatType&) const throw() { return numInterleavedChannels * SampleFormatType::bytesPerSample; }
int numInterleavedChannels;
enum { isInterleavedType = 1 };
};
//==============================================================================
class NonConst
{
public:
typedef void VoidType;
static inline void* toVoidPtr (VoidType* v) throw() { return v; }
enum { isConst = 0 };
};
class Const
{
public:
typedef const void VoidType;
static inline void* toVoidPtr (VoidType* v) throw() { return const_cast<void*> (v); }
enum { isConst = 1 };
};
#endif
//==============================================================================
/**
A pointer to a block of audio data with a particular encoding.
@ -95,7 +332,7 @@ public:
typename Endianness,
typename InterleavingType,
typename Constness>
class Pointer : private InterleavingType
class Pointer
{
public:
//==============================================================================
@ -115,22 +352,22 @@ public:
For non-interleaved data, use the other constructor.
*/
Pointer (typename Constness::VoidType* sourceData, int numInterleavedChannels) throw()
: InterleavingType (numInterleavedChannels),
data (Constness::toVoidPtr (sourceData))
: data (Constness::toVoidPtr (sourceData)),
interleaving (numInterleavedChannels)
{
}
/** Creates a copy of another pointer. */
Pointer (const Pointer& other) throw()
: InterleavingType (other),
data (other.data)
: data (other.data),
interleaving (other.interleaving)
{
}
Pointer& operator= (const Pointer& other) throw()
{
data = other.data;
InterleavingType::copyFrom (other);
interleaving.copyFrom (other.interleaving);
return *this;
}
@ -175,10 +412,10 @@ public:
inline Pointer& operator++() throw() { advance(); return *this; }
/** Moves the pointer back to the previous sample. */
inline Pointer& operator--() throw() { advanceDataBy (data, -1); return *this; }
inline Pointer& operator--() throw() { interleaving.advanceDataBy (data, -1); return *this; }
/** Adds a number of samples to the pointer's position. */
Pointer& operator+= (int samplesToJump) throw() { advanceDataBy (data, samplesToJump); return *this; }
Pointer& operator+= (int samplesToJump) throw() { interleaving.advanceDataBy (data, samplesToJump); return *this; }
/** Writes a stream of samples into this pointer from another pointer.
This will copy the specified number of samples, converting between formats appropriately.
@ -229,7 +466,7 @@ public:
void clearSamples (int numSamples) const throw()
{
Pointer dest (*this);
dest.clear (dest.data, numSamples);
dest.interleaving.clear (dest.data, numSamples);
}
/** Returns true if the pointer is using a floating-point format. */
@ -245,7 +482,7 @@ public:
int getNumInterleavedChannels() const throw() { return (int) this->numInterleavedChannels; }
/** Returns the number of bytes between the start address of each sample. */
int getNumBytesBetweenSamples() const throw() { return InterleavingType::getNumBytesBetweenSamples (data); }
int getNumBytesBetweenSamples() const throw() { return interleaving.getNumBytesBetweenSamples (data); }
/** Returns the accuracy of this format when represented as a 32-bit integer.
This is the smallest number above 0 that can be represented in the sample format, converted to
@ -260,8 +497,10 @@ public:
private:
//==============================================================================
SampleFormat data;
InterleavingType interleaving; // annoyingly, making the interleaving type a superclass to take
// advantage of EBCO causes an internal compiler error in VC6..
inline void advance() throw() { advanceData (data); }
inline void advance() throw() { interleaving.advanceData (data); }
Pointer operator++ (int); // private to force you to use the more efficient pre-increment!
Pointer operator-- (int);
@ -337,244 +576,6 @@ public:
};
#ifndef DOXYGEN
//==============================================================================
class AudioData::BigEndian
{
public:
template <class SampleFormatType> static inline float getAsFloat (SampleFormatType& s) throw() { return s.getAsFloatBE(); }
template <class SampleFormatType> static inline void setAsFloat (SampleFormatType& s, float newValue) throw() { s.setAsFloatBE (newValue); }
template <class SampleFormatType> static inline int32 getAsInt32 (SampleFormatType& s) throw() { return s.getAsInt32BE(); }
template <class SampleFormatType> static inline void setAsInt32 (SampleFormatType& s, int32 newValue) throw() { s.setAsInt32BE (newValue); }
template <class SourceType, class DestType> static inline void copyFrom (DestType& dest, SourceType& source) throw() { dest.copyFromBE (source); }
enum { isBigEndian = 1 };
};
class AudioData::LittleEndian
{
public:
template <class SampleFormatType> static inline float getAsFloat (SampleFormatType& s) throw() { return s.getAsFloatLE(); }
template <class SampleFormatType> static inline void setAsFloat (SampleFormatType& s, float newValue) throw() { s.setAsFloatLE (newValue); }
template <class SampleFormatType> static inline int32 getAsInt32 (SampleFormatType& s) throw() { return s.getAsInt32LE(); }
template <class SampleFormatType> static inline void setAsInt32 (SampleFormatType& s, int32 newValue) throw() { s.setAsInt32LE (newValue); }
template <class SourceType, class DestType> static inline void copyFrom (DestType& dest, SourceType& source) throw() { dest.copyFromLE (source); }
enum { isBigEndian = 0 };
};
#if JUCE_BIG_ENDIAN
class AudioData::NativeEndian : public AudioData::BigEndian {};
#else
class AudioData::NativeEndian : public AudioData::LittleEndian {};
#endif
//==============================================================================
class AudioData::Int8
{
public:
inline Int8 (void* data_) throw() : data (static_cast <int8*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) (*data * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatBE() const throw() { return getAsFloatLE(); }
inline void setAsFloatLE (float newValue) throw() { *data = (int8) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))); }
inline void setAsFloatBE (float newValue) throw() { setAsFloatLE (newValue); }
inline int32 getAsInt32LE() const throw() { return (int) (*data << 24); }
inline int32 getAsInt32BE() const throw() { return getAsInt32LE(); }
inline void setAsInt32LE (int newValue) throw() { *data = (int8) (newValue >> 24); }
inline void setAsInt32BE (int newValue) throw() { setAsInt32LE (newValue); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int8& source) throw() { *data = *source.data; }
int8* data;
enum { bytesPerSample = 1, maxValue = 0x7f, resolution = (1 << 24), isFloat = 0 };
};
class AudioData::UInt8
{
public:
inline UInt8 (void* data_) throw() : data (static_cast <uint8*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) ((*data - 128) * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatBE() const throw() { return getAsFloatLE(); }
inline void setAsFloatLE (float newValue) throw() { *data = (uint8) jlimit (0, 255, 128 + roundToInt (newValue * (1.0 + maxValue))); }
inline void setAsFloatBE (float newValue) throw() { setAsFloatLE (newValue); }
inline int32 getAsInt32LE() const throw() { return (int) ((*data - 128) << 24); }
inline int32 getAsInt32BE() const throw() { return getAsInt32LE(); }
inline void setAsInt32LE (int newValue) throw() { *data = (uint8) (128 + (newValue >> 24)); }
inline void setAsInt32BE (int newValue) throw() { setAsInt32LE (newValue); }
inline void clear() throw() { *data = 128; }
inline void clearMultiple (int num) throw() { memset (data, 128, num) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (UInt8& source) throw() { *data = *source.data; }
uint8* data;
enum { bytesPerSample = 1, maxValue = 0x7f, resolution = (1 << 24), isFloat = 0 };
};
class AudioData::Int16
{
public:
inline Int16 (void* data_) throw() : data (static_cast <uint16*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int16) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int16) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint16) jlimit ((int16) -maxValue, (int16) maxValue, (int16) roundToInt (newValue * (1.0 + maxValue)))); }
inline void setAsFloatBE (float newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint16) jlimit ((int16) -maxValue, (int16) maxValue, (int16) roundToInt (newValue * (1.0 + maxValue)))); }
inline int32 getAsInt32LE() const throw() { return (int32) (ByteOrder::swapIfBigEndian ((uint16) *data) << 16); }
inline int32 getAsInt32BE() const throw() { return (int32) (ByteOrder::swapIfLittleEndian ((uint16) *data) << 16); }
inline void setAsInt32LE (int32 newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint16) (newValue >> 16)); }
inline void setAsInt32BE (int32 newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint16) (newValue >> 16)); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int16& source) throw() { *data = *source.data; }
uint16* data;
enum { bytesPerSample = 2, maxValue = 0x7fff, resolution = (1 << 16), isFloat = 0 };
};
class AudioData::Int24
{
public:
inline Int24 (void* data_) throw() : data (static_cast <char*> (data_)) {}
inline void advance() throw() { data += 3; }
inline void skip (int numSamples) throw() { data += 3 * numSamples; }
inline float getAsFloatLE() const throw() { return (float) (ByteOrder::littleEndian24Bit (data) * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatBE() const throw() { return (float) (ByteOrder::bigEndian24Bit (data) * (1.0 / (1.0 + maxValue))); }
inline void setAsFloatLE (float newValue) throw() { ByteOrder::littleEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))), data); }
inline void setAsFloatBE (float newValue) throw() { ByteOrder::bigEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))), data); }
inline int32 getAsInt32LE() const throw() { return (int32) ByteOrder::littleEndian24Bit (data) << 8; }
inline int32 getAsInt32BE() const throw() { return (int32) ByteOrder::bigEndian24Bit (data) << 8; }
inline void setAsInt32LE (int32 newValue) throw() { ByteOrder::littleEndian24BitToChars (newValue >> 8, data); }
inline void setAsInt32BE (int32 newValue) throw() { ByteOrder::bigEndian24BitToChars (newValue >> 8, data); }
inline void clear() throw() { data[0] = 0; data[1] = 0; data[2] = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int24& source) throw() { data[0] = source.data[0]; data[1] = source.data[1]; data[2] = source.data[2]; }
char* data;
enum { bytesPerSample = 3, maxValue = 0x7fffff, resolution = (1 << 8), isFloat = 0 };
};
class AudioData::Int32
{
public:
inline Int32 (void* data_) throw() : data (static_cast <uint32*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
inline float getAsFloatLE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const throw() { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
inline void setAsFloatBE (float newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint32) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
inline int32 getAsInt32LE() const throw() { return (int32) ByteOrder::swapIfBigEndian (*data); }
inline int32 getAsInt32BE() const throw() { return (int32) ByteOrder::swapIfLittleEndian (*data); }
inline void setAsInt32LE (int32 newValue) throw() { *data = ByteOrder::swapIfBigEndian ((uint32) newValue); }
inline void setAsInt32BE (int32 newValue) throw() { *data = ByteOrder::swapIfLittleEndian ((uint32) newValue); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsInt32LE (source.getAsInt32()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsInt32BE (source.getAsInt32()); }
inline void copyFromSameType (Int32& source) throw() { *data = *source.data; }
uint32* data;
enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = 1, isFloat = 0 };
};
class AudioData::Float32
{
public:
inline Float32 (void* data_) throw() : data (static_cast <float*> (data_)) {}
inline void advance() throw() { ++data; }
inline void skip (int numSamples) throw() { data += numSamples; }
#if JUCE_BIG_ENDIAN
inline float getAsFloatBE() const throw() { return *data; }
inline void setAsFloatBE (float newValue) throw() { *data = newValue; }
inline float getAsFloatLE() const throw() { union { uint32 asInt; float asFloat; } n; n.asInt = ByteOrder::swap (*(uint32*) data); return n.asFloat; }
inline void setAsFloatLE (float newValue) throw() { union { uint32 asInt; float asFloat; } n; n.asFloat = newValue; *(uint32*) data = ByteOrder::swap (n.asInt); }
#else
inline float getAsFloatLE() const throw() { return *data; }
inline void setAsFloatLE (float newValue) throw() { *data = newValue; }
inline float getAsFloatBE() const throw() { union { uint32 asInt; float asFloat; } n; n.asInt = ByteOrder::swap (*(uint32*) data); return n.asFloat; }
inline void setAsFloatBE (float newValue) throw() { union { uint32 asInt; float asFloat; } n; n.asFloat = newValue; *(uint32*) data = ByteOrder::swap (n.asInt); }
#endif
inline int32 getAsInt32LE() const throw() { return (int32) roundToInt (jlimit (-1.0f, 1.0f, getAsFloatLE()) * (1.0 + maxValue)); }
inline int32 getAsInt32BE() const throw() { return (int32) roundToInt (jlimit (-1.0f, 1.0f, getAsFloatBE()) * (1.0 + maxValue)); }
inline void setAsInt32LE (int32 newValue) throw() { setAsFloatLE ((float) (newValue * (1.0 / (1.0 + maxValue)))); }
inline void setAsInt32BE (int32 newValue) throw() { setAsFloatBE ((float) (newValue * (1.0 / (1.0 + maxValue)))); }
inline void clear() throw() { *data = 0; }
inline void clearMultiple (int num) throw() { zeromem (data, num * bytesPerSample) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) throw() { setAsFloatLE (source.getAsFloat()); }
template <class SourceType> inline void copyFromBE (SourceType& source) throw() { setAsFloatBE (source.getAsFloat()); }
inline void copyFromSameType (Float32& source) throw() { *data = *source.data; }
float* data;
enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = (1 << 8), isFloat = 1 };
};
//==============================================================================
class AudioData::NonInterleaved
{
public:
inline NonInterleaved() throw() {}
inline NonInterleaved (const NonInterleaved&) throw() {}
inline NonInterleaved (const int) throw() {}
inline void copyFrom (const NonInterleaved&) throw() {}
template <class SampleFormatType> inline void advanceData (SampleFormatType& s) throw() { s.advance(); }
template <class SampleFormatType> inline void advanceDataBy (SampleFormatType& s, int numSamples) throw() { s.skip (numSamples); }
template <class SampleFormatType> inline void clear (SampleFormatType& s, int numSamples) throw() { s.clearMultiple (numSamples); }
template <class SampleFormatType> inline static int getNumBytesBetweenSamples (const SampleFormatType&) throw() { return SampleFormatType::bytesPerSample; }
enum { isInterleavedType = 0, numInterleavedChannels = 1 };
};
class AudioData::Interleaved
{
public:
inline Interleaved() throw() : numInterleavedChannels (1) {}
inline Interleaved (const Interleaved& other) throw() : numInterleavedChannels (other.numInterleavedChannels) {}
inline Interleaved (const int numInterleavedChannels_) throw() : numInterleavedChannels (numInterleavedChannels_) {}
inline void copyFrom (const Interleaved& other) throw() { numInterleavedChannels = other.numInterleavedChannels; }
template <class SampleFormatType> inline void advanceData (SampleFormatType& s) throw() { s.skip (numInterleavedChannels); }
template <class SampleFormatType> inline void advanceDataBy (SampleFormatType& s, int numSamples) throw() { s.skip (numInterleavedChannels * numSamples); }
template <class SampleFormatType> inline void clear (SampleFormatType& s, int numSamples) throw() { while (--numSamples >= 0) { s.clear(); s.skip (numInterleavedChannels); } }
template <class SampleFormatType> inline int getNumBytesBetweenSamples (const SampleFormatType&) const throw() { return numInterleavedChannels * SampleFormatType::bytesPerSample; }
int numInterleavedChannels;
enum { isInterleavedType = 1 };
};
//==============================================================================
class AudioData::NonConst
{
public:
typedef void VoidType;
static inline void* toVoidPtr (VoidType* v) throw() { return v; }
enum { isConst = 0 };
};
class AudioData::Const
{
public:
typedef const void VoidType;
static inline void* toVoidPtr (VoidType* v) throw() { return const_cast<void*> (v); }
enum { isConst = 1 };
};
#endif
//==============================================================================
/**

View file

@ -60,7 +60,7 @@ template <typename ElementType,
class Array
{
private:
#if defined (_MSC_VER) && _MSC_VER <= 1400
#if JUCE_VC8_OR_EARLIER
typedef const ElementType& ParameterType;
#else
typedef PARAMETER_TYPE (ElementType) ParameterType;

View file

@ -37,6 +37,11 @@ class Expression::Helpers
public:
typedef ReferenceCountedObjectPtr<Term> TermPtr;
// This helper function is needed to work around VC6 scoping bugs
static const TermPtr& getTermFor (const Expression& exp) throw() { return exp.term; }
friend class Expression::Term; // (also only needed as a VC6 workaround)
//==============================================================================
class Constant : public Term
{
@ -88,7 +93,7 @@ public:
try
{
return c.getSymbolValue (mainSymbol, member).term->evaluate (c, recursionDepth);
return getTermFor (c.getSymbolValue (mainSymbol, member))->evaluate (c, recursionDepth);
}
catch (...)
{}
@ -118,7 +123,7 @@ public:
try
{
return c != 0 && c->getSymbolValue (mainSymbol, member).term->referencesSymbol (s, c, recursionDepth);
return c != 0 && getTermFor (c->getSymbolValue (mainSymbol, member))->referencesSymbol (s, c, recursionDepth);
}
catch (EvaluationError&)
{

View file

@ -178,7 +178,7 @@ private:
This can be handy for checking whether this is a null pointer.
*/
template <class ObjectType>
inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
bool operator== (const ScopedPointer<ObjectType>& pointer1, ObjectType* const pointer2) throw()
{
return static_cast <ObjectType*> (pointer1) == pointer2;
}
@ -187,7 +187,7 @@ inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectT
This can be handy for checking whether this is a null pointer.
*/
template <class ObjectType>
inline bool operator!= (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
bool operator!= (const ScopedPointer<ObjectType>& pointer1, ObjectType* const pointer2) throw()
{
return static_cast <ObjectType*> (pointer1) != pointer2;
}

View file

@ -192,7 +192,7 @@ bool Value::operator!= (const Value& other) const
}
//==============================================================================
void Value::addListener (Listener* const listener)
void Value::addListener (ValueListener* const listener)
{
if (listener != 0)
{
@ -203,7 +203,7 @@ void Value::addListener (Listener* const listener)
}
}
void Value::removeListener (Listener* const listener)
void Value::removeListener (ValueListener* const listener)
{
listeners.remove (listener);
@ -214,7 +214,7 @@ void Value::removeListener (Listener* const listener)
void Value::callListeners()
{
Value v (*this); // (create a copy in case this gets deleted by a callback)
listeners.call (&Value::Listener::valueChanged, v);
listeners.call (&ValueListener::valueChanged, v);
}
OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value)

View file

@ -233,5 +233,7 @@ private:
/** Writes a Value to an OutputStream as a UTF8 string. */
OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value);
/** This typedef is just for compatibility with old code - newer code should use the Value::Listener class directly. */
typedef Value::Listener ValueListener;
#endif // __JUCE_VALUE_JUCEHEADER__

View file

@ -79,7 +79,7 @@ typedef unsigned int uint32;
typedef int64 pointer_sized_int;
/** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
typedef uint64 pointer_sized_uint;
#elif _MSC_VER >= 1300
#elif JUCE_MSVC && ! JUCE_VC6
/** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
typedef _W64 int pointer_sized_int;
/** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
@ -163,22 +163,26 @@ inline void swapVariables (Type& variable1, Type& variable2)
variable2 = tempVal;
}
/** Handy function for getting the number of elements in a simple const C array.
#if JUCE_VC6
#define numElementsInArray(X) (sizeof((X)) / sizeof(0[X]))
#else
/** Handy function for getting the number of elements in a simple const C array.
E.g.
@code
static int myArray[] = { 1, 2, 3 };
E.g.
@code
static int myArray[] = { 1, 2, 3 };
int numElements = numElementsInArray (myArray) // returns 3
@endcode
*/
template <typename Type, int N>
inline int numElementsInArray (Type (&array)[N])
{
(void) array; // (required to avoid a spurious warning in MS compilers)
sizeof (0[array]); // This line should cause an error if you pass an object with a user-defined subscript operator
return N;
}
int numElements = numElementsInArray (myArray) // returns 3
@endcode
*/
template <typename Type, int N>
inline int numElementsInArray (Type (&array)[N])
{
(void) array; // (required to avoid a spurious warning in MS compilers)
sizeof (0[array]); // This line should cause an error if you pass an object with a user-defined subscript operator
return N;
}
#endif
//==============================================================================
// Some useful maths functions that aren't always present with all compilers and build settings.
@ -327,9 +331,9 @@ inline int roundFloatToInt (const float value) throw()
*/
namespace TypeHelpers
{
#if defined (_MSC_VER) && _MSC_VER <= 1400
#if JUCE_VC8_OR_EARLIER
#define PARAMETER_TYPE(a) a
#else
#else
/** The ParameterType struct is used to find the best type to use when passing some kind
of object as a parameter.
@ -344,7 +348,7 @@ namespace TypeHelpers
*/
template <typename Type> struct ParameterType { typedef const Type& type; };
#if ! DOXYGEN
#if ! DOXYGEN
template <typename Type> struct ParameterType <Type&> { typedef Type& type; };
template <typename Type> struct ParameterType <Type*> { typedef Type* type; };
template <> struct ParameterType <char> { typedef char type; };
@ -360,13 +364,13 @@ namespace TypeHelpers
template <> struct ParameterType <bool> { typedef bool type; };
template <> struct ParameterType <float> { typedef float type; };
template <> struct ParameterType <double> { typedef double type; };
#endif
#endif
/** A helpful macro to simplify the use of the ParameterType template.
@see ParameterType
*/
#define PARAMETER_TYPE(a) typename TypeHelpers::ParameterType<a>::type
#endif
#endif
}

View file

@ -33,7 +33,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 91
#define JUCE_BUILDNUMBER 92
/** Current Juce version number.
@ -65,8 +65,20 @@
// Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
#if JUCE_MSVC
#if (defined(_MSC_VER) && (_MSC_VER <= 1200))
#if JUCE_VC6
#pragma warning (disable: 4284 4786) // (spurious VC6 warnings)
namespace std // VC6 doesn't have sqrt/sin/cos/tan/abs in std, so declare them here:
{
template <typename Type> Type abs (Type a) { if (a < 0) return -a; return a; }
template <typename Type> Type tan (Type a) { return static_cast<Type> (::tan (static_cast<double> (a))); }
template <typename Type> Type sin (Type a) { return static_cast<Type> (::sin (static_cast<double> (a))); }
template <typename Type> Type cos (Type a) { return static_cast<Type> (::cos (static_cast<double> (a))); }
template <typename Type> Type sqrt (Type a) { return static_cast<Type> (::sqrt (static_cast<double> (a))); }
template <typename Type> Type floor (Type a) { return static_cast<Type> (::floor (static_cast<double> (a))); }
template <typename Type> Type ceil (Type a) { return static_cast<Type> (::ceil (static_cast<double> (a))); }
template <typename Type> Type atan2 (Type a, Type b) { return static_cast<Type> (::atan2 (static_cast<double> (a), static_cast<double> (b))); }
}
#endif
#pragma warning (push)

View file

@ -160,7 +160,19 @@
#elif defined (_MSC_VER)
#define JUCE_MSVC 1
#if _MSC_VER >= 1400
#if _MSC_VER < 1500
#define JUCE_VC8_OR_EARLIER 1
#if _MSC_VER < 1400
#define JUCE_VC7_OR_EARLIER 1
#if _MSC_VER < 1300
#define JUCE_VC6 1
#endif
#endif
#endif
#if ! JUCE_VC7_OR_EARLIER
#define JUCE_USE_INTRINSICS 1
#endif
#else

View file

@ -72,7 +72,7 @@ template <class ListenerClass,
class ListenerList
{
// Horrible macros required to support VC6/7..
#if defined (_MSC_VER) && _MSC_VER <= 1400
#if JUCE_VC8_OR_EARLIER
#define LL_TEMPLATE(a) typename P##a, typename Q##a
#define LL_PARAM(a) Q##a& param##a
#else

View file

@ -351,12 +351,12 @@ void Button::handleCommandMessage (int commandId)
}
//==============================================================================
void Button::addButtonListener (Listener* const newListener)
void Button::addButtonListener (ButtonListener* const newListener)
{
buttonListeners.add (newListener);
}
void Button::removeButtonListener (Listener* const listener)
void Button::removeButtonListener (ButtonListener* const listener)
{
buttonListeners.remove (listener);
}

View file

@ -33,6 +33,9 @@
#include "../../../containers/juce_Value.h"
#include "../windows/juce_TooltipWindow.h"
#if JUCE_VC6
#define Listener ButtonListener
#endif
//==============================================================================
/**
@ -47,7 +50,7 @@
class JUCE_API Button : public Component,
public SettableTooltipClient,
public ApplicationCommandManagerListener,
public Value::Listener,
public ValueListener,
private KeyListener
{
protected:
@ -175,7 +178,7 @@ public:
@see Button::addButtonListener, Button::removeButtonListener
*/
class JUCE_API Listener
class Listener
{
public:
/** Destructor. */
@ -507,5 +510,8 @@ private:
/** This typedef is just for compatibility with old code - newer code should use Button::Listener instead. */
typedef Button::Listener ButtonListener;
#if JUCE_VC6
#undef Listener
#endif
#endif // __JUCE_BUTTON_JUCEHEADER__

View file

@ -599,12 +599,12 @@ void ComboBox::mouseUp (const MouseEvent& e2)
}
//==============================================================================
void ComboBox::addListener (Listener* const listener)
void ComboBox::addListener (ComboBoxListener* const listener)
{
listeners.add (listener);
}
void ComboBox::removeListener (Listener* const listener)
void ComboBox::removeListener (ComboBoxListener* const listener)
{
listeners.remove (listener);
}

View file

@ -30,6 +30,9 @@
#include "../../../text/juce_StringArray.h"
#include "../../../containers/juce_Value.h"
#if JUCE_VC6
#define Listener SliderListener
#endif
//==============================================================================
/**
@ -49,7 +52,7 @@
class JUCE_API ComboBox : public Component,
public SettableTooltipClient,
public LabelListener, // (can't use Label::Listener due to idiotic VC2005 bug)
public Value::Listener,
public ValueListener,
private AsyncUpdater
{
public:
@ -403,5 +406,8 @@ private:
/** This typedef is just for compatibility with old code - newer code should use the ComboBox::Listener class directly. */
typedef ComboBox::Listener ComboBoxListener;
#if JUCE_VC6
#undef Listener
#endif
#endif // __JUCE_COMBOBOX_JUCEHEADER__

View file

@ -403,12 +403,12 @@ KeyboardFocusTraverser* Label::createFocusTraverser()
}
//==============================================================================
void Label::addListener (Listener* const listener)
void Label::addListener (LabelListener* const listener)
{
listeners.add (listener);
}
void Label::removeListener (Listener* const listener)
void Label::removeListener (LabelListener* const listener)
{
listeners.remove (listener);
}

View file

@ -28,6 +28,9 @@
#include "juce_TextEditor.h"
#if JUCE_VC6
#define Listener ButtonListener
#endif
//==============================================================================
/**
@ -36,9 +39,9 @@
*/
class JUCE_API Label : public Component,
public SettableTooltipClient,
protected TextEditor::Listener,
protected TextEditorListener,
private ComponentListener,
private Value::Listener
private ValueListener
{
public:
//==============================================================================
@ -335,5 +338,8 @@ private:
/** This typedef is just for compatibility with old code - newer code should use the Label::Listener class directly. */
typedef Label::Listener LabelListener;
#if JUCE_VC6
#undef Listener
#endif
#endif // __JUCE_LABEL_JUCEHEADER__

View file

@ -852,7 +852,7 @@ void ListBox::setOutlineThickness (const int outlineThickness_)
void ListBox::setHeaderComponent (Component* const newHeaderComponent)
{
if (newHeaderComponent != headerComponent)
if (headerComponent != newHeaderComponent)
{
headerComponent = newHeaderComponent;

View file

@ -176,12 +176,12 @@ void Slider::sendDragEnd()
listeners.callChecked (checker, &SliderListener::sliderDragEnded, this);
}
void Slider::addListener (Listener* const listener)
void Slider::addListener (SliderListener* const listener)
{
listeners.add (listener);
}
void Slider::removeListener (Listener* const listener)
void Slider::removeListener (SliderListener* const listener)
{
listeners.remove (listener);
}

View file

@ -31,6 +31,9 @@
#include "../../../events/juce_AsyncUpdater.h"
#include "../../../containers/juce_Value.h"
#if JUCE_VC6
#define Listener LabelListener
#endif
//==============================================================================
/**
@ -58,7 +61,7 @@ class JUCE_API Slider : public Component,
public AsyncUpdater,
public ButtonListener, // (can't use Button::Listener due to idiotic VC2005 bug)
public LabelListener,
public Value::Listener
public ValueListener
{
public:
//==============================================================================
@ -841,5 +844,8 @@ private:
/** This typedef is just for compatibility with old code - newer code should use the Slider::Listener class directly. */
typedef Slider::Listener SliderListener;
#if JUCE_VC6
#undef Listener
#endif
#endif // __JUCE_SLIDER_JUCEHEADER__

View file

@ -870,7 +870,7 @@ public:
//==============================================================================
class TextEditor::TextHolderComponent : public Component,
public Timer,
public Value::Listener
public ValueListener
{
public:
TextHolderComponent (TextEditor& owner_)
@ -1280,12 +1280,12 @@ void TextEditor::escapePressed()
postCommandMessage (TextEditorDefs::escapeKeyMessageId);
}
void TextEditor::addListener (Listener* const newListener)
void TextEditor::addListener (TextEditorListener* const newListener)
{
listeners.add (newListener);
}
void TextEditor::removeListener (Listener* const listenerToRemove)
void TextEditor::removeListener (TextEditorListener* const listenerToRemove)
{
listeners.remove (listenerToRemove);
}
@ -2213,19 +2213,19 @@ void TextEditor::handleCommandMessage (const int commandId)
switch (commandId)
{
case TextEditorDefs::textChangeMessageId:
listeners.callChecked (checker, &TextEditor::Listener::textEditorTextChanged, (TextEditor&) *this);
listeners.callChecked (checker, &TextEditorListener::textEditorTextChanged, (TextEditor&) *this);
break;
case TextEditorDefs::returnKeyMessageId:
listeners.callChecked (checker, &TextEditor::Listener::textEditorReturnKeyPressed, (TextEditor&) *this);
listeners.callChecked (checker, &TextEditorListener::textEditorReturnKeyPressed, (TextEditor&) *this);
break;
case TextEditorDefs::escapeKeyMessageId:
listeners.callChecked (checker, &TextEditor::Listener::textEditorEscapeKeyPressed, (TextEditor&) *this);
listeners.callChecked (checker, &TextEditorListener::textEditorEscapeKeyPressed, (TextEditor&) *this);
break;
case TextEditorDefs::focusLossMessageId:
listeners.callChecked (checker, &TextEditor::Listener::textEditorFocusLost, (TextEditor&) *this);
listeners.callChecked (checker, &TextEditorListener::textEditorFocusLost, (TextEditor&) *this);
break;
default:

View file

@ -670,7 +670,7 @@ void Toolbar::itemDropped (const String&, Component* sourceComponent, int, int)
//==============================================================================
void Toolbar::mouseDown (const MouseEvent& e)
void Toolbar::mouseDown (const MouseEvent&)
{
}

View file

@ -251,7 +251,9 @@ Component::Component (const String& name)
Component::~Component()
{
#if ! JUCE_VC6 // (access to private union not allowed in VC6)
static_jassert (sizeof (flags) <= sizeof (componentFlags_));
#endif
componentListeners.call (&ComponentListener::componentBeingDeleted, *this);

View file

@ -147,7 +147,7 @@ public:
repaint();
}
void buttonClicked (Button* button)
void buttonClicked (Button*)
{
owner.showExtraItemsMenu();
}

View file

@ -32,7 +32,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
class ChoicePropertyComponent::RemapperValueSource : public Value::ValueSource,
public Value::Listener
public ValueListener
{
public:
RemapperValueSource (const Value& sourceValue_, const Array<var>& mappings_)

View file

@ -414,7 +414,7 @@ private:
};
//==============================================================================
namespace
namespace RenderingHelpers
{
forcedinline int safeModulo (int n, const int divisor) throw()
{
@ -436,8 +436,8 @@ public:
: destData (destData_),
srcData (srcData_),
extraAlpha (extraAlpha_ + 1),
xOffset (repeatPattern ? safeModulo (x, srcData_.width) - srcData_.width : x),
yOffset (repeatPattern ? safeModulo (y, srcData_.height) - srcData_.height : y)
xOffset (repeatPattern ? RenderingHelpers::safeModulo (x, srcData_.width) - srcData_.width : x),
yOffset (repeatPattern ? RenderingHelpers::safeModulo (y, srcData_.height) - srcData_.height : y)
{
}
@ -680,8 +680,8 @@ private:
if (repeatPattern)
{
loResX = safeModulo (loResX, srcData.width);
loResY = safeModulo (loResY, srcData.height);
loResX = RenderingHelpers::safeModulo (loResX, srcData.width);
loResY = RenderingHelpers::safeModulo (loResY, srcData.height);
}
if (betterQuality)

View file

@ -118,10 +118,10 @@ bool DrawableComposite::Marker::operator!= (const DrawableComposite::Marker& oth
}
//==============================================================================
const char* const DrawableComposite::contentLeftMarkerName ("left");
const char* const DrawableComposite::contentRightMarkerName ("right");
const char* const DrawableComposite::contentTopMarkerName ("top");
const char* const DrawableComposite::contentBottomMarkerName ("bottom");
const char* const DrawableComposite::contentLeftMarkerName = "left";
const char* const DrawableComposite::contentRightMarkerName = "right";
const char* const DrawableComposite::contentTopMarkerName = "top";
const char* const DrawableComposite::contentBottomMarkerName = "bottom";
const RelativeRectangle DrawableComposite::getContentArea() const
{
@ -560,7 +560,7 @@ void DrawableComposite::ValueTreeWrapper::removeMarker (bool xAxis, const ValueT
&& state [nameProperty].toString() != contentRightMarkerName
&& state [nameProperty].toString() != contentTopMarkerName
&& state [nameProperty].toString() != contentBottomMarkerName)
return getMarkerList (xAxis).removeChild (state, undoManager);
getMarkerList (xAxis).removeChild (state, undoManager);
}
//==============================================================================

View file

@ -205,7 +205,7 @@ public:
//==============================================================================
/** Internally-used class for wrapping a DrawableComposite's state into a ValueTree. */
class ValueTreeWrapper : public ValueTreeWrapperBase
class ValueTreeWrapper : public Drawable::ValueTreeWrapperBase
{
public:
ValueTreeWrapper (const ValueTree& state);

View file

@ -104,7 +104,7 @@ public:
//==============================================================================
/** Internally-used class for wrapping a DrawableImage's state into a ValueTree. */
class ValueTreeWrapper : public ValueTreeWrapperBase
class ValueTreeWrapper : public Drawable::ValueTreeWrapperBase
{
public:
ValueTreeWrapper (const ValueTree& state);

View file

@ -168,7 +168,7 @@ Value DrawablePath::ValueTreeWrapper::Element::getControlPointValue (int index,
void DrawablePath::ValueTreeWrapper::Element::setControlPoint (const int index, const RelativePoint& point, UndoManager* undoManager)
{
jassert (index >= 0 && index < getNumControlPoints());
return state.setProperty (index == 0 ? point1 : (index == 1 ? point2 : point3), point.toString(), undoManager);
state.setProperty (index == 0 ? point1 : (index == 1 ? point2 : point3), point.toString(), undoManager);
}
const RelativePoint DrawablePath::ValueTreeWrapper::Element::getStartPoint() const

View file

@ -74,7 +74,7 @@ public:
//==============================================================================
/** Internally-used class for wrapping a DrawablePath's state into a ValueTree. */
class ValueTreeWrapper : public FillAndStrokeState
class ValueTreeWrapper : public DrawableShape::FillAndStrokeState
{
public:
ValueTreeWrapper (const ValueTree& state);

View file

@ -74,7 +74,7 @@ public:
//==============================================================================
/** Internally-used class for wrapping a DrawableRectangle's state into a ValueTree. */
class ValueTreeWrapper : public FillAndStrokeState
class ValueTreeWrapper : public DrawableShape::FillAndStrokeState
{
public:
ValueTreeWrapper (const ValueTree& state);

View file

@ -90,7 +90,7 @@ public:
//==============================================================================
/** @internal */
class FillAndStrokeState : public ValueTreeWrapperBase
class FillAndStrokeState : public Drawable::ValueTreeWrapperBase
{
public:
FillAndStrokeState (const ValueTree& state);

View file

@ -107,7 +107,7 @@ public:
//==============================================================================
/** Internally-used class for wrapping a DrawableText's state into a ValueTree. */
class ValueTreeWrapper : public ValueTreeWrapperBase
class ValueTreeWrapper : public Drawable::ValueTreeWrapperBase
{
public:
ValueTreeWrapper (const ValueTree& state);

View file

@ -79,7 +79,7 @@ public:
return new LowLevelGraphicsSoftwareRenderer (Image (this));
}
SharedImage* clone()
Image::SharedImage* clone()
{
SoftwareSharedImage* s = new SoftwareSharedImage (format, width, height, false);
memcpy (s->imageData, imageData, lineStride * height);
@ -123,7 +123,7 @@ public:
return g;
}
SharedImage* clone()
Image::SharedImage* clone()
{
return new SubsectionSharedImage (image->clone(), area);
}

View file

@ -401,7 +401,7 @@ public:
protected:
friend class Image;
friend class Image::BitmapData;
friend class BitmapData;
const PixelFormat format;
const int width, height;
int pixelStride, lineStride;
@ -421,6 +421,9 @@ public:
juce_UseDebuggingNewOperator
private:
friend class SharedImage;
friend class BitmapData;
ReferenceCountedObjectPtr<SharedImage> image;
};

View file

@ -116,6 +116,7 @@ public:
private:
//==============================================================================
class Pimpl;
friend class Pimpl;
ImageCache();
ImageCache (const ImageCache&);

View file

@ -58,11 +58,11 @@ __int64 juce_InterlockedCompareExchange64 (volatile __int64* value, __int64 newV
CriticalSection::CriticalSection() throw()
{
// (just to check the MS haven't changed this structure and broken things...)
#if _MSC_VER >= 1400
static_jassert (sizeof (CRITICAL_SECTION) <= sizeof (internal));
#else
#if JUCE_VC7_OR_EARLIER
static_jassert (sizeof (CRITICAL_SECTION) <= 24);
#endif
#else
static_jassert (sizeof (CRITICAL_SECTION) <= sizeof (internal));
#endif
InitializeCriticalSection ((CRITICAL_SECTION*) internal);
}

View file

@ -218,7 +218,7 @@ public:
return new LowLevelGraphicsSoftwareRenderer (Image (this));
}
SharedImage* clone()
Image::SharedImage* clone()
{
WindowsBitmapImage* im = new WindowsBitmapImage (format, width, height, false);

View file

@ -351,11 +351,11 @@ namespace NumberToStringConverters
juce_wchar getDecimalPoint()
{
#if JUCE_MSVC && _MSC_VER < 1400
#if JUCE_VC7_OR_EARLIER
static juce_wchar dp = std::_USE (std::locale(), std::numpunct <wchar_t>).decimal_point();
#else
#else
static juce_wchar dp = std::use_facet <std::numpunct <wchar_t> > (std::locale()).decimal_point();
#endif
#endif
return dp;
}
@ -387,15 +387,15 @@ namespace NumberToStringConverters
}
else
{
#if JUCE_WINDOWS
#if (JUCE_MSVC && _MSC_VER <= 1400) || JUCE_MINGW
#if JUCE_WINDOWS
#if JUCE_VC8_OR_EARLIER || JUCE_MINGW
len = _snwprintf (buffer, numChars, L"%.9g", n);
#else
#else
len = _snwprintf_s (buffer, numChars, _TRUNCATE, L"%.9g", n);
#endif
#else
#endif
#else
len = swprintf (buffer, numChars, L"%.9g", n);
#endif
#endif
return buffer;
}
}