Browse Source

Fixed some documentation. Added a frequency to MidiMessage::getMidiNoteInHertz(). Tweaked some Expression and RelativeCoordinate methods.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
d710ed98e4
13 changed files with 114 additions and 142 deletions
  1. +27
    -37
      juce_amalgamated.cpp
  2. +30
    -34
      juce_amalgamated.h
  3. +4
    -4
      src/audio/midi/juce_MidiMessage.cpp
  4. +2
    -1
      src/audio/midi/juce_MidiMessage.h
  5. +1
    -1
      src/audio/processors/juce_AudioProcessorListener.h
  6. +7
    -7
      src/containers/juce_Expression.cpp
  7. +4
    -3
      src/containers/juce_Expression.h
  8. +1
    -1
      src/core/juce_StandardHeader.h
  9. +16
    -13
      src/gui/components/controls/juce_Slider.h
  10. +11
    -22
      src/gui/graphics/geometry/juce_RelativeCoordinate.cpp
  11. +6
    -15
      src/gui/graphics/geometry/juce_RelativeCoordinate.h
  12. +4
    -2
      src/native/mac/juce_mac_Files.mm
  13. +1
    -2
      src/native/windows/juce_win32_Windowing.cpp

+ 27
- 37
juce_amalgamated.cpp View File

@@ -4628,7 +4628,7 @@ public:
: mainSymbol + "." + member; : mainSymbol + "." + member;
} }


bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const
bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const
{ {
if (s == mainSymbol) if (s == mainSymbol)
return true; return true;
@@ -4638,7 +4638,7 @@ public:


try try
{ {
return c.getSymbolValue (mainSymbol, member).term->referencesSymbol (s, c, recursionDepth);
return c != 0 && c->getSymbolValue (mainSymbol, member).term->referencesSymbol (s, c, recursionDepth);
} }
catch (EvaluationError&) catch (EvaluationError&)
{ {
@@ -4673,7 +4673,7 @@ public:
Term* getInput (int i) const { return parameters [i]; } Term* getInput (int i) const { return parameters [i]; }
const String getFunctionName() const { return functionName; } const String getFunctionName() const { return functionName; }


bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const
bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const
{ {
for (int i = 0; i < parameters.size(); ++i) for (int i = 0; i < parameters.size(); ++i)
if (parameters.getUnchecked(i)->referencesSymbol (s, c, recursionDepth)) if (parameters.getUnchecked(i)->referencesSymbol (s, c, recursionDepth))
@@ -4744,7 +4744,7 @@ public:
return "-" + input->toString(); return "-" + input->toString();
} }


bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const
bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const
{ {
return input->referencesSymbol (s, c, recursionDepth); return input->referencesSymbol (s, c, recursionDepth);
} }
@@ -4771,7 +4771,7 @@ public:
int getNumInputs() const { return 2; } int getNumInputs() const { return 2; }
Term* getInput (int index) const { return index == 0 ? static_cast<Term*> (left) : (index == 1 ? static_cast<Term*> (right) : 0); } Term* getInput (int index) const { return index == 0 ? static_cast<Term*> (left) : (index == 1 ? static_cast<Term*> (right) : 0); }


bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const
bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const
{ {
return left->referencesSymbol (s, c, recursionDepth) return left->referencesSymbol (s, c, recursionDepth)
|| right->referencesSymbol (s, c, recursionDepth); || right->referencesSymbol (s, c, recursionDepth);
@@ -5391,7 +5391,7 @@ const Expression Expression::withRenamedSymbol (const String& oldSymbol, const S
return newExpression; return newExpression;
} }


bool Expression::referencesSymbol (const String& symbol, const EvaluationContext& context) const
bool Expression::referencesSymbol (const String& symbol, const EvaluationContext* context) const
{ {
return term->referencesSymbol (symbol, context, 0); return term->referencesSymbol (symbol, context, 0);
} }
@@ -5436,7 +5436,7 @@ int Expression::Term::getOperatorPrecedence() const
return 0; return 0;
} }


bool Expression::Term::referencesSymbol (const String&, const EvaluationContext&, int) const
bool Expression::Term::referencesSymbol (const String&, const EvaluationContext*, int) const
{ {
return false; return false;
} }
@@ -29857,15 +29857,15 @@ const String MidiMessage::getMidiNoteName (int note, bool useSharps, bool includ
return String::empty; return String::empty;
} }


const double MidiMessage::getMidiNoteInHertz (int noteNumber) throw()
const double MidiMessage::getMidiNoteInHertz (int noteNumber, const double frequencyOfA) throw()
{ {
noteNumber -= 12 * 6 + 9; // now 0 = A440
return 440.0 * pow (2.0, noteNumber / 12.0);
noteNumber -= 12 * 6 + 9; // now 0 = A
return frequencyOfA * pow (2.0, noteNumber / 12.0);
} }


const String MidiMessage::getGMInstrumentName (const int n) const String MidiMessage::getGMInstrumentName (const int n)
{ {
const char *names[] =
const char* names[] =
{ {
"Acoustic Grand Piano", "Bright Acoustic Piano", "Electric Grand Piano", "Honky-tonk Piano", "Acoustic Grand Piano", "Bright Acoustic Piano", "Electric Grand Piano", "Honky-tonk Piano",
"Electric Piano 1", "Electric Piano 2", "Harpsichord", "Clavinet", "Celesta", "Glockenspiel", "Electric Piano 1", "Electric Piano 2", "Harpsichord", "Clavinet", "Celesta", "Glockenspiel",
@@ -80260,11 +80260,7 @@ bool RelativeCoordinate::references (const String& coordName, const Expression::
{ {
try try
{ {
if (context != 0)
return term.referencesSymbol (coordName, *context);

Expression::EvaluationContext defaultContext;
return term.referencesSymbol (coordName, defaultContext);
return term.referencesSymbol (coordName, context);
} }
catch (...) catch (...)
{} {}
@@ -80282,18 +80278,12 @@ const String RelativeCoordinate::toString() const
return term.toString(); return term.toString();
} }


void RelativeCoordinate::renameSymbolIfUsed (const String& oldName, const String& newName,
const Expression::EvaluationContext* context)
void RelativeCoordinate::renameSymbolIfUsed (const String& oldName, const String& newName)
{ {
jassert (newName.isNotEmpty() && newName.toLowerCase().containsOnly ("abcdefghijklmnopqrstuvwxyz0123456789_")); jassert (newName.isNotEmpty() && newName.toLowerCase().containsOnly ("abcdefghijklmnopqrstuvwxyz0123456789_"));


if (term.referencesSymbol (oldName, *context))
{
const double oldValue = resolve (context);

if (term.referencesSymbol (oldName, 0))
term = term.withRenamedSymbol (oldName, newName); term = term.withRenamedSymbol (oldName, newName);
moveToAbsolute (oldValue, context);
}
} }


RelativePoint::RelativePoint() RelativePoint::RelativePoint()
@@ -80350,10 +80340,10 @@ const String RelativePoint::toString() const
return x.toString() + ", " + y.toString(); return x.toString() + ", " + y.toString();
} }


void RelativePoint::renameSymbolIfUsed (const String& oldName, const String& newName, const Expression::EvaluationContext* context)
void RelativePoint::renameSymbolIfUsed (const String& oldName, const String& newName)
{ {
x.renameSymbolIfUsed (oldName, newName, context);
y.renameSymbolIfUsed (oldName, newName, context);
x.renameSymbolIfUsed (oldName, newName);
y.renameSymbolIfUsed (oldName, newName);
} }


bool RelativePoint::isDynamic() const bool RelativePoint::isDynamic() const
@@ -80424,13 +80414,12 @@ const String RelativeRectangle::toString() const
return left.toString() + ", " + top.toString() + ", " + right.toString() + ", " + bottom.toString(); return left.toString() + ", " + top.toString() + ", " + right.toString() + ", " + bottom.toString();
} }


void RelativeRectangle::renameSymbolIfUsed (const String& oldName, const String& newName,
const Expression::EvaluationContext* context)
void RelativeRectangle::renameSymbolIfUsed (const String& oldName, const String& newName)
{ {
left.renameSymbolIfUsed (oldName, newName, context);
right.renameSymbolIfUsed (oldName, newName, context);
top.renameSymbolIfUsed (oldName, newName, context);
bottom.renameSymbolIfUsed (oldName, newName, context);
left.renameSymbolIfUsed (oldName, newName);
right.renameSymbolIfUsed (oldName, newName);
top.renameSymbolIfUsed (oldName, newName);
bottom.renameSymbolIfUsed (oldName, newName);
} }


RelativePointPath::RelativePointPath() RelativePointPath::RelativePointPath()
@@ -242719,8 +242708,7 @@ private:
{ {
if (rects->right <= x + w && rects->bottom <= y + h) if (rects->right <= x + w && rects->bottom <= y + h)
{ {
// (need to move this one pixel to the left because of a win32 bug)
const int cx = jmax (x, (int) rects->left - 1);
const int cx = jmax (x, (int) rects->left);
contextClip.addWithoutMerging (Rectangle<int> (cx - x, rects->top - y, rects->right - cx, rects->bottom - rects->top) contextClip.addWithoutMerging (Rectangle<int> (cx - x, rects->top - y, rects->right - cx, rects->bottom - rects->top)
.getIntersection (clipBounds)); .getIntersection (clipBounds));
} }
@@ -265473,7 +265461,8 @@ const File File::getLinkedTarget() const
NSString* dest = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath: juceStringToNS (getFullPathName()) error: nil]; NSString* dest = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath: juceStringToNS (getFullPathName()) error: nil];


#else #else
NSString* dest = [[NSFileManager defaultManager] pathContentOfSymbolicLinkAtPath: juceStringToNS (getFullPathName())];
// (the cast here avoids a deprecation warning)
NSString* dest = [((id) [NSFileManager defaultManager]) pathContentOfSymbolicLinkAtPath: juceStringToNS (getFullPathName())];
#endif #endif


if (dest != nil) if (dest != nil)
@@ -265684,7 +265673,8 @@ OSType PlatformUtilities::getTypeOfFile (const String& filename)
#if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5) #if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5)
NSDictionary* fileDict = [[NSFileManager defaultManager] attributesOfItemAtPath: juceStringToNS (filename) error: nil]; NSDictionary* fileDict = [[NSFileManager defaultManager] attributesOfItemAtPath: juceStringToNS (filename) error: nil];
#else #else
NSDictionary* fileDict = [[NSFileManager defaultManager] fileAttributesAtPath: juceStringToNS (filename) traverseLink: NO];
// (the cast here avoids a deprecation warning)
NSDictionary* fileDict = [((id) [NSFileManager defaultManager]) fileAttributesAtPath: juceStringToNS (filename) traverseLink: NO];
#endif #endif


return [fileDict fileHFSTypeCode]; return [fileDict fileHFSTypeCode];


+ 30
- 34
juce_amalgamated.h View File

@@ -64,7 +64,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52 #define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 64
#define JUCE_BUILDNUMBER 65


/** Current Juce version number. /** Current Juce version number.


@@ -6692,11 +6692,12 @@ public:
/** Returns true if this expression makes use of the specified symbol. /** Returns true if this expression makes use of the specified symbol.
If a suitable context is supplied, the search will dereference and recursively check If a suitable context is supplied, the search will dereference and recursively check
all symbols, so that it can be determined whether this expression relies on the given all symbols, so that it can be determined whether this expression relies on the given
symbol at any level in its evaluation.
symbol at any level in its evaluation. If the context parameter is null, this just checks
whether the expression contains any direct references to the symbol.


@throws Expression::EvaluationError @throws Expression::EvaluationError
*/ */
bool referencesSymbol (const String& symbol, const EvaluationContext& context) const;
bool referencesSymbol (const String& symbol, const EvaluationContext* context) const;


/** Returns true if this expression contains any symbols. */ /** Returns true if this expression contains any symbols. */
bool usesAnySymbols() const; bool usesAnySymbols() const;
@@ -6773,7 +6774,7 @@ private:
virtual int getInputIndexFor (const Term* possibleInput) const; virtual int getInputIndexFor (const Term* possibleInput) const;
virtual const String toString() const = 0; virtual const String toString() const = 0;
virtual int getOperatorPrecedence() const; virtual int getOperatorPrecedence() const;
virtual bool referencesSymbol (const String& symbol, const EvaluationContext&, int recursionDepth) const;
virtual bool referencesSymbol (const String& symbol, const EvaluationContext*, int recursionDepth) const;
virtual const ReferenceCountedObjectPtr<Term> createTermToEvaluateInput (const EvaluationContext&, const Term* inputTerm, virtual const ReferenceCountedObjectPtr<Term> createTermToEvaluateInput (const EvaluationContext&, const Term* inputTerm,
double overallTarget, Term* topLevelTerm) const; double overallTarget, Term* topLevelTerm) const;
virtual const ReferenceCountedObjectPtr<Term> negated(); virtual const ReferenceCountedObjectPtr<Term> negated();
@@ -33821,9 +33822,10 @@ public:


/** Returns the frequency of a midi note number. /** Returns the frequency of a midi note number.


The frequencyOfA parameter is an optional frequency for 'A', normally 440-444Hz for concert pitch.
@see getMidiNoteName @see getMidiNoteName
*/ */
static const double getMidiNoteInHertz (int noteNumber) throw();
static const double getMidiNoteInHertz (int noteNumber, const double frequencyOfA = 440.0) throw();


/** Returns the standard name of a GM instrument. /** Returns the standard name of a GM instrument.


@@ -38647,7 +38649,7 @@ public:
to trigger an AsyncUpdater or ChangeBroadcaster which you can respond to later on the to trigger an AsyncUpdater or ChangeBroadcaster which you can respond to later on the
message thread. message thread.


@see audioPluginParameterChangeGestureStart
@see audioProcessorParameterChangeGestureBegin
*/ */
virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor, virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
int parameterIndex); int parameterIndex);
@@ -43219,15 +43221,8 @@ public:
*/ */
void moveToAbsolute (double absoluteTargetPosition, const Expression::EvaluationContext* evaluationContext); void moveToAbsolute (double absoluteTargetPosition, const Expression::EvaluationContext* evaluationContext);


/** Tells the coordinate that an object is changing its name or being deleted.

If either of this coordinates anchor points match this name, they will be replaced.
If the newName string is empty, it indicates that the object is being removed, so if
this coordinate was using it, the coordinate is changed to be relative to the origin
instead.
*/
void renameSymbolIfUsed (const String& oldName, const String& newName,
const Expression::EvaluationContext* evaluationContext);
/** Changes the name of a symbol if it is used as part of the coordinate's expression. */
void renameSymbolIfUsed (const String& oldName, const String& newName);


/** Returns the expression that defines this coordinate. */ /** Returns the expression that defines this coordinate. */
const Expression& getExpression() const { return term; } const Expression& getExpression() const { return term; }
@@ -43314,11 +43309,10 @@ public:
*/ */
const String toString() const; const String toString() const;


/** Tells the point that an object is changing its name or being deleted.
/** Renames a symbol if it is used by any of the coordinates.
This calls RelativeCoordinate::renameAnchorIfUsed() on its X and Y coordinates. This calls RelativeCoordinate::renameAnchorIfUsed() on its X and Y coordinates.
*/ */
void renameSymbolIfUsed (const String& oldName, const String& newName,
const Expression::EvaluationContext* evaluationContext);
void renameSymbolIfUsed (const String& oldName, const String& newName);


/** Returns true if this point depends on any other coordinates for its position. */ /** Returns true if this point depends on any other coordinates for its position. */
bool isDynamic() const; bool isDynamic() const;
@@ -43381,11 +43375,10 @@ public:
*/ */
const String toString() const; const String toString() const;


/** Tells the rectangle that an object is changing its name or being deleted.
/** Renames a symbol if it is used by any of the coordinates.
This calls RelativeCoordinate::renameSymbolIfUsed() on the rectangle's coordinates. This calls RelativeCoordinate::renameSymbolIfUsed() on the rectangle's coordinates.
*/ */
void renameSymbolIfUsed (const String& oldName, const String& newName,
const Expression::EvaluationContext* evaluationContext);
void renameSymbolIfUsed (const String& oldName, const String& newName);


// The actual rectangle coords... // The actual rectangle coords...
RelativeCoordinate left, right, top, bottom; RelativeCoordinate left, right, top, bottom;
@@ -46188,7 +46181,7 @@ public:


@see setSliderStyle @see setSliderStyle
*/ */
SliderStyle getSliderStyle() const { return style; }
SliderStyle getSliderStyle() const throw() { return style; }


/** Changes the properties of a rotary slider. /** Changes the properties of a rotary slider.


@@ -46213,6 +46206,9 @@ public:
*/ */
void setMouseDragSensitivity (int distanceForFullScaleDrag); void setMouseDragSensitivity (int distanceForFullScaleDrag);


/** Returns the current sensitivity value set by setMouseDragSensitivity(). */
int getMouseDragSensitivity() const throw() { return pixelsForFullDragExtent; }

/** Changes the way the the mouse is used when dragging the slider. /** Changes the way the the mouse is used when dragging the slider.


If true, this will turn on velocity-sensitive dragging, so that If true, this will turn on velocity-sensitive dragging, so that
@@ -46226,7 +46222,7 @@ public:
/** Returns true if velocity-based mode is active. /** Returns true if velocity-based mode is active.
@see setVelocityBasedMode @see setVelocityBasedMode
*/ */
bool getVelocityBasedMode() const { return isVelocityBased; }
bool getVelocityBasedMode() const throw() { return isVelocityBased; }


/** Changes aspects of the scaling used when in velocity-sensitive mode. /** Changes aspects of the scaling used when in velocity-sensitive mode.


@@ -46249,22 +46245,22 @@ public:
/** Returns the velocity sensitivity setting. /** Returns the velocity sensitivity setting.
@see setVelocityModeParameters @see setVelocityModeParameters
*/ */
double getVelocitySensitivity() const { return velocityModeSensitivity; }
double getVelocitySensitivity() const throw() { return velocityModeSensitivity; }


/** Returns the velocity threshold setting. /** Returns the velocity threshold setting.
@see setVelocityModeParameters @see setVelocityModeParameters
*/ */
int getVelocityThreshold() const { return velocityModeThreshold; }
int getVelocityThreshold() const throw() { return velocityModeThreshold; }


/** Returns the velocity offset setting. /** Returns the velocity offset setting.
@see setVelocityModeParameters @see setVelocityModeParameters
*/ */
double getVelocityOffset() const { return velocityModeOffset; }
double getVelocityOffset() const throw() { return velocityModeOffset; }


/** Returns the velocity user key setting. /** Returns the velocity user key setting.
@see setVelocityModeParameters @see setVelocityModeParameters
*/ */
bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
bool getVelocityModeIsSwappable() const throw() { return userKeyOverridesVelocity; }


/** Sets up a skew factor to alter the way values are distributed. /** Sets up a skew factor to alter the way values are distributed.


@@ -46298,7 +46294,7 @@ public:


@see setSkewFactor, setSkewFactorFromMidPoint @see setSkewFactor, setSkewFactorFromMidPoint
*/ */
double getSkewFactor() const { return skewFactor; }
double getSkewFactor() const throw() { return skewFactor; }


/** Used by setIncDecButtonsMode(). /** Used by setIncDecButtonsMode().
*/ */
@@ -46354,17 +46350,17 @@ public:
/** Returns the status of the text-box. /** Returns the status of the text-box.
@see setTextBoxStyle @see setTextBoxStyle
*/ */
const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
const TextEntryBoxPosition getTextBoxPosition() const throw() { return textBoxPos; }


/** Returns the width used for the text-box. /** Returns the width used for the text-box.
@see setTextBoxStyle @see setTextBoxStyle
*/ */
int getTextBoxWidth() const { return textBoxWidth; }
int getTextBoxWidth() const throw() { return textBoxWidth; }


/** Returns the height used for the text-box. /** Returns the height used for the text-box.
@see setTextBoxStyle @see setTextBoxStyle
*/ */
int getTextBoxHeight() const { return textBoxHeight; }
int getTextBoxHeight() const throw() { return textBoxHeight; }


/** Makes the text-box editable. /** Makes the text-box editable.


@@ -46468,7 +46464,7 @@ public:
your own Value object. your own Value object.
@see Value, getMinValue, getMaxValueObject @see Value, getMinValue, getMaxValueObject
*/ */
Value& getMinValueObject() { return valueMin; }
Value& getMinValueObject() throw() { return valueMin; }


/** For a slider with two or three thumbs, this sets the lower of its values. /** For a slider with two or three thumbs, this sets the lower of its values.


@@ -46510,7 +46506,7 @@ public:
your own Value object. your own Value object.
@see Value, getMaxValue, getMinValueObject @see Value, getMaxValue, getMinValueObject
*/ */
Value& getMaxValueObject() { return valueMax; }
Value& getMaxValueObject() throw() { return valueMax; }


/** For a slider with two or three thumbs, this sets the lower of its values. /** For a slider with two or three thumbs, this sets the lower of its values.


@@ -46661,7 +46657,7 @@ public:
This will return 0 for the main thumb, 1 for the minimum-value thumb, 2 for This will return 0 for the main thumb, 1 for the minimum-value thumb, 2 for
the maximum-value thumb, or -1 if none is currently down. the maximum-value thumb, or -1 if none is currently down.
*/ */
int getThumbBeingDragged() const { return sliderBeingDragged; }
int getThumbBeingDragged() const throw() { return sliderBeingDragged; }


/** Callback to indicate that the user is about to start dragging the slider. /** Callback to indicate that the user is about to start dragging the slider.




+ 4
- 4
src/audio/midi/juce_MidiMessage.cpp View File

@@ -991,15 +991,15 @@ const String MidiMessage::getMidiNoteName (int note, bool useSharps, bool includ
return String::empty; return String::empty;
} }
const double MidiMessage::getMidiNoteInHertz (int noteNumber) throw()
const double MidiMessage::getMidiNoteInHertz (int noteNumber, const double frequencyOfA) throw()
{ {
noteNumber -= 12 * 6 + 9; // now 0 = A440
return 440.0 * pow (2.0, noteNumber / 12.0);
noteNumber -= 12 * 6 + 9; // now 0 = A
return frequencyOfA * pow (2.0, noteNumber / 12.0);
} }
const String MidiMessage::getGMInstrumentName (const int n) const String MidiMessage::getGMInstrumentName (const int n)
{ {
const char *names[] =
const char* names[] =
{ {
"Acoustic Grand Piano", "Bright Acoustic Piano", "Electric Grand Piano", "Honky-tonk Piano", "Acoustic Grand Piano", "Bright Acoustic Piano", "Electric Grand Piano", "Honky-tonk Piano",
"Electric Piano 1", "Electric Piano 2", "Harpsichord", "Clavinet", "Celesta", "Glockenspiel", "Electric Piano 1", "Electric Piano 2", "Harpsichord", "Clavinet", "Celesta", "Glockenspiel",


+ 2
- 1
src/audio/midi/juce_MidiMessage.h View File

@@ -860,9 +860,10 @@ public:
/** Returns the frequency of a midi note number. /** Returns the frequency of a midi note number.
The frequencyOfA parameter is an optional frequency for 'A', normally 440-444Hz for concert pitch.
@see getMidiNoteName @see getMidiNoteName
*/ */
static const double getMidiNoteInHertz (int noteNumber) throw();
static const double getMidiNoteInHertz (int noteNumber, const double frequencyOfA = 440.0) throw();
/** Returns the standard name of a GM instrument. /** Returns the standard name of a GM instrument.


+ 1
- 1
src/audio/processors/juce_AudioProcessorListener.h View File

@@ -99,7 +99,7 @@ public:
to trigger an AsyncUpdater or ChangeBroadcaster which you can respond to later on the to trigger an AsyncUpdater or ChangeBroadcaster which you can respond to later on the
message thread. message thread.
@see audioPluginParameterChangeGestureStart
@see audioProcessorParameterChangeGestureBegin
*/ */
virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor, virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
int parameterIndex); int parameterIndex);


+ 7
- 7
src/containers/juce_Expression.cpp View File

@@ -108,7 +108,7 @@ public:
: mainSymbol + "." + member; : mainSymbol + "." + member;
} }
bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const
bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const
{ {
if (s == mainSymbol) if (s == mainSymbol)
return true; return true;
@@ -118,7 +118,7 @@ public:
try try
{ {
return c.getSymbolValue (mainSymbol, member).term->referencesSymbol (s, c, recursionDepth);
return c != 0 && c->getSymbolValue (mainSymbol, member).term->referencesSymbol (s, c, recursionDepth);
} }
catch (EvaluationError&) catch (EvaluationError&)
{ {
@@ -154,7 +154,7 @@ public:
Term* getInput (int i) const { return parameters [i]; } Term* getInput (int i) const { return parameters [i]; }
const String getFunctionName() const { return functionName; } const String getFunctionName() const { return functionName; }
bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const
bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const
{ {
for (int i = 0; i < parameters.size(); ++i) for (int i = 0; i < parameters.size(); ++i)
if (parameters.getUnchecked(i)->referencesSymbol (s, c, recursionDepth)) if (parameters.getUnchecked(i)->referencesSymbol (s, c, recursionDepth))
@@ -226,7 +226,7 @@ public:
return "-" + input->toString(); return "-" + input->toString();
} }
bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const
bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const
{ {
return input->referencesSymbol (s, c, recursionDepth); return input->referencesSymbol (s, c, recursionDepth);
} }
@@ -254,7 +254,7 @@ public:
int getNumInputs() const { return 2; } int getNumInputs() const { return 2; }
Term* getInput (int index) const { return index == 0 ? static_cast<Term*> (left) : (index == 1 ? static_cast<Term*> (right) : 0); } Term* getInput (int index) const { return index == 0 ? static_cast<Term*> (left) : (index == 1 ? static_cast<Term*> (right) : 0); }
bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const
bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const
{ {
return left->referencesSymbol (s, c, recursionDepth) return left->referencesSymbol (s, c, recursionDepth)
|| right->referencesSymbol (s, c, recursionDepth); || right->referencesSymbol (s, c, recursionDepth);
@@ -882,7 +882,7 @@ const Expression Expression::withRenamedSymbol (const String& oldSymbol, const S
return newExpression; return newExpression;
} }
bool Expression::referencesSymbol (const String& symbol, const EvaluationContext& context) const
bool Expression::referencesSymbol (const String& symbol, const EvaluationContext* context) const
{ {
return term->referencesSymbol (symbol, context, 0); return term->referencesSymbol (symbol, context, 0);
} }
@@ -928,7 +928,7 @@ int Expression::Term::getOperatorPrecedence() const
return 0; return 0;
} }
bool Expression::Term::referencesSymbol (const String&, const EvaluationContext&, int) const
bool Expression::Term::referencesSymbol (const String&, const EvaluationContext*, int) const
{ {
return false; return false;
} }


+ 4
- 3
src/containers/juce_Expression.h View File

@@ -156,11 +156,12 @@ public:
/** Returns true if this expression makes use of the specified symbol. /** Returns true if this expression makes use of the specified symbol.
If a suitable context is supplied, the search will dereference and recursively check If a suitable context is supplied, the search will dereference and recursively check
all symbols, so that it can be determined whether this expression relies on the given all symbols, so that it can be determined whether this expression relies on the given
symbol at any level in its evaluation.
symbol at any level in its evaluation. If the context parameter is null, this just checks
whether the expression contains any direct references to the symbol.
@throws Expression::EvaluationError @throws Expression::EvaluationError
*/ */
bool referencesSymbol (const String& symbol, const EvaluationContext& context) const;
bool referencesSymbol (const String& symbol, const EvaluationContext* context) const;
/** Returns true if this expression contains any symbols. */ /** Returns true if this expression contains any symbols. */
bool usesAnySymbols() const; bool usesAnySymbols() const;
@@ -241,7 +242,7 @@ private:
virtual int getInputIndexFor (const Term* possibleInput) const; virtual int getInputIndexFor (const Term* possibleInput) const;
virtual const String toString() const = 0; virtual const String toString() const = 0;
virtual int getOperatorPrecedence() const; virtual int getOperatorPrecedence() const;
virtual bool referencesSymbol (const String& symbol, const EvaluationContext&, int recursionDepth) const;
virtual bool referencesSymbol (const String& symbol, const EvaluationContext*, int recursionDepth) const;
virtual const ReferenceCountedObjectPtr<Term> createTermToEvaluateInput (const EvaluationContext&, const Term* inputTerm, virtual const ReferenceCountedObjectPtr<Term> createTermToEvaluateInput (const EvaluationContext&, const Term* inputTerm,
double overallTarget, Term* topLevelTerm) const; double overallTarget, Term* topLevelTerm) const;
virtual const ReferenceCountedObjectPtr<Term> negated(); virtual const ReferenceCountedObjectPtr<Term> negated();


+ 1
- 1
src/core/juce_StandardHeader.h View File

@@ -33,7 +33,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52 #define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 64
#define JUCE_BUILDNUMBER 65
/** Current Juce version number. /** Current Juce version number.


+ 16
- 13
src/gui/components/controls/juce_Slider.h View File

@@ -114,7 +114,7 @@ public:
@see setSliderStyle @see setSliderStyle
*/ */
SliderStyle getSliderStyle() const { return style; }
SliderStyle getSliderStyle() const throw() { return style; }
//============================================================================== //==============================================================================
/** Changes the properties of a rotary slider. /** Changes the properties of a rotary slider.
@@ -140,6 +140,9 @@ public:
*/ */
void setMouseDragSensitivity (int distanceForFullScaleDrag); void setMouseDragSensitivity (int distanceForFullScaleDrag);
/** Returns the current sensitivity value set by setMouseDragSensitivity(). */
int getMouseDragSensitivity() const throw() { return pixelsForFullDragExtent; }
//============================================================================== //==============================================================================
/** Changes the way the the mouse is used when dragging the slider. /** Changes the way the the mouse is used when dragging the slider.
@@ -154,7 +157,7 @@ public:
/** Returns true if velocity-based mode is active. /** Returns true if velocity-based mode is active.
@see setVelocityBasedMode @see setVelocityBasedMode
*/ */
bool getVelocityBasedMode() const { return isVelocityBased; }
bool getVelocityBasedMode() const throw() { return isVelocityBased; }
/** Changes aspects of the scaling used when in velocity-sensitive mode. /** Changes aspects of the scaling used when in velocity-sensitive mode.
@@ -177,22 +180,22 @@ public:
/** Returns the velocity sensitivity setting. /** Returns the velocity sensitivity setting.
@see setVelocityModeParameters @see setVelocityModeParameters
*/ */
double getVelocitySensitivity() const { return velocityModeSensitivity; }
double getVelocitySensitivity() const throw() { return velocityModeSensitivity; }
/** Returns the velocity threshold setting. /** Returns the velocity threshold setting.
@see setVelocityModeParameters @see setVelocityModeParameters
*/ */
int getVelocityThreshold() const { return velocityModeThreshold; }
int getVelocityThreshold() const throw() { return velocityModeThreshold; }
/** Returns the velocity offset setting. /** Returns the velocity offset setting.
@see setVelocityModeParameters @see setVelocityModeParameters
*/ */
double getVelocityOffset() const { return velocityModeOffset; }
double getVelocityOffset() const throw() { return velocityModeOffset; }
/** Returns the velocity user key setting. /** Returns the velocity user key setting.
@see setVelocityModeParameters @see setVelocityModeParameters
*/ */
bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
bool getVelocityModeIsSwappable() const throw() { return userKeyOverridesVelocity; }
//============================================================================== //==============================================================================
/** Sets up a skew factor to alter the way values are distributed. /** Sets up a skew factor to alter the way values are distributed.
@@ -227,7 +230,7 @@ public:
@see setSkewFactor, setSkewFactorFromMidPoint @see setSkewFactor, setSkewFactorFromMidPoint
*/ */
double getSkewFactor() const { return skewFactor; }
double getSkewFactor() const throw() { return skewFactor; }
//============================================================================== //==============================================================================
/** Used by setIncDecButtonsMode(). /** Used by setIncDecButtonsMode().
@@ -285,17 +288,17 @@ public:
/** Returns the status of the text-box. /** Returns the status of the text-box.
@see setTextBoxStyle @see setTextBoxStyle
*/ */
const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
const TextEntryBoxPosition getTextBoxPosition() const throw() { return textBoxPos; }
/** Returns the width used for the text-box. /** Returns the width used for the text-box.
@see setTextBoxStyle @see setTextBoxStyle
*/ */
int getTextBoxWidth() const { return textBoxWidth; }
int getTextBoxWidth() const throw() { return textBoxWidth; }
/** Returns the height used for the text-box. /** Returns the height used for the text-box.
@see setTextBoxStyle @see setTextBoxStyle
*/ */
int getTextBoxHeight() const { return textBoxHeight; }
int getTextBoxHeight() const throw() { return textBoxHeight; }
/** Makes the text-box editable. /** Makes the text-box editable.
@@ -403,7 +406,7 @@ public:
your own Value object. your own Value object.
@see Value, getMinValue, getMaxValueObject @see Value, getMinValue, getMaxValueObject
*/ */
Value& getMinValueObject() { return valueMin; }
Value& getMinValueObject() throw() { return valueMin; }
/** For a slider with two or three thumbs, this sets the lower of its values. /** For a slider with two or three thumbs, this sets the lower of its values.
@@ -445,7 +448,7 @@ public:
your own Value object. your own Value object.
@see Value, getMaxValue, getMinValueObject @see Value, getMaxValue, getMinValueObject
*/ */
Value& getMaxValueObject() { return valueMax; }
Value& getMaxValueObject() throw() { return valueMax; }
/** For a slider with two or three thumbs, this sets the lower of its values. /** For a slider with two or three thumbs, this sets the lower of its values.
@@ -601,7 +604,7 @@ public:
This will return 0 for the main thumb, 1 for the minimum-value thumb, 2 for This will return 0 for the main thumb, 1 for the minimum-value thumb, 2 for
the maximum-value thumb, or -1 if none is currently down. the maximum-value thumb, or -1 if none is currently down.
*/ */
int getThumbBeingDragged() const { return sliderBeingDragged; }
int getThumbBeingDragged() const throw() { return sliderBeingDragged; }
//============================================================================== //==============================================================================
/** Callback to indicate that the user is about to start dragging the slider. /** Callback to indicate that the user is about to start dragging the slider.


+ 11
- 22
src/gui/graphics/geometry/juce_RelativeCoordinate.cpp View File

@@ -160,11 +160,7 @@ bool RelativeCoordinate::references (const String& coordName, const Expression::
{ {
try try
{ {
if (context != 0)
return term.referencesSymbol (coordName, *context);
Expression::EvaluationContext defaultContext;
return term.referencesSymbol (coordName, defaultContext);
return term.referencesSymbol (coordName, context);
} }
catch (...) catch (...)
{} {}
@@ -182,18 +178,12 @@ const String RelativeCoordinate::toString() const
return term.toString(); return term.toString();
} }
void RelativeCoordinate::renameSymbolIfUsed (const String& oldName, const String& newName,
const Expression::EvaluationContext* context)
void RelativeCoordinate::renameSymbolIfUsed (const String& oldName, const String& newName)
{ {
jassert (newName.isNotEmpty() && newName.toLowerCase().containsOnly ("abcdefghijklmnopqrstuvwxyz0123456789_")); jassert (newName.isNotEmpty() && newName.toLowerCase().containsOnly ("abcdefghijklmnopqrstuvwxyz0123456789_"));
if (term.referencesSymbol (oldName, *context))
{
const double oldValue = resolve (context);
if (term.referencesSymbol (oldName, 0))
term = term.withRenamedSymbol (oldName, newName); term = term.withRenamedSymbol (oldName, newName);
moveToAbsolute (oldValue, context);
}
} }
//============================================================================== //==============================================================================
@@ -251,10 +241,10 @@ const String RelativePoint::toString() const
return x.toString() + ", " + y.toString(); return x.toString() + ", " + y.toString();
} }
void RelativePoint::renameSymbolIfUsed (const String& oldName, const String& newName, const Expression::EvaluationContext* context)
void RelativePoint::renameSymbolIfUsed (const String& oldName, const String& newName)
{ {
x.renameSymbolIfUsed (oldName, newName, context);
y.renameSymbolIfUsed (oldName, newName, context);
x.renameSymbolIfUsed (oldName, newName);
y.renameSymbolIfUsed (oldName, newName);
} }
bool RelativePoint::isDynamic() const bool RelativePoint::isDynamic() const
@@ -327,13 +317,12 @@ const String RelativeRectangle::toString() const
return left.toString() + ", " + top.toString() + ", " + right.toString() + ", " + bottom.toString(); return left.toString() + ", " + top.toString() + ", " + right.toString() + ", " + bottom.toString();
} }
void RelativeRectangle::renameSymbolIfUsed (const String& oldName, const String& newName,
const Expression::EvaluationContext* context)
void RelativeRectangle::renameSymbolIfUsed (const String& oldName, const String& newName)
{ {
left.renameSymbolIfUsed (oldName, newName, context);
right.renameSymbolIfUsed (oldName, newName, context);
top.renameSymbolIfUsed (oldName, newName, context);
bottom.renameSymbolIfUsed (oldName, newName, context);
left.renameSymbolIfUsed (oldName, newName);
right.renameSymbolIfUsed (oldName, newName);
top.renameSymbolIfUsed (oldName, newName);
bottom.renameSymbolIfUsed (oldName, newName);
} }


+ 6
- 15
src/gui/graphics/geometry/juce_RelativeCoordinate.h View File

@@ -100,15 +100,8 @@ public:
*/ */
void moveToAbsolute (double absoluteTargetPosition, const Expression::EvaluationContext* evaluationContext); void moveToAbsolute (double absoluteTargetPosition, const Expression::EvaluationContext* evaluationContext);
/** Tells the coordinate that an object is changing its name or being deleted.
If either of this coordinates anchor points match this name, they will be replaced.
If the newName string is empty, it indicates that the object is being removed, so if
this coordinate was using it, the coordinate is changed to be relative to the origin
instead.
*/
void renameSymbolIfUsed (const String& oldName, const String& newName,
const Expression::EvaluationContext* evaluationContext);
/** Changes the name of a symbol if it is used as part of the coordinate's expression. */
void renameSymbolIfUsed (const String& oldName, const String& newName);
/** Returns the expression that defines this coordinate. */ /** Returns the expression that defines this coordinate. */
const Expression& getExpression() const { return term; } const Expression& getExpression() const { return term; }
@@ -200,11 +193,10 @@ public:
*/ */
const String toString() const; const String toString() const;
/** Tells the point that an object is changing its name or being deleted.
/** Renames a symbol if it is used by any of the coordinates.
This calls RelativeCoordinate::renameAnchorIfUsed() on its X and Y coordinates. This calls RelativeCoordinate::renameAnchorIfUsed() on its X and Y coordinates.
*/ */
void renameSymbolIfUsed (const String& oldName, const String& newName,
const Expression::EvaluationContext* evaluationContext);
void renameSymbolIfUsed (const String& oldName, const String& newName);
/** Returns true if this point depends on any other coordinates for its position. */ /** Returns true if this point depends on any other coordinates for its position. */
bool isDynamic() const; bool isDynamic() const;
@@ -270,11 +262,10 @@ public:
*/ */
const String toString() const; const String toString() const;
/** Tells the rectangle that an object is changing its name or being deleted.
/** Renames a symbol if it is used by any of the coordinates.
This calls RelativeCoordinate::renameSymbolIfUsed() on the rectangle's coordinates. This calls RelativeCoordinate::renameSymbolIfUsed() on the rectangle's coordinates.
*/ */
void renameSymbolIfUsed (const String& oldName, const String& newName,
const Expression::EvaluationContext* evaluationContext);
void renameSymbolIfUsed (const String& oldName, const String& newName);
// The actual rectangle coords... // The actual rectangle coords...
RelativeCoordinate left, right, top, bottom; RelativeCoordinate left, right, top, bottom;


+ 4
- 2
src/native/mac/juce_mac_Files.mm View File

@@ -234,7 +234,8 @@ const File File::getLinkedTarget() const
NSString* dest = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath: juceStringToNS (getFullPathName()) error: nil]; NSString* dest = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath: juceStringToNS (getFullPathName()) error: nil];
#else #else
NSString* dest = [[NSFileManager defaultManager] pathContentOfSymbolicLinkAtPath: juceStringToNS (getFullPathName())];
// (the cast here avoids a deprecation warning)
NSString* dest = [((id) [NSFileManager defaultManager]) pathContentOfSymbolicLinkAtPath: juceStringToNS (getFullPathName())];
#endif #endif
if (dest != nil) if (dest != nil)
@@ -451,7 +452,8 @@ OSType PlatformUtilities::getTypeOfFile (const String& filename)
#if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5) #if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5)
NSDictionary* fileDict = [[NSFileManager defaultManager] attributesOfItemAtPath: juceStringToNS (filename) error: nil]; NSDictionary* fileDict = [[NSFileManager defaultManager] attributesOfItemAtPath: juceStringToNS (filename) error: nil];
#else #else
NSDictionary* fileDict = [[NSFileManager defaultManager] fileAttributesAtPath: juceStringToNS (filename) traverseLink: NO];
// (the cast here avoids a deprecation warning)
NSDictionary* fileDict = [((id) [NSFileManager defaultManager]) fileAttributesAtPath: juceStringToNS (filename) traverseLink: NO];
#endif #endif
return [fileDict fileHFSTypeCode]; return [fileDict fileHFSTypeCode];


+ 1
- 2
src/native/windows/juce_win32_Windowing.cpp View File

@@ -1211,8 +1211,7 @@ private:
{ {
if (rects->right <= x + w && rects->bottom <= y + h) if (rects->right <= x + w && rects->bottom <= y + h)
{ {
// (need to move this one pixel to the left because of a win32 bug)
const int cx = jmax (x, (int) rects->left - 1);
const int cx = jmax (x, (int) rects->left);
contextClip.addWithoutMerging (Rectangle<int> (cx - x, rects->top - y, rects->right - cx, rects->bottom - rects->top) contextClip.addWithoutMerging (Rectangle<int> (cx - x, rects->top - y, rects->right - cx, rects->bottom - rects->top)
.getIntersection (clipBounds)); .getIntersection (clipBounds));
} }


Loading…
Cancel
Save