diff --git a/build/linux/platform_specific_code/juce_linux_Windowing.cpp b/build/linux/platform_specific_code/juce_linux_Windowing.cpp index 3cf34c4d31..d89e2f0fd8 100644 --- a/build/linux/platform_specific_code/juce_linux_Windowing.cpp +++ b/build/linux/platform_specific_code/juce_linux_Windowing.cpp @@ -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; diff --git a/build/macosx/platform_specific_code/juce_mac_Windowing.cpp b/build/macosx/platform_specific_code/juce_mac_Windowing.cpp index 2d973944b0..146fc501f6 100644 --- a/build/macosx/platform_specific_code/juce_mac_Windowing.cpp +++ b/build/macosx/platform_specific_code/juce_mac_Windowing.cpp @@ -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; diff --git a/build/win32/platform_specific_code/juce_win32_Windowing.cpp b/build/win32/platform_specific_code/juce_win32_Windowing.cpp index 90af4f1f80..cd5d066116 100644 --- a/build/win32/platform_specific_code/juce_win32_Windowing.cpp +++ b/build/win32/platform_specific_code/juce_win32_Windowing.cpp @@ -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; diff --git a/src/juce_appframework/audio/dsp/juce_AudioSampleBuffer.cpp b/src/juce_appframework/audio/dsp/juce_AudioSampleBuffer.cpp index 056fcf628b..c3c5e2004b 100644 --- a/src/juce_appframework/audio/dsp/juce_AudioSampleBuffer.cpp +++ b/src/juce_appframework/audio/dsp/juce_AudioSampleBuffer.cpp @@ -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, diff --git a/src/juce_appframework/audio/dsp/juce_AudioSampleBuffer.h b/src/juce_appframework/audio/dsp/juce_AudioSampleBuffer.h index 0e084bba35..eaae3a1f7b 100644 --- a/src/juce_appframework/audio/dsp/juce_AudioSampleBuffer.h +++ b/src/juce_appframework/audio/dsp/juce_AudioSampleBuffer.h @@ -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 diff --git a/src/juce_appframework/gui/components/buttons/juce_Button.cpp b/src/juce_appframework/gui/components/buttons/juce_Button.cpp index 4ef61084db..cd1574691c 100644 --- a/src/juce_appframework/gui/components/buttons/juce_Button.cpp +++ b/src/juce_appframework/gui/components/buttons/juce_Button.cpp @@ -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()) { diff --git a/src/juce_appframework/gui/components/buttons/juce_Button.h b/src/juce_appframework/gui/components/buttons/juce_Button.h index ed710c33fb..265c39348f 100644 --- a/src/juce_appframework/gui/components/buttons/juce_Button.h +++ b/src/juce_appframework/gui/components/buttons/juce_Button.h @@ -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(); diff --git a/src/juce_appframework/gui/components/keyboard/juce_KeyPress.cpp b/src/juce_appframework/gui/components/keyboard/juce_KeyPress.cpp index a0d091941e..dd57766eba 100644 --- a/src/juce_appframework/gui/components/keyboard/juce_KeyPress.cpp +++ b/src/juce_appframework/gui/components/keyboard/juce_KeyPress.cpp @@ -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 diff --git a/src/juce_appframework/gui/components/keyboard/juce_KeyPress.h b/src/juce_appframework/gui/components/keyboard/juce_KeyPress.h index 97b5e9b08f..ebc630221f 100644 --- a/src/juce_appframework/gui/components/keyboard/juce_KeyPress.h +++ b/src/juce_appframework/gui/components/keyboard/juce_KeyPress.h @@ -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