Browse Source

Fixed a type in AudioSampleBuffer::copyFrom. Added a LookAndFeel::getMouseCursorFor method. Added a parameter to MidiMessage::isNoteOff

tags/2021-05-28
Julian Storer 16 years ago
parent
commit
03b54862c5
9 changed files with 67 additions and 34 deletions
  1. +24
    -15
      juce_amalgamated.cpp
  2. +8
    -2
      juce_amalgamated.h
  3. +10
    -3
      src/audio/dsp/juce_AudioSampleBuffer.cpp
  4. +2
    -2
      src/audio/midi/juce_MidiMessage.cpp
  5. +3
    -2
      src/audio/midi/juce_MidiMessage.h
  6. +1
    -1
      src/gui/components/juce_Component.cpp
  7. +6
    -0
      src/gui/components/lookandfeel/juce_LookAndFeel.cpp
  8. +6
    -0
      src/gui/components/lookandfeel/juce_LookAndFeel.h
  9. +7
    -9
      src/gui/components/mouse/juce_MouseCursor.cpp

+ 24
- 15
juce_amalgamated.cpp View File

@@ -25436,14 +25436,21 @@ void AudioSampleBuffer::copyFrom (const int destChannel,
jassert (destStartSample >= 0 && destStartSample + numSamples <= size);
jassert (source != 0);

if (numSamples > 0 && gain != 0)
if (numSamples > 0)
{
float* d = channels [destChannel] + destStartSample;

if (gain != 1.0f)
{
while (--numSamples >= 0)
*d++ = gain * *source++;
if (gain == 0)
{
zeromem (d, sizeof (float) * numSamples);
}
else
{
while (--numSamples >= 0)
*d++ = gain * *source++;
}
}
else
{
@@ -27082,10 +27089,10 @@ bool MidiMessage::isNoteOn (const bool returnTrueForVelocity0) const throw()
&& (returnTrueForVelocity0 || data[2] != 0);
}

bool MidiMessage::isNoteOff() const throw()
bool MidiMessage::isNoteOff (const bool returnTrueForNoteOnVelocity0) const throw()
{
return ((data[0] & 0xf0) == 0x80)
|| ((data[2] == 0) && ((data[0] & 0xf0) == 0x90));
|| (returnTrueForNoteOnVelocity0 && (data[2] == 0) && ((data[0] & 0xf0) == 0x90));
}

bool MidiMessage::isNoteOnOrOff() const throw()
@@ -39475,7 +39482,7 @@ void Component::internalUpdateMouseCursor (bool forcedUpdate) throw()

if (peer != 0)
{
MouseCursor mc (getMouseCursor());
MouseCursor mc (getLookAndFeel().getMouseCursorFor (*this));

if (isUnboundedMouseModeOn && (unboundedMouseOffsetX != 0
|| unboundedMouseOffsetY != 0
@@ -63798,6 +63805,11 @@ void LookAndFeel::setDefaultSansSerifTypefaceName (const String& newName)
defaultSans = newName;
}

const MouseCursor LookAndFeel::getMouseCursorFor (Component& component)
{
return component.getMouseCursor();
}

void LookAndFeel::drawButtonBackground (Graphics& g,
Button& button,
const Colour& backgroundColour,
@@ -70083,15 +70095,12 @@ void MouseCursor::showWaitCursor() throw()

void MouseCursor::hideWaitCursor() throw()
{
if (Component::getComponentUnderMouse()->isValidComponent())
{
Component::getComponentUnderMouse()->getMouseCursor().showInAllWindows();
}
else
{
const MouseCursor mc (MouseCursor::NormalCursor);
mc.showInAllWindows();
}
Component* const c = Component::getComponentUnderMouse();

MouseCursor mc (c->isValidComponent() ? c->getLookAndFeel().getMouseCursorFor (*c)
: MouseCursor::NormalCursor);

mc.showInAllWindows();
}

END_JUCE_NAMESPACE


+ 8
- 2
juce_amalgamated.h View File

@@ -25851,11 +25851,12 @@ public:

/** Returns true if this message is a 'key-up' event.

This will also return true for a note-on event with a velocity of 0.
If returnTrueForNoteOnVelocity0 is true, then his will also return true
for a note-on event with a velocity of 0.

@see isNoteOn, getNoteNumber, getVelocity, noteOff
*/
bool isNoteOff() const throw();
bool isNoteOff (const bool returnTrueForNoteOnVelocity0 = true) const throw();

/** Creates a key-up message.

@@ -54756,6 +54757,11 @@ public:
*/
void setDefaultSansSerifTypefaceName (const String& newName);

/** Override this to get the chance to swap a component's mouse cursor for a
customised one.
*/
virtual const MouseCursor getMouseCursorFor (Component& component);

/** Draws the lozenge-shaped background for a standard button. */
virtual void drawButtonBackground (Graphics& g,
Button& button,


+ 10
- 3
src/audio/dsp/juce_AudioSampleBuffer.cpp View File

@@ -454,14 +454,21 @@ void AudioSampleBuffer::copyFrom (const int destChannel,
jassert (destStartSample >= 0 && destStartSample + numSamples <= size);
jassert (source != 0);
if (numSamples > 0 && gain != 0)
if (numSamples > 0)
{
float* d = channels [destChannel] + destStartSample;
if (gain != 1.0f)
{
while (--numSamples >= 0)
*d++ = gain * *source++;
if (gain == 0)
{
zeromem (d, sizeof (float) * numSamples);
}
else
{
while (--numSamples >= 0)
*d++ = gain * *source++;
}
}
else
{


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

@@ -310,10 +310,10 @@ bool MidiMessage::isNoteOn (const bool returnTrueForVelocity0) const throw()
&& (returnTrueForVelocity0 || data[2] != 0);
}
bool MidiMessage::isNoteOff() const throw()
bool MidiMessage::isNoteOff (const bool returnTrueForNoteOnVelocity0) const throw()
{
return ((data[0] & 0xf0) == 0x80)
|| ((data[2] == 0) && ((data[0] & 0xf0) == 0x90));
|| (returnTrueForNoteOnVelocity0 && (data[2] == 0) && ((data[0] & 0xf0) == 0x90));
}
bool MidiMessage::isNoteOnOrOff() const throw()


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

@@ -241,11 +241,12 @@ public:
/** Returns true if this message is a 'key-up' event.
This will also return true for a note-on event with a velocity of 0.
If returnTrueForNoteOnVelocity0 is true, then his will also return true
for a note-on event with a velocity of 0.
@see isNoteOn, getNoteNumber, getVelocity, noteOff
*/
bool isNoteOff() const throw();
bool isNoteOff (const bool returnTrueForNoteOnVelocity0 = true) const throw();
/** Creates a key-up message.


+ 1
- 1
src/gui/components/juce_Component.cpp View File

@@ -1619,7 +1619,7 @@ void Component::internalUpdateMouseCursor (bool forcedUpdate) throw()
if (peer != 0)
{
MouseCursor mc (getMouseCursor());
MouseCursor mc (getLookAndFeel().getMouseCursorFor (*this));
if (isUnboundedMouseModeOn && (unboundedMouseOffsetX != 0
|| unboundedMouseOffsetY != 0


+ 6
- 0
src/gui/components/lookandfeel/juce_LookAndFeel.cpp View File

@@ -335,6 +335,12 @@ void LookAndFeel::setDefaultSansSerifTypefaceName (const String& newName)
defaultSans = newName;
}
//==============================================================================
const MouseCursor LookAndFeel::getMouseCursorFor (Component& component)
{
return component.getMouseCursor();
}
//==============================================================================
void LookAndFeel::drawButtonBackground (Graphics& g,
Button& button,


+ 6
- 0
src/gui/components/lookandfeel/juce_LookAndFeel.h View File

@@ -139,6 +139,12 @@ public:
*/
void setDefaultSansSerifTypefaceName (const String& newName);
//==============================================================================
/** Override this to get the chance to swap a component's mouse cursor for a
customised one.
*/
virtual const MouseCursor getMouseCursorFor (Component& component);
//==============================================================================
/** Draws the lozenge-shaped background for a standard button. */
virtual void drawButtonBackground (Graphics& g,


+ 7
- 9
src/gui/components/mouse/juce_MouseCursor.cpp View File

@@ -29,6 +29,7 @@ BEGIN_JUCE_NAMESPACE
#include "juce_MouseCursor.h"
#include "../juce_Component.h"
#include "../lookandfeel/juce_LookAndFeel.h"
#include "../../../threads/juce_ScopedLock.h"
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) throw();
@@ -185,15 +186,12 @@ void MouseCursor::showWaitCursor() throw()
void MouseCursor::hideWaitCursor() throw()
{
if (Component::getComponentUnderMouse()->isValidComponent())
{
Component::getComponentUnderMouse()->getMouseCursor().showInAllWindows();
}
else
{
const MouseCursor mc (MouseCursor::NormalCursor);
mc.showInAllWindows();
}
Component* const c = Component::getComponentUnderMouse();
MouseCursor mc (c->isValidComponent() ? c->getLookAndFeel().getMouseCursorFor (*c)
: MouseCursor::NormalCursor);
mc.showInAllWindows();
}
END_JUCE_NAMESPACE

Loading…
Cancel
Save