Browse Source

tags/2021-05-28
jules 18 years ago
parent
commit
f09113af53
9 changed files with 73 additions and 19 deletions
  1. +1
    -1
      build/linux/platform_specific_code/juce_linux_Windowing.cpp
  2. +1
    -1
      build/macosx/platform_specific_code/juce_mac_Windowing.cpp
  3. +1
    -1
      build/win32/platform_specific_code/juce_win32_Windowing.cpp
  4. +35
    -0
      src/juce_appframework/audio/dsp/juce_AudioSampleBuffer.cpp
  5. +18
    -0
      src/juce_appframework/audio/dsp/juce_AudioSampleBuffer.h
  6. +4
    -6
      src/juce_appframework/gui/components/buttons/juce_Button.cpp
  7. +2
    -2
      src/juce_appframework/gui/components/buttons/juce_Button.h
  8. +7
    -4
      src/juce_appframework/gui/components/keyboard/juce_KeyPress.cpp
  9. +4
    -4
      src/juce_appframework/gui/components/keyboard/juce_KeyPress.h

+ 1
- 1
build/linux/platform_specific_code/juce_linux_Windowing.cpp View File

@@ -253,7 +253,7 @@ static bool keyDown (const int keycode) throw()
static const int extendedKeyModifier = 0x10000000;
bool KeyPress::isKeyCurrentlyDown (int keyCode)
bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw()
{
int keysym;


+ 1
- 1
build/macosx/platform_specific_code/juce_mac_Windowing.cpp View File

@@ -72,7 +72,7 @@ static ComponentPeer* juce_currentMouseTrackingPeer = 0;
//==============================================================================
static VoidArray keysCurrentlyDown;

bool KeyPress::isKeyCurrentlyDown (int keyCode)
bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw()
{
if (keysCurrentlyDown.contains ((void*) keyCode))
return true;


+ 1
- 1
build/win32/platform_specific_code/juce_win32_Windowing.cpp View File

@@ -443,7 +443,7 @@ void ModifierKeys::updateCurrentModifiers()
currentModifierFlags = currentModifiers;
}
bool KeyPress::isKeyCurrentlyDown (int keyCode)
bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw()
{
SHORT k = (SHORT) keyCode;


+ 35
- 0
src/juce_appframework/audio/dsp/juce_AudioSampleBuffer.cpp View File

@@ -346,6 +346,41 @@ void AudioSampleBuffer::addFrom (const int destChannel,
}
}
void AudioSampleBuffer::addFromWithRamp (const int destChannel,
const int destStartSample,
const float* source,
int numSamples,
float startGain,
const float endGain) throw()
{
jassert (destChannel >= 0 && destChannel < numChannels);
jassert (destStartSample >= 0 && destStartSample + numSamples <= size);
jassert (source != 0);
if (startGain == endGain)
{
addFrom (destChannel,
destStartSample,
source,
numSamples,
startGain);
}
else
{
if (numSamples > 0 && (startGain != 0.0f || endGain != 0.0f))
{
const float increment = (endGain - startGain) / numSamples;
float* d = channels [destChannel] + destStartSample;
while (--numSamples >= 0)
{
*d++ += startGain * *source++;
startGain += increment;
}
}
}
}
void AudioSampleBuffer::copyFrom (const int destChannel,
const int destStartSample,
const AudioSampleBuffer& source,


+ 18
- 0
src/juce_appframework/audio/dsp/juce_AudioSampleBuffer.h View File

@@ -230,6 +230,24 @@ public:
int numSamples,
const float gainToApplyToSource = 1.0f) throw();
/** Adds samples from an array of floats, applying a gain ramp to them.
@param destChannel the channel within this buffer to add the samples to
@param destStartSample the start sample within this buffer's channel
@param source the source data to use
@param numSamples the number of samples to process
@param startGain the gain to apply to the first sample (this is multiplied with
the source samples before they are added to this buffer)
@param endGain the gain to apply to the final sample. The gain is linearly
interpolated between the first and last samples.
*/
void addFromWithRamp (const int destChannel,
const int destStartSample,
const float* source,
int numSamples,
float startGain,
float endGain) throw();
/** Copies samples from another buffer to this one.
@param destChannel the channel within this buffer to copy the samples to


+ 4
- 6
src/juce_appframework/gui/components/buttons/juce_Button.cpp View File

@@ -72,9 +72,7 @@ Button::~Button()
if (commandManagerToUse != 0)
commandManagerToUse->removeListener (this);
if (repeatTimer != 0)
delete repeatTimer;
delete repeatTimer;
clearShortcuts();
}
@@ -104,7 +102,7 @@ const String Button::getTooltip()
for (int i = 0; i < keyPresses.size(); ++i)
{
String key (keyPresses.getUnchecked(i).getTextDescription());
const String key (keyPresses.getUnchecked(i).getTextDescription());
if (key.length() == 1)
tt << " [shortcut: '" << key << "']";
@@ -118,7 +116,7 @@ const String Button::getTooltip()
return SettableTooltipClient::getTooltip();
}
void Button::setConnectedEdges (const int connectedEdgeFlags_)
void Button::setConnectedEdges (const int connectedEdgeFlags_) throw()
{
if (connectedEdgeFlags != connectedEdgeFlags_)
{
@@ -580,7 +578,7 @@ void Button::clearShortcuts()
parentHierarchyChanged();
}
bool Button::isShortcutPressed() const
bool Button::isShortcutPressed() const throw()
{
if (! isCurrentlyBlockedByAnotherModalComponent())
{


+ 2
- 2
src/juce_appframework/gui/components/buttons/juce_Button.h View File

@@ -332,7 +332,7 @@ public:
LookAndFeel can choose to ignore it if it's not relevent for this type of
button.
*/
void setConnectedEdges (const int connectedEdgeFlags);
void setConnectedEdges (const int connectedEdgeFlags) throw();
/** Returns the set of flags passed into setConnectedEdges(). */
int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; }
@@ -491,7 +491,7 @@ private:
Timer& getRepeatTimer() throw();
ButtonState updateState (const MouseEvent* const e) throw();
bool isShortcutPressed() const;
bool isShortcutPressed() const throw();
void turnOffOtherButtonsInGroup (const bool sendChangeNotification);
void flashButtonState() throw();


+ 7
- 4
src/juce_appframework/gui/components/keyboard/juce_KeyPress.cpp View File

@@ -94,9 +94,11 @@ bool KeyPress::operator!= (const KeyPress& other) const throw()
return ! operator== (other);
}
bool KeyPress::isCurrentlyDown() const
bool KeyPress::isCurrentlyDown() const throw()
{
int modsMask = ModifierKeys::commandModifier | ModifierKeys::ctrlModifier | ModifierKeys::altModifier;
int modsMask = ModifierKeys::commandModifier
| ModifierKeys::ctrlModifier
| ModifierKeys::altModifier;
if (keyCode == KeyPress::downKey
|| keyCode == KeyPress::upKey
@@ -153,7 +155,7 @@ static const KeyNameAndCode keyNameTranslations[] =
static const tchar* const numberPadPrefix = T("numpad ");
//==============================================================================
const KeyPress KeyPress::createFromDescription (const String& desc)
const KeyPress KeyPress::createFromDescription (const String& desc) throw()
{
int modifiers = 0;
@@ -238,7 +240,7 @@ const KeyPress KeyPress::createFromDescription (const String& desc)
return KeyPress (key, ModifierKeys (modifiers), 0);
}
const String KeyPress::getTextDescription() const
const String KeyPress::getTextDescription() const throw()
{
String desc;
@@ -294,4 +296,5 @@ const String KeyPress::getTextDescription() const
return desc;
}
END_JUCE_NAMESPACE

+ 4
- 4
src/juce_appframework/gui/components/keyboard/juce_KeyPress.h View File

@@ -143,7 +143,7 @@ public:
@see getTextDescription
*/
static const KeyPress createFromDescription (const String& textVersion);
static const KeyPress createFromDescription (const String& textVersion) throw();
/** Creates a textual description of the key combination.
@@ -152,7 +152,7 @@ public:
To store a keypress in a file, use this method, along with createFromDescription()
to retrieve it later.
*/
const String getTextDescription() const;
const String getTextDescription() const throw();
//==============================================================================
/** Checks whether the user is currently holding down the keys that make up this
@@ -162,14 +162,14 @@ public:
down - e.g. if the keypress is CTRL+X and the user is actually holding CTRL+ALT+x
then it will be false.
*/
bool isCurrentlyDown() const;
bool isCurrentlyDown() const throw();
/** Checks whether a particular key is held down, irrespective of modifiers.
The values for key codes can either be one of the special constants defined in
this class, or an 8-bit character code.
*/
static bool isKeyCurrentlyDown (int keyCode);
static bool isKeyCurrentlyDown (int keyCode) throw();
//==============================================================================
// Key codes


Loading…
Cancel
Save