├── .gitignore ├── LICENSE ├── README.md ├── components ├── hack_audio_Button.cpp ├── hack_audio_Button.h ├── hack_audio_Graph.cpp ├── hack_audio_Graph.h ├── hack_audio_Label.cpp ├── hack_audio_Label.h ├── hack_audio_Meter.cpp ├── hack_audio_Meter.h ├── hack_audio_Selector.cpp ├── hack_audio_Selector.h ├── hack_audio_Slider.cpp └── hack_audio_Slider.h ├── diagrams ├── effects │ ├── hack_audio_DattorroReverb.h │ ├── hack_audio_EarlyReflections.h │ ├── hack_audio_FDNReverb.h │ ├── hack_audio_GardnerlargeReverb.h │ ├── hack_audio_GardnermediumReverb.h │ ├── hack_audio_GardnersmallReverb.h │ ├── hack_audio_MoorerReverb.h │ └── hack_audio_SchroederReverb.h ├── filters │ ├── hack_audio_AllpassFilter.h │ ├── hack_audio_BiquadFilter.h │ ├── hack_audio_CombFilter.h │ ├── hack_audio_DampingFilter.h │ ├── hack_audio_LPCombFilter.h │ ├── hack_audio_NestedallpassFilter.h │ └── hack_audio_NestedtwoFilter.h ├── hack_audio_Diagrams.h └── utils │ ├── hack_audio_Gain.h │ ├── hack_audio_Moddelay.h │ └── hack_audio_preDelay.h ├── docs ├── baumans │ └── LICENSE ├── img │ ├── add-module.png │ ├── background.svg │ ├── button.svg │ ├── clone-module.png │ ├── knob.svg │ ├── meter.svg │ └── slider.svg ├── index.css ├── index.html └── now │ └── LICENSE ├── hack_audio_gui.cpp ├── hack_audio_gui.h ├── hack_audio_gui.mm ├── layout ├── hack_audio_Diagram.cpp ├── hack_audio_Diagram.h ├── hack_audio_FlexBox.cpp ├── hack_audio_FlexBox.h ├── hack_audio_Viewport.cpp └── hack_audio_Viewport.h └── utils ├── hack_audio_Colours.cpp ├── hack_audio_Colours.h ├── hack_audio_FontData.cpp ├── hack_audio_Fonts.cpp ├── hack_audio_Fonts.h ├── hack_audio_NavigationButton.h └── hack_audio_TextFormatting.h /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | 3 | hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HackAudio GUI 2 | 3 | This module provides the custom GUI components used in HackAudio software. 4 | 5 | ## Installation 6 | 7 | Simply clone this repository into the `modules` folder of your JUCE installation, and include the module in your JUCE projects using the Projucer! 8 | 9 | ![](docs/img/clone-module.png) 10 | 11 | ![](docs/img/add-module.png) 12 | 13 | ## Features 14 | 15 | HackAudio GUI customizes the following JUCE components: 16 | - Sliders 17 | - Toggle Buttons 18 | - Labels 19 | 20 | While adding the following new components: 21 | - Selectors 22 | - Viewport/Diagrams 23 | - Meters 24 | 25 | Check the wiki for full documentation! 26 | 27 | ## Requirements 28 | 29 | This module requires at least JUCE v4.0 to be used. 30 | 31 | ## License 32 | 33 | Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 34 | 35 | hack_audio_gui is provided under the terms of The MIT License (MIT): 36 | 37 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 38 | 39 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 40 | 41 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 42 | 43 | 44 | ### Fonts 45 | 46 | This software contains embedded fonts [Now](docs/now/LICENSE) and [Baumans](docs/baumans/LICENSE), whose licenses are located within the [docs](docs/) folder. 47 | -------------------------------------------------------------------------------- /components/hack_audio_Button.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_BUTTON_H 25 | #define HACK_AUDIO_BUTTON_H 26 | 27 | namespace HackAudio 28 | { 29 | 30 | /** 31 | A custom button using the juce::Button API 32 | */ 33 | class Button : public juce::Button, 34 | private juce::Timer 35 | { 36 | public: 37 | 38 | Button(); 39 | ~Button(); 40 | 41 | /** 42 | The available HackAudio::Button styles 43 | */ 44 | enum ButtonStyle 45 | { 46 | Bar, /**< A square button that sends singleton messages when pressed */ 47 | BarToggle, /**< A toggle button that saves its state */ 48 | SlidingToggle /**< A toggle button that emulates a sliding toggle switch */ 49 | }; 50 | 51 | /** 52 | A char* wrapper for juce::Button::setButtonText() 53 | */ 54 | void setButtonText(const char* newText); 55 | 56 | /** 57 | Sets the button's current style 58 | 59 | @see ButtonStyle 60 | */ 61 | void setButtonStyle(ButtonStyle style); 62 | 63 | /** 64 | Return the button's current style 65 | 66 | @see ButtonStyle 67 | */ 68 | ButtonStyle getButtonStyle() const; 69 | 70 | /** 71 | Sets the button's font style 72 | */ 73 | void setFont(juce::Font font); 74 | 75 | /** 76 | Return the button's current font 77 | */ 78 | juce::Font getFont() const; 79 | 80 | private: 81 | 82 | void mouseMove(const juce::MouseEvent& e) override; 83 | void mouseDown(const juce::MouseEvent& e) override; 84 | void mouseDrag(const juce::MouseEvent& e) override; 85 | void mouseUp (const juce::MouseEvent& e) override; 86 | 87 | bool keyPressed(const juce::KeyPress& key) override; 88 | 89 | void focusGained(juce::Component::FocusChangeType cause) override; 90 | void focusLost (juce::Component::FocusChangeType cause) override; 91 | 92 | void enablementChanged() override; 93 | 94 | void timerCallback() override; 95 | 96 | void paintButton(juce::Graphics& g, bool isMouseOverButton, bool isButtonDown) override; 97 | 98 | void resized() override; 99 | 100 | float animationAcc; 101 | float animationVel; 102 | juce::Point animationStart; 103 | juce::Point animationEnd; 104 | 105 | juce::LinearSmoothedValue colourInterpolation; 106 | 107 | bool resizeGuard; 108 | juce::Rectangle thumbArea; 109 | juce::Rectangle trackArea; 110 | juce::Rectangle indicatorArea; 111 | 112 | bool isDraggable; 113 | bool wasFocusedByTab; 114 | 115 | juce::Font buttonFont; 116 | 117 | ButtonStyle buttonStyle; 118 | 119 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Button) 120 | 121 | }; 122 | 123 | } 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /components/hack_audio_Label.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_LABEL_H 25 | #define HACK_AUDIO_LABEL_H 26 | 27 | namespace HackAudio 28 | { 29 | 30 | /** 31 | A custom label using the juce::Label API that also supports pre/post-fixes and text formatting 32 | */ 33 | class Label : public juce::Label, 34 | private juce::Label::Listener, 35 | private juce::MultiTimer 36 | { 37 | 38 | friend class Diagram; 39 | 40 | public: 41 | 42 | Label(); 43 | ~Label(); 44 | 45 | /** 46 | A wrapper for juce::Label::setText allowing for non-UTF8 characters 47 | 48 | CAVEAT: Will not work on label pointers, pointers will call base class function instead 49 | */ 50 | void setText(const char* newText, juce::NotificationType notification); 51 | void setText(const juce::String newText, juce::NotificationType notification); 52 | 53 | /** 54 | Sets the prefix that should always display before the label text 55 | 56 | @param preText the text to append before the label's main text 57 | @param notificationType whether to send a change message to any Label::Listener objects 58 | */ 59 | void setPrefix(const char* preText, juce::NotificationType notificationType); 60 | void setPrefix(const juce::String preText, juce::NotificationType notificationType); 61 | 62 | /** 63 | Returns the label's current prefix string 64 | */ 65 | juce::String getPrefix() const; 66 | 67 | /** 68 | Sets the postfix that should always display after the label text 69 | 70 | @param postText the text to append before the label's main text 71 | @param notificationType whether to send a change message to any Label::Listener objects 72 | */ 73 | void setPostfix(const char* postText, juce::NotificationType notificationType); 74 | void setPostfix(const juce::String postText, juce::NotificationType notificationType); 75 | 76 | /** 77 | Returns the label's current postfix string 78 | */ 79 | juce::String getPostfix() const; 80 | 81 | /** 82 | Sets the text that displays automatically. When setting new text with animation enabled, the new text will display during the animation and then revert to the placeholder text after the animation completes 83 | 84 | @param placeholderText the text to show before and after animation 85 | @param notificationType whether to send a change message to any Label::Listener objects 86 | */ 87 | void setPlaceholder(const char* placeholderText); 88 | void setPlaceholder(const juce::String placeholderText); 89 | 90 | /** 91 | Turns the placeholder text feature on or off. This is set to true whenever setPlaceholder() is called 92 | */ 93 | void setPlaceholderStatus(bool shouldShowPlaceholder); 94 | 95 | /** 96 | Returns the current placeholder text that the label shows before and after animations. Note that the actual current text is still accessible via getText() 97 | */ 98 | juce::String getPlaceholder() const; 99 | 100 | /** 101 | Toggles whether the label should animate when its text changes 102 | 103 | @param shouldAnimate determines whether to animate when setting the text, prefix, or postfix 104 | */ 105 | void setAnimationStatus(bool shouldAnimate); 106 | 107 | /** 108 | Returns the current animation status 109 | */ 110 | bool getAnimationStatus() const; 111 | 112 | /** 113 | Toggles whether or not the label should format its text (both placeholder and label text) 114 | 115 | The text formatting currently supports LaTeX style super and sub script (^ and _) with extended script using brackets (e.g. a^{bcd}) 116 | It also supports square matrix displays using the syntax: 117 | 118 | \\array 1 & 2 & 3 &// 4 & 5 & 6 \\end 119 | 120 | Where & denotes column delimiters and &// represents newlines 121 | 122 | */ 123 | void setFormattingStatus(bool shouldFormatText); 124 | 125 | /** 126 | Returns the current formatting status 127 | */ 128 | bool getFormattingStatus() const; 129 | 130 | private: 131 | 132 | enum timerIds 133 | { 134 | 135 | backgroundAnimation, 136 | foregroundAnimation 137 | 138 | }; 139 | 140 | void mouseEnter(const juce::MouseEvent& e) override; 141 | void mouseExit (const juce::MouseEvent& e) override; 142 | void mouseDown (const juce::MouseEvent& e) override; 143 | void mouseUp (const juce::MouseEvent& e) override; 144 | 145 | void labelTextChanged(juce::Label* labelThatHasChanged) override; 146 | 147 | void timerCallback(int timerID) override; 148 | 149 | void paint(juce::Graphics& g) override; 150 | 151 | juce::String prefix; 152 | juce::String postfix; 153 | juce::String placeholder; 154 | 155 | bool animationStatus; 156 | bool placeholderStatus; 157 | bool formattingStatus; 158 | bool highlightStatus; 159 | 160 | int timeout; 161 | 162 | juce::LinearSmoothedValue colourInterpolation; 163 | juce::LinearSmoothedValue backgroundInterpolation; 164 | 165 | juce::Rectangle textArea; 166 | 167 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Label) 168 | 169 | }; 170 | 171 | } 172 | 173 | #endif 174 | -------------------------------------------------------------------------------- /components/hack_audio_Meter.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_METER_H 25 | #define HACK_AUDIO_METER_H 26 | 27 | namespace HackAudio 28 | { 29 | 30 | /** 31 | A custom meter component used to measure audio signals 32 | */ 33 | class Meter : public juce::Component, 34 | private juce::Timer 35 | { 36 | public: 37 | 38 | /** 39 | The available HackAudio::Meter styles 40 | 41 | @see setMeterStyle 42 | */ 43 | enum MeterStyle 44 | { 45 | Vertical, /**< A vertically facing meter */ 46 | Horizontal /**< A horizontally facing meter */ 47 | }; 48 | 49 | /** 50 | Identifiers for easily setting meter calibration presets 51 | */ 52 | enum MeterCalibration 53 | { 54 | Peak, /**< Peak Program Meter (PPM), responds very quickly to the absolute digital levels of the audio signal */ 55 | RMS, /**< Root-Mean-Square (RMS), a display of the overall average level of the incoming signal */ 56 | VU, /**< Volume-Units (VU), based on specifications of analog VU meters where 0VU = +4 dBu */ 57 | Custom, /**< Custom is automatically assigned whenever meter attributes are manually set */ 58 | }; 59 | 60 | Meter(); 61 | ~Meter(); 62 | 63 | /** 64 | Sets the current style to display the meter in 65 | */ 66 | void setMeterStyle(MeterStyle style); 67 | 68 | /** 69 | Returns the current meter's style 70 | */ 71 | MeterStyle getMeterStyle() const; 72 | 73 | /** 74 | Sets the calibration for the meter based off a MeterCalibration preset 75 | */ 76 | void setMeterCalibration(MeterCalibration calibration); 77 | 78 | /** 79 | Returns the current meter calibration preset. If the meter has been calibrated by hand with the calibration methods, this will return MeterCalibration::Custom 80 | */ 81 | MeterCalibration getMeterCalibration() const; 82 | 83 | /** 84 | Sets the float value to listen for 85 | 86 | @param source a value ranging from 0.0 to 1.0 87 | */ 88 | void setSource(int channel, float* const source); 89 | 90 | /** 91 | Stops the meter from listening to a source 92 | */ 93 | void clearSource(int channel); 94 | 95 | /** 96 | Stops the meter from listening to all sources 97 | */ 98 | void clearSources(); 99 | 100 | /** 101 | Sets up a skew factor to alter the way values are distributed 102 | */ 103 | void setSkewFactor(double factor, bool symmetricSkew=false); 104 | 105 | /** 106 | Sets up a skew factor to alter the way values are distributed 107 | */ 108 | void setSkewFactorFromMidPoint(double meterValueToShowAtMidPoint); 109 | 110 | /** 111 | Returns the current skew factor 112 | */ 113 | double getSkewFactor() const; 114 | 115 | /** 116 | Sets the visibility state of the meter's decorative pips 117 | */ 118 | void setPipState(bool shouldBeShown); 119 | 120 | /** 121 | Returns the current visibility of the meter's pips 122 | */ 123 | bool getPipState() const; 124 | 125 | /** 126 | Sets the number of pips the meter should display, adjusting their spacing automatically 127 | */ 128 | void setPipCount(int count); 129 | 130 | /** 131 | Returns the current number of pips for the slider 132 | */ 133 | int getPipCount() const; 134 | 135 | /** 136 | Determines whether or not to show a line denoting the current peak value (will have no noticeable effect on a peak calibrated meter) 137 | */ 138 | void setPeakStatus(bool shouldShowPeak); 139 | 140 | /** 141 | Returns the current status for displaying the peak value 142 | */ 143 | bool getPeakStatus() const; 144 | 145 | /** 146 | Sets the time in milliseconds it takes for the meter to reach its target value. Set this to 0 for peak metering 147 | */ 148 | void setRiseTime(int riseMs); 149 | 150 | /** 151 | Returns the current meter's rise time 152 | */ 153 | int getRiseTime() const; 154 | 155 | /** 156 | Enables an overshoot value for VU style metering 157 | 158 | @param overshoot a percentage of overshoot (e.g. 5.7) 159 | */ 160 | void setOvershoot(float overshoot); 161 | 162 | /** 163 | Return the meter's current overshoot value; 164 | */ 165 | float getOvershoot() const; 166 | 167 | /** 168 | Sets the time in milliseconds it takes for the meter to reach 0 from its current value. Set this to 0 for peak metering 169 | */ 170 | void setFallTime(int fallMs); 171 | 172 | /** 173 | Returns the meter's current fall time 174 | */ 175 | int getFallTime() const; 176 | 177 | private: 178 | 179 | void setPipScale(); 180 | 181 | void mouseUp(const juce::MouseEvent& e) override; 182 | 183 | void timerCallback() override; 184 | 185 | void paint(juce::Graphics& g) override; 186 | void resized() override; 187 | 188 | bool pipsShown; 189 | int pipSize; 190 | double meterSkewFactor; 191 | juce::Array> pipLocations; 192 | 193 | juce::Rectangle indicatorArea; 194 | 195 | bool meterPeakStatus; 196 | double currentPeakPos; 197 | 198 | int meterRise; 199 | float meterOvershoot; 200 | int meterFall; 201 | 202 | juce::Array meterSources; 203 | juce::Array meterBuffers; 204 | juce::Array meterPeaks; 205 | 206 | MeterStyle meterStyle; 207 | MeterCalibration meterCalibration; 208 | 209 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Meter) 210 | 211 | }; 212 | 213 | } 214 | 215 | #endif 216 | -------------------------------------------------------------------------------- /components/hack_audio_Selector.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | HackAudio::Selector::Selector() : selectorJustification(juce::Justification::centred) 25 | { 26 | 27 | setColour(HackAudio::backgroundColourId, HackAudio::Colours::Black); 28 | setColour(HackAudio::midgroundColourId, HackAudio::Colours::Gray); 29 | setColour(HackAudio::foregroundColourId, HackAudio::Colours::White); 30 | setColour(HackAudio::highlightColourId, HackAudio::Colours::Cyan); 31 | 32 | setWantsKeyboardFocus(true); 33 | setMouseClickGrabsKeyboardFocus(true); 34 | 35 | setFont(HackAudio::Fonts::NowRegular.withHeight(HackAudio::FontHeights::Medium)); 36 | 37 | colourInterpolation.reset(50, 0.5); 38 | 39 | selectLeft.buttonDirection = HackAudio::NavigationButton::Left; 40 | selectRight.buttonDirection = HackAudio::NavigationButton::Right; 41 | 42 | addAndMakeVisible(selectLeft); 43 | addAndMakeVisible(selectRight); 44 | 45 | selectLeft.addMouseListener(this, false); 46 | selectRight.addMouseListener(this, false); 47 | 48 | } 49 | 50 | HackAudio::Selector::~Selector() 51 | { 52 | 53 | } 54 | 55 | void HackAudio::Selector::setJustificationType(juce::Justification justification) 56 | { 57 | 58 | selectorJustification = justification; 59 | repaint(); 60 | 61 | } 62 | 63 | juce::Justification HackAudio::Selector::getJustificationType() const 64 | { 65 | 66 | return selectorJustification; 67 | 68 | } 69 | 70 | void HackAudio::Selector::add(const juce::String& newItemText, int itemIndex) 71 | { 72 | 73 | itemIndex = (itemIndex = -1) ? selectorItems.size() : itemIndex; 74 | selectorItems.insert(itemIndex, newItemText); 75 | 76 | repaint(); 77 | itemsChanged(); 78 | 79 | } 80 | 81 | void HackAudio::Selector::add(const char* newItemText, int itemIndex) 82 | { 83 | 84 | itemIndex = (itemIndex = -1) ? selectorItems.size() : itemIndex; 85 | juce::String charPtr = juce::String(newItemText); 86 | selectorItems.insert(itemIndex, charPtr); 87 | 88 | repaint(); 89 | itemsChanged(); 90 | 91 | } 92 | 93 | void HackAudio::Selector::addArray(const juce::StringArray& items, int startIndex, int numElementsToAdd) 94 | { 95 | 96 | startIndex = (startIndex > 0) ? selectorItems.size() : startIndex; 97 | 98 | numElementsToAdd = (numElementsToAdd < 0 || numElementsToAdd > items.size()) ? items.size() : numElementsToAdd; 99 | 100 | for (int i = 0; i < numElementsToAdd; ++i) 101 | { 102 | 103 | selectorItems.insert(i + startIndex, items.strings.getReference(i)); 104 | 105 | } 106 | 107 | repaint(); 108 | itemsChanged(); 109 | 110 | } 111 | 112 | void HackAudio::Selector::set(int itemIndex, const juce::String& newText) 113 | { 114 | 115 | selectorItems[itemIndex] = newText; 116 | repaint(); 117 | 118 | } 119 | 120 | void HackAudio::Selector::set(int itemIndex, const char* newText) 121 | { 122 | 123 | juce::String charPtr = juce::String(newText); 124 | selectorItems[itemIndex] = charPtr; 125 | repaint(); 126 | 127 | } 128 | 129 | void HackAudio::Selector::clear() 130 | { 131 | 132 | selectorItems.clear(); 133 | itemsChanged(); 134 | 135 | } 136 | 137 | void HackAudio::Selector::setCurrentIndex(int index) 138 | { 139 | 140 | currentIndex = index; 141 | repaint(); 142 | 143 | } 144 | 145 | int HackAudio::Selector::getCurrentIndex() const 146 | { 147 | 148 | return currentIndex; 149 | 150 | } 151 | 152 | int HackAudio::Selector::getNumItems() const 153 | { 154 | 155 | return selectorItems.size(); 156 | 157 | } 158 | 159 | juce::String HackAudio::Selector::getCurrentText() const 160 | { 161 | 162 | return selectorItems.getReference(currentIndex); 163 | 164 | } 165 | 166 | juce::String HackAudio::Selector::getItemText(int index) const 167 | { 168 | 169 | return selectorItems.getReference(index); 170 | 171 | } 172 | 173 | int HackAudio::Selector::getIndexForItem(const juce::String& itemText) const 174 | { 175 | 176 | for (int i = 0; i < selectorItems.size(); ++i) 177 | { 178 | 179 | if (selectorItems.getReference(i).compare(itemText) == 0) 180 | { 181 | 182 | return i; 183 | 184 | } 185 | 186 | } 187 | 188 | return -1; 189 | 190 | } 191 | 192 | int HackAudio::Selector::getIndexForItem(const char* itemText) const 193 | { 194 | 195 | juce::String charPtr = juce::String(itemText); 196 | 197 | for (int i = 0; i < selectorItems.size(); ++i) 198 | { 199 | 200 | if (selectorItems.getReference(i).compare(charPtr) == 0) 201 | { 202 | 203 | return i; 204 | 205 | } 206 | 207 | } 208 | 209 | return -1; 210 | 211 | } 212 | 213 | void HackAudio::Selector::setFont(juce::Font font) 214 | { 215 | 216 | selectorFont = font; 217 | resized(); 218 | repaint(); 219 | 220 | } 221 | 222 | juce::Font HackAudio::Selector::getFont() const 223 | { 224 | 225 | return selectorFont; 226 | 227 | } 228 | 229 | void HackAudio::Selector::addListener(Listener* listener) 230 | { 231 | 232 | if (!listeners.contains(listener)) 233 | { 234 | 235 | listeners.add(listener); 236 | 237 | } 238 | 239 | } 240 | 241 | void HackAudio::Selector::removeListener(Listener* listener) 242 | { 243 | 244 | listeners.remove(listener); 245 | 246 | } 247 | 248 | void HackAudio::Selector::indexChanged() 249 | { 250 | 251 | colourInterpolation.setValue(1.0f); 252 | startTimerHz(ANIMATION_FPS); 253 | listeners.call(&HackAudio::Selector::Listener::selectorIndexChanged, this, currentIndex); 254 | 255 | } 256 | 257 | void HackAudio::Selector::itemsChanged() 258 | { 259 | 260 | listeners.call(&HackAudio::Selector::Listener::selectorItemsChanged, this); 261 | 262 | } 263 | 264 | void HackAudio::Selector::mouseUp(const juce::MouseEvent& e) 265 | { 266 | 267 | if (e.eventComponent == &selectLeft) 268 | { 269 | 270 | if (currentIndex > 0) 271 | { 272 | 273 | currentIndex--; 274 | indexChanged(); 275 | 276 | } 277 | 278 | } 279 | else if (e.eventComponent == &selectRight) 280 | { 281 | 282 | if (currentIndex < selectorItems.size() - 1) 283 | { 284 | 285 | currentIndex++; 286 | indexChanged(); 287 | 288 | } 289 | 290 | } 291 | 292 | } 293 | 294 | bool HackAudio::Selector::keyPressed(const juce::KeyPress& key) 295 | { 296 | 297 | if (key.getKeyCode() == key.escapeKey) 298 | { 299 | 300 | juce::Component::unfocusAllComponents(); 301 | return true; 302 | 303 | } 304 | 305 | if (key.getKeyCode() == key.leftKey) 306 | { 307 | 308 | if (currentIndex > 0) 309 | { 310 | 311 | currentIndex--; 312 | indexChanged(); 313 | 314 | } 315 | 316 | return true; 317 | 318 | } 319 | else if (key.getKeyCode() == key.rightKey) 320 | { 321 | 322 | if (currentIndex < selectorItems.size() - 1) 323 | { 324 | 325 | currentIndex++; 326 | indexChanged(); 327 | 328 | } 329 | 330 | return true; 331 | 332 | } 333 | 334 | return false; 335 | 336 | } 337 | 338 | void HackAudio::Selector::focusGained(juce::Component::FocusChangeType cause) 339 | { 340 | 341 | if (cause == juce::Component::focusChangedByTabKey) 342 | { 343 | 344 | setColour(HackAudio::midgroundColourId, HackAudio::Colours::LightGray); 345 | repaint(); 346 | 347 | } 348 | 349 | } 350 | 351 | void HackAudio::Selector::focusLost(juce::Component::FocusChangeType cause) 352 | { 353 | 354 | setColour(HackAudio::midgroundColourId, HackAudio::Colours::Gray); 355 | repaint(); 356 | 357 | } 358 | 359 | void HackAudio::Selector::enablementChanged() 360 | { 361 | 362 | selectLeft.setEnabled(isEnabled()); 363 | selectRight.setEnabled(isEnabled()); 364 | 365 | if (isEnabled()) 366 | { 367 | 368 | setColour(HackAudio::backgroundColourId, HackAudio::Colours::Black); 369 | setColour(HackAudio::midgroundColourId, HackAudio::Colours::Gray); 370 | setColour(HackAudio::foregroundColourId, HackAudio::Colours::White); 371 | setColour(HackAudio::highlightColourId, HackAudio::Colours::Cyan); 372 | 373 | } 374 | else 375 | { 376 | 377 | setColour(HackAudio::backgroundColourId, HackAudio::Colours::Black); 378 | setColour(HackAudio::midgroundColourId, HackAudio::Colours::Gray); 379 | setColour(HackAudio::foregroundColourId, HackAudio::Colours::Black); 380 | setColour(HackAudio::highlightColourId, HackAudio::Colours::Black); 381 | 382 | } 383 | 384 | repaint(); 385 | 386 | } 387 | 388 | void HackAudio::Selector::timerCallback() 389 | { 390 | 391 | if (colourInterpolation.isSmoothing()) 392 | { 393 | 394 | repaint(); 395 | 396 | if (std::abs(colourInterpolation.getTargetValue() - colourInterpolation.getNextValue()) < 0.0001) 397 | { 398 | 399 | colourInterpolation.setValue(colourInterpolation.getTargetValue()); 400 | 401 | } 402 | 403 | } 404 | else 405 | { 406 | 407 | if (colourInterpolation.getTargetValue() == 1.0f) 408 | { 409 | 410 | colourInterpolation.setValue(0.0f); 411 | 412 | } 413 | else 414 | { 415 | 416 | repaint(); 417 | stopTimer(); 418 | 419 | } 420 | 421 | } 422 | 423 | } 424 | 425 | void HackAudio::Selector::paint(juce::Graphics& g) 426 | { 427 | 428 | int width = getWidth(); 429 | int height = getHeight(); 430 | 431 | juce::Path p; 432 | p.addRoundedRectangle(0, 0, width, height, CORNER_CONFIG); 433 | g.setColour(findColour(HackAudio::midgroundColourId)); 434 | g.fillPath(p); 435 | 436 | juce::Colour foreground = findColour(HackAudio::foregroundColourId); 437 | juce::Colour highlight = findColour(HackAudio::highlightColourId); 438 | 439 | g.setColour(foreground.interpolatedWith(highlight, colourInterpolation.getNextValue())); 440 | g.setFont(getFont()); 441 | g.drawFittedText(selectorItems[currentIndex], 0, 0, width, height, selectorJustification.getFlags(), 1); 442 | 443 | } 444 | 445 | void HackAudio::Selector::resized() 446 | { 447 | 448 | int width = getWidth(); 449 | int height = getHeight(); 450 | 451 | selectLeft.setBounds(8, height/2 - 8, 16, 16); 452 | selectRight.setBounds(width - 24, height/2 - 8, 16, 16); 453 | 454 | } 455 | -------------------------------------------------------------------------------- /components/hack_audio_Selector.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_SELECTOR_H 25 | #define HACK_AUDIO_SELECTOR_H 26 | 27 | namespace HackAudio 28 | { 29 | 30 | /** 31 | A component that allows a user to traverse through a list of options 32 | */ 33 | class Selector : public juce::Component, 34 | private juce::Timer 35 | { 36 | public: 37 | 38 | Selector(); 39 | ~Selector(); 40 | 41 | /** 42 | Sets the style of justification to be used for positioning the text 43 | */ 44 | void setJustificationType(juce::Justification justification); 45 | 46 | /** 47 | Returns the current justification type 48 | */ 49 | juce::Justification getJustificationType() const; 50 | 51 | /** 52 | Adds an item to the list of the selector choices 53 | 54 | @param newItemText the string of the new item 55 | @param itemIndex where to place the item, use -1 to place the new item last in the array 56 | */ 57 | void add(const juce::String& newItemText, int itemIndex = -1); 58 | void add(const char* newItemText, int itemIndex = -1); 59 | 60 | /** 61 | Adds an array of strings as new selector choices 62 | 63 | @param items an array of strings 64 | @param startIndex where to begin placing the new items 65 | @param numElementsToAdd how many elements to insert (inserts all if < 0) 66 | */ 67 | void addArray(const juce::StringArray& items, int startIndex = 0, int numElementsToAdd = -1); 68 | 69 | /** 70 | Inserts an item into the selector 71 | 72 | @param index the index to insert the item at 73 | @param newItemText the text of the new item 74 | */ 75 | void insert(int index, const juce::String& newItemText); 76 | 77 | /** 78 | Changes the text of one of the exisiting items 79 | */ 80 | void set(int itemIndex, const juce::String& newText); 81 | void set(int itemIndex, const char* newText); 82 | 83 | /** 84 | Clears all choices from the selector 85 | */ 86 | void clear(); 87 | 88 | /** 89 | Manually sets the current choice of the selector 90 | */ 91 | void setCurrentIndex(int index); 92 | 93 | /** 94 | Returns the index of the currently displayed item 95 | */ 96 | int getCurrentIndex() const; 97 | 98 | /** 99 | Returns the total number of items the selector holds 100 | */ 101 | int getNumItems() const; 102 | 103 | /** 104 | Returns the text of the currently displayed item 105 | */ 106 | juce::String getCurrentText() const; 107 | 108 | /** 109 | Returns the text of the item at a specific index 110 | */ 111 | juce::String getItemText(int index) const; 112 | 113 | /** 114 | Searches the choices and returns the index if it finds the given string 115 | */ 116 | int getIndexForItem(const juce::String& itemText) const; 117 | int getIndexForItem(const char* itemText) const; 118 | 119 | /** 120 | Sets the selector's font 121 | */ 122 | void setFont(juce::Font font); 123 | 124 | /** 125 | Returns the selector's current font 126 | */ 127 | juce::Font getFont() const; 128 | 129 | /** 130 | A class for receiving callbacks from a selector. 131 | 132 | To be told when a selector changes, you can register a Selector::Listener 133 | object using Selector::addListener() 134 | 135 | @see Selector::addListener, Selector::removeListener 136 | */ 137 | class Listener 138 | { 139 | public: 140 | virtual ~Listener() {} 141 | 142 | /** 143 | Called when a selector moves forwards or backwards 144 | */ 145 | virtual void selectorIndexChanged(Selector*, int index) = 0; 146 | 147 | /** 148 | Called when a selector has items added or removed 149 | */ 150 | virtual void selectorItemsChanged(Selector*) {} 151 | 152 | }; 153 | 154 | /** 155 | Adds a listener to be called when the selector changes items 156 | */ 157 | void addListener(Listener* listener); 158 | 159 | /** 160 | Removes a previously registered listener 161 | */ 162 | void removeListener(Listener* listener); 163 | 164 | private: 165 | 166 | void indexChanged(); 167 | void itemsChanged(); 168 | 169 | void mouseUp(const juce::MouseEvent& e) override; 170 | 171 | bool keyPressed(const juce::KeyPress& key) override; 172 | 173 | void focusGained(juce::Component::FocusChangeType cause) override; 174 | void focusLost (juce::Component::FocusChangeType cause) override; 175 | 176 | void enablementChanged() override; 177 | 178 | void timerCallback() override; 179 | 180 | void paint(juce::Graphics& g) override; 181 | void resized() override; 182 | 183 | juce::ListenerList listeners; 184 | 185 | juce::Font selectorFont; 186 | 187 | juce::Justification selectorJustification; 188 | 189 | int currentIndex; 190 | juce::Array selectorItems; 191 | 192 | juce::LinearSmoothedValue colourInterpolation; 193 | 194 | HackAudio::NavigationButton selectLeft, selectRight; 195 | 196 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Selector) 197 | 198 | }; 199 | 200 | } 201 | 202 | #endif 203 | -------------------------------------------------------------------------------- /components/hack_audio_Slider.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_SLIDER 25 | #define HACK_AUDIO_SLIDER 26 | 27 | namespace HackAudio 28 | { 29 | 30 | /** 31 | A custom slider using the juce::Slider API while adding custom styling and new methods. 32 | */ 33 | class Slider : public juce::Slider, 34 | private juce::Timer, 35 | private juce::Slider::Listener 36 | { 37 | public: 38 | 39 | Slider(); 40 | ~Slider(); 41 | 42 | /** 43 | Sets whether the slider should snap to a value when double clicked and, if so, what value 44 | 45 | @param shouldHaveDefault whether the slider accepts double clicks 46 | 47 | @param defaultValue the value the slider should snap too (must be in slider's range) 48 | */ 49 | void setDefaultValue(bool shouldHaveDefault, double defaultValue); 50 | 51 | /** 52 | Sets the visibility state of the slider's decorative pips 53 | */ 54 | void setPipState(bool shouldBeShown); 55 | 56 | /** 57 | Returns the current visibility of the slider's pips 58 | */ 59 | bool getPipState() const; 60 | 61 | /** 62 | Sets the number of pips the slider should display, adjusting their spacing automatically 63 | */ 64 | void setPipCount(int count); 65 | 66 | /** 67 | Returns the current number of pips for the slider 68 | */ 69 | int getPipCount() const; 70 | 71 | /** 72 | Sets the size of the slider with a 1:1 aspect ratio. Useful for rotary sliders 73 | 74 | @paremeter size the size that both the width and height will be set to 75 | */ 76 | void setSymmetricSize(int size); 77 | 78 | private: 79 | 80 | void setPipScale(); 81 | 82 | void mouseMove(const juce::MouseEvent& e) override; 83 | void mouseDown(const juce::MouseEvent& e) override; 84 | void mouseDrag(const juce::MouseEvent& e) override; 85 | void mouseUp (const juce::MouseEvent& e) override; 86 | 87 | bool keyPressed(const juce::KeyPress& key) override; 88 | 89 | void focusGained(juce::Component::FocusChangeType cause) override; 90 | void focusLost (juce::Component::FocusChangeType cause) override; 91 | 92 | void enablementChanged() override; 93 | 94 | void timerCallback() override; 95 | 96 | void sliderValueChanged(juce::Slider*) override; 97 | 98 | void parentHierarchyChanged() override; 99 | 100 | void stopAnimation(); 101 | 102 | void paint (juce::Graphics& g) override; 103 | void resized() override; 104 | 105 | bool isAnimating; 106 | float animationAcc; 107 | float animationVel; 108 | juce::Point animationStart; 109 | juce::Point animationEnd; 110 | 111 | bool resizeGuard; 112 | 113 | bool pipsShown; 114 | int minPipSize; 115 | int maxPipSize; 116 | int currentMinPipSize; 117 | int currentMaxPipSize; 118 | int pipClicked; 119 | 120 | juce::Array> pipLocations; 121 | juce::Rectangle trackArea; 122 | juce::Rectangle thumbArea; 123 | juce::Rectangle thumbSpan; 124 | juce::Rectangle indicatorArea; 125 | 126 | bool isDraggable; 127 | bool isSettable; 128 | 129 | bool hasDefault; 130 | double sliderDefault; 131 | 132 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Slider) 133 | 134 | }; 135 | 136 | } 137 | 138 | #endif 139 | -------------------------------------------------------------------------------- /diagrams/effects/hack_audio_DattorroReverb.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_DATTORROREVERB_H 25 | #define HACK_AUDIO_DATTORROREVERB_H 26 | 27 | struct DattorroReverb : public HackAudio::Diagram 28 | { 29 | // Dattorro Block Diagram 30 | HackAudio::Label fbd_1_label; 31 | 32 | HackAudio::Label apf_1_label; 33 | HackAudio::Label apf_2_label; 34 | HackAudio::Label apf_3_label; 35 | HackAudio::Label apf_4_label; 36 | 37 | // Top or Left 38 | HackAudio::Label apf_5_label; 39 | HackAudio::Label delay_1_label; 40 | HackAudio::Label fbd_2_label; 41 | HackAudio::Label apf_6_label; 42 | HackAudio::Label delay_2_label; 43 | 44 | // Bottom or Right 45 | HackAudio::Label apf_7_label; 46 | HackAudio::Label delay_3_label; 47 | HackAudio::Label fbd_3_label; 48 | HackAudio::Label apf_8_label; 49 | HackAudio::Label delay_4_label; 50 | 51 | 52 | // Feedback Junctions 53 | HackAudio::Diagram::Junction sum1; 54 | HackAudio::Diagram::Junction sum2; 55 | HackAudio::Diagram::Junction mul1; 56 | HackAudio::Diagram::Junction mul2; 57 | HackAudio::Diagram::Junction fb1; 58 | HackAudio::Diagram::Junction fb2; 59 | HackAudio::Diagram::Junction node1; 60 | HackAudio::Diagram::Junction node2; 61 | HackAudio::Diagram::Junction node3; 62 | HackAudio::Diagram::Junction node4; 63 | 64 | // Feedback Gains 65 | HackAudio::Label decay_1_label; 66 | HackAudio::Label decay_2_label; 67 | 68 | 69 | HackAudio::Diagrams::AllpassFilter apf_1_diag; 70 | HackAudio::Diagrams::AllpassFilter apf_2_diag; 71 | HackAudio::Diagrams::AllpassFilter apf_3_diag; 72 | HackAudio::Diagrams::AllpassFilter apf_4_diag; 73 | HackAudio::Diagrams::AllpassFilter apf_5_diag; 74 | HackAudio::Diagrams::AllpassFilter apf_6_diag; 75 | HackAudio::Diagrams::AllpassFilter apf_7_diag; 76 | HackAudio::Diagrams::AllpassFilter apf_8_diag; 77 | 78 | HackAudio::Diagrams::DampingFilter fbd_1_diag; 79 | HackAudio::Diagrams::DampingFilter fbd_2_diag; 80 | HackAudio::Diagrams::DampingFilter fbd_3_diag; 81 | 82 | 83 | DattorroReverb() 84 | { 85 | 86 | fbd_1_label.setPlaceholder("FBD"); 87 | fbd_1_label.setBounds(12,0,64,40); 88 | 89 | apf_1_label.setPlaceholder("APF"); 90 | apf_1_label.setBounds(97,0,64,40); 91 | apf_2_label.setPlaceholder("APF"); 92 | apf_2_label.setBounds(182,0,64,40); 93 | apf_3_label.setPlaceholder("APF"); 94 | apf_3_label.setBounds(267,0,64,40); 95 | apf_4_label.setPlaceholder("APF"); 96 | apf_4_label.setBounds(352,0,64,40); 97 | 98 | // Sum Junctions 99 | sum1.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 100 | sum1.setBounds(375,-45,25,25); 101 | sum2.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 102 | sum2.setBounds(375,60,25,25); 103 | 104 | // Top or Left 105 | apf_5_label.setPlaceholder("APF"); 106 | apf_5_label.setBounds(350,-100,64,40); 107 | delay_1_label.setPlaceholder("Delay"); 108 | delay_1_label.setBounds(438,-100,64,40); 109 | fbd_2_label.setPlaceholder("FBD"); 110 | fbd_2_label.setBounds(526,-100,64,40); 111 | apf_6_label.setPlaceholder("APF"); 112 | apf_6_label.setBounds(614,-100,64,40); 113 | delay_2_label.setPlaceholder("Delay"); 114 | delay_2_label.setBounds(702,-100,64,40); 115 | 116 | // Bottom or Right 117 | apf_7_label.setPlaceholder("APF"); 118 | apf_7_label.setBounds(350,100,64,40); 119 | delay_3_label.setPlaceholder("Delay"); 120 | delay_3_label.setBounds(438,100,64,40); 121 | fbd_3_label.setPlaceholder("FBD"); 122 | fbd_3_label.setBounds(526,100,64,40); 123 | apf_8_label.setPlaceholder("APF"); 124 | apf_8_label.setBounds(614,100,64,40); 125 | delay_4_label.setPlaceholder("Delay"); 126 | delay_4_label.setBounds(702,100,64,40); 127 | 128 | // Feedback Junctions 129 | fb1.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 130 | fb1.setBounds(780,-85,10,10); 131 | fb2.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 132 | fb2.setBounds(780,115,10,10); 133 | 134 | mul1.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 135 | mul1.setBounds(652,-10,25,25); 136 | mul2.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 137 | mul2.setBounds(575,30,25,25); 138 | 139 | node1.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 140 | node1.setBounds(430,-10,0,0); 141 | node2.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 142 | node2.setBounds(430,30,0,0); 143 | node3.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 144 | node3.setBounds(330,-65,0,0); 145 | node4.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 146 | node4.setBounds(330,85,0,0); 147 | 148 | // Gains 149 | decay_1_label.setPlaceholder("Decay"); 150 | decay_1_label.setBounds(590,-45,60,30); 151 | decay_2_label.setPlaceholder("Decay"); 152 | decay_2_label.setBounds(500,28,60,30); 153 | 154 | // Connections 155 | addDiagramInput(fbd_1_label); 156 | connect(fbd_1_label,apf_1_label); 157 | connect(apf_1_label,apf_2_label); 158 | connect(apf_2_label,apf_3_label); 159 | connect(apf_3_label,apf_4_label); 160 | connect(apf_4_label,node1); 161 | connect(apf_4_label,node2); 162 | connect(node1,sum1); 163 | connect(node2,sum2); 164 | 165 | connect(sum1,node3,HackAudio::Diagram::Junction::Horizontal); 166 | connect(node3,apf_5_label); 167 | connect(apf_5_label,delay_1_label); 168 | connect(delay_1_label,fbd_2_label); 169 | connect(fbd_2_label,apf_6_label); 170 | connect(apf_6_label,delay_2_label); 171 | 172 | connect(sum2,node4,HackAudio::Diagram::Junction::Horizontal); 173 | connect(node4,apf_7_label); 174 | connect(apf_7_label,delay_3_label); 175 | connect(delay_3_label,fbd_3_label); 176 | connect(fbd_3_label,apf_8_label); 177 | connect(apf_8_label,delay_4_label); 178 | 179 | connect(fb1,mul1); 180 | // HackAudio::Diagram::Junction::Horizontal 181 | connect(mul1,sum2); 182 | connect(fb2,mul2); 183 | connect(mul2,sum1); 184 | 185 | // Gains 186 | connect(decay_1_label,mul1); 187 | connect(decay_2_label,mul2); 188 | 189 | // Outputs 190 | connect(delay_2_label,fb1); 191 | connect(delay_4_label,fb2); 192 | 193 | 194 | addDiagramOutput(fb1); 195 | addDiagramOutput(fb2); 196 | 197 | setSubDiagram(apf_1_label, apf_1_diag); 198 | setSubDiagram(apf_2_label, apf_2_diag); 199 | setSubDiagram(apf_3_label, apf_3_diag); 200 | setSubDiagram(apf_4_label, apf_4_diag); 201 | setSubDiagram(apf_5_label, apf_5_diag); 202 | setSubDiagram(apf_6_label, apf_6_diag); 203 | setSubDiagram(apf_7_label, apf_7_diag); 204 | setSubDiagram(apf_8_label, apf_8_diag); 205 | 206 | setSubDiagram(fbd_1_label, fbd_1_diag); 207 | setSubDiagram(fbd_2_label, fbd_2_diag); 208 | setSubDiagram(fbd_3_label, fbd_3_diag); 209 | 210 | setName("Dattorro Plate Reverb"); 211 | 212 | } 213 | 214 | }; 215 | 216 | #endif 217 | -------------------------------------------------------------------------------- /diagrams/effects/hack_audio_EarlyReflections.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_EARLYREFLECTIONS_H 25 | #define HACK_AUDIO_EARLYREFLECTIONS_H 26 | 27 | struct EarlyReflections : public HackAudio::Diagram 28 | { 29 | 30 | HackAudio::Label delay_1_label; 31 | HackAudio::Label delay_2_label; 32 | HackAudio::Label delay_3_label; 33 | HackAudio::Label delay_4_label; 34 | HackAudio::Label delay_5_label; 35 | HackAudio::Label delay_6_label; 36 | HackAudio::Label delay_7_label; 37 | HackAudio::Label delay_8_label; 38 | 39 | HackAudio::Label gain_1_label; 40 | HackAudio::Label gain_2_label; 41 | HackAudio::Label gain_3_label; 42 | HackAudio::Label gain_4_label; 43 | HackAudio::Label gain_5_label; 44 | HackAudio::Label gain_6_label; 45 | HackAudio::Label gain_7_label; 46 | HackAudio::Label gain_8_label; 47 | 48 | HackAudio::Diagram::Junction sum1; 49 | HackAudio::Diagram::Junction sum2; 50 | HackAudio::Diagram::Junction sum3; 51 | HackAudio::Diagram::Junction sum4; 52 | HackAudio::Diagram::Junction sum5; 53 | HackAudio::Diagram::Junction sum6; 54 | HackAudio::Diagram::Junction sum7; 55 | HackAudio::Diagram::Junction sum8; 56 | 57 | HackAudio::Diagram::Junction mul1; 58 | HackAudio::Diagram::Junction mul2; 59 | HackAudio::Diagram::Junction mul3; 60 | HackAudio::Diagram::Junction mul4; 61 | HackAudio::Diagram::Junction mul5; 62 | HackAudio::Diagram::Junction mul6; 63 | HackAudio::Diagram::Junction mul7; 64 | HackAudio::Diagram::Junction mul8; 65 | 66 | EarlyReflections() 67 | { 68 | delay_1_label.setPlaceholder("Delay"); 69 | delay_1_label.setBounds(0,-100,64,50); 70 | delay_2_label.setPlaceholder("Delay"); 71 | delay_2_label.setBounds(96,-100,64,50); 72 | delay_3_label.setPlaceholder("Delay"); 73 | delay_3_label.setBounds(192,-100,64,50); 74 | delay_4_label.setPlaceholder("Delay"); 75 | delay_4_label.setBounds(288,-100,64,50); 76 | delay_5_label.setPlaceholder("Delay"); 77 | delay_5_label.setBounds(384,-100,64,50); 78 | delay_6_label.setPlaceholder("Delay"); 79 | delay_6_label.setBounds(480,-100,64,50); 80 | delay_7_label.setPlaceholder("Delay"); 81 | delay_7_label.setBounds(576,-100,64,50); 82 | delay_8_label.setPlaceholder("Delay"); 83 | delay_8_label.setBounds(672,-100,64,50); 84 | 85 | 86 | sum1.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 87 | sum1.setBounds(70,100,30,30); 88 | sum2.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 89 | sum2.setBounds(166,100,30,30); 90 | sum3.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 91 | sum3.setBounds(262,100,30,30); 92 | sum4.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 93 | sum4.setBounds(358,100,30,30); 94 | sum5.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 95 | sum5.setBounds(454,100,30,30); 96 | sum6.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 97 | sum6.setBounds(550,100,30,30); 98 | sum7.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 99 | sum7.setBounds(646,100,30,30); 100 | sum8.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 101 | sum8.setBounds(750,100,30,30); 102 | 103 | mul1.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 104 | mul1.setBounds(70,5,30,30); 105 | mul2.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 106 | mul2.setBounds(166,5,30,30); 107 | mul3.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 108 | mul3.setBounds(262,5,30,30); 109 | mul4.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 110 | mul4.setBounds(358,5,30,30); 111 | mul5.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 112 | mul5.setBounds(454,5,30,30); 113 | mul6.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 114 | mul6.setBounds(550,5,30,30); 115 | mul7.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 116 | mul7.setBounds(646,5,30,30); 117 | mul8.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 118 | mul8.setBounds(750,5,30,30); 119 | 120 | gain_1_label.setPlaceholder("g1"); 121 | gain_1_label.setBounds(12,5,40,30); 122 | gain_2_label.setPlaceholder("g2"); 123 | gain_2_label.setBounds(108,5,40,30); 124 | gain_3_label.setPlaceholder("g3"); 125 | gain_3_label.setBounds(204,5,40,30); 126 | gain_4_label.setPlaceholder("g4"); 127 | gain_4_label.setBounds(300,5,40,30); 128 | gain_5_label.setPlaceholder("g5"); 129 | gain_5_label.setBounds(396,5,40,30); 130 | gain_6_label.setPlaceholder("g6"); 131 | gain_6_label.setBounds(492,5,40,30); 132 | gain_7_label.setPlaceholder("g7"); 133 | gain_7_label.setBounds(588,5,40,30); 134 | gain_8_label.setPlaceholder("g8"); 135 | gain_8_label.setBounds(684,5,40,30); 136 | 137 | addDiagramInput(delay_1_label); 138 | connect(delay_1_label,delay_2_label); 139 | connect(delay_2_label,delay_3_label); 140 | connect(delay_3_label,delay_4_label); 141 | connect(delay_4_label,delay_5_label); 142 | connect(delay_5_label,delay_6_label); 143 | connect(delay_6_label,delay_7_label); 144 | connect(delay_7_label,delay_8_label); 145 | connect(delay_8_label,mul8); 146 | 147 | 148 | addDiagramInput(sum1); 149 | connect(sum1,sum2); 150 | connect(sum2,sum3); 151 | connect(sum3,sum4); 152 | connect(sum4,sum5); 153 | connect(sum5,sum6); 154 | connect(sum6,sum7); 155 | connect(sum7,sum8); 156 | addDiagramOutput(sum8); 157 | 158 | connect(delay_1_label,mul1); 159 | connect(delay_2_label,mul2); 160 | connect(delay_3_label,mul3); 161 | connect(delay_4_label,mul4); 162 | connect(delay_5_label,mul5); 163 | connect(delay_6_label,mul6); 164 | connect(delay_7_label,mul7); 165 | 166 | connect(gain_1_label,mul1); 167 | connect(gain_2_label,mul2); 168 | connect(gain_3_label,mul3); 169 | connect(gain_4_label,mul4); 170 | connect(gain_5_label,mul5); 171 | connect(gain_6_label,mul6); 172 | connect(gain_7_label,mul7); 173 | connect(gain_8_label,mul8); 174 | 175 | connect(mul1,sum1); 176 | connect(mul2,sum2); 177 | connect(mul3,sum3); 178 | connect(mul4,sum4); 179 | connect(mul5,sum5); 180 | connect(mul6,sum6); 181 | connect(mul7,sum7); 182 | connect(mul8,sum8); 183 | 184 | setName("Early-Reflections Network"); 185 | 186 | } 187 | 188 | }; 189 | 190 | #endif 191 | -------------------------------------------------------------------------------- /diagrams/effects/hack_audio_FDNReverb.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_FDNREVERB_H 25 | #define HACK_AUDIO_FDNREVERB_H 26 | 27 | struct FDNReverb : public HackAudio::Diagram 28 | { 29 | HackAudio::Diagram::Junction sum1; 30 | HackAudio::Diagram::Junction sum2; 31 | HackAudio::Diagram::Junction sum3; 32 | HackAudio::Diagram::Junction sum4; 33 | 34 | HackAudio::Diagram::Junction fbMult; 35 | 36 | HackAudio::Label delay_1_label; 37 | HackAudio::Label delay_2_label; 38 | HackAudio::Label delay_3_label; 39 | HackAudio::Label delay_4_label; 40 | 41 | HackAudio::Diagram::Junction fb1; 42 | HackAudio::Diagram::Junction fb2; 43 | HackAudio::Diagram::Junction fb3; 44 | HackAudio::Diagram::Junction fb4; 45 | 46 | HackAudio::Diagram::Junction sumOut; 47 | 48 | HackAudio::Label matrix_label; 49 | HackAudio::Label fbGain_label; 50 | 51 | HackAudio::Diagrams::Moddelay moddelay_1_diag; 52 | HackAudio::Diagrams::Moddelay moddelay_2_diag; 53 | HackAudio::Diagrams::Moddelay moddelay_3_diag; 54 | HackAudio::Diagrams::Moddelay moddelay_4_diag; 55 | /// 56 | 57 | FDNReverb() 58 | { 59 | sum1.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 60 | sum1.setBounds(90,-98,20,20); 61 | sum2.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 62 | sum2.setBounds(60,-62,20,20); 63 | sum3.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 64 | sum3.setBounds(30,-26,20,20); 65 | sum4.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 66 | sum4.setBounds(0,10,20,20); 67 | 68 | sumOut.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 69 | sumOut.setBounds(500,-62,20,20); 70 | 71 | fbMult.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 72 | fbMult.setBounds(170,85,20,20); 73 | 74 | delay_1_label.setPlaceholder("Delay"); 75 | delay_1_label.setBounds(310,-108,64,40); 76 | delay_2_label.setPlaceholder("Delay"); 77 | delay_2_label.setBounds(250,-72,64,40); 78 | delay_3_label.setPlaceholder("Delay"); 79 | delay_3_label.setBounds(190,-36,64,40); 80 | delay_4_label.setPlaceholder("Delay"); 81 | delay_4_label.setBounds(130,0,64,40); 82 | 83 | matrix_label.setPlaceholder("Feed-back\nMatrix"); 84 | matrix_label.setBounds(210,43,130,105); 85 | 86 | fbGain_label.setPlaceholder("Gain"); 87 | fbGain_label.setBounds(100,108,50,32); 88 | 89 | fb1.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 90 | fb1.setBounds(450,-93,10,10); 91 | fb2.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 92 | fb2.setBounds(420,-57,10,10); 93 | fb3.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 94 | fb3.setBounds(390,-21,10,10); 95 | fb4.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 96 | fb4.setBounds(360,15,10,10); 97 | 98 | addDiagramInput(sum1); 99 | addDiagramInput(sum2); 100 | addDiagramInput(sum3); 101 | addDiagramInput(sum4); 102 | connect(sum1,delay_1_label); 103 | connect(sum2,delay_2_label); 104 | connect(sum3,delay_3_label); 105 | connect(sum4,delay_4_label); 106 | connect(delay_1_label,sumOut); 107 | connect(delay_2_label,sumOut); 108 | connect(delay_3_label,sumOut); 109 | connect(delay_4_label,sumOut); 110 | 111 | connect(fb1,matrix_label); 112 | connect(fb2,matrix_label); 113 | connect(fb3,matrix_label); 114 | connect(fb4,matrix_label); 115 | 116 | connect(matrix_label,fbMult); 117 | connect(fbGain_label,fbMult); 118 | 119 | connect(fbMult,sum1,HackAudio::Diagram::Junction::Horizontal); 120 | connect(fbMult,sum2,HackAudio::Diagram::Junction::Horizontal); 121 | connect(fbMult,sum3,HackAudio::Diagram::Junction::Horizontal); 122 | connect(fbMult,sum4,HackAudio::Diagram::Junction::Horizontal); 123 | 124 | addDiagramOutput(sumOut); 125 | 126 | setName("Feed-back Delay Network Reverb"); 127 | 128 | setSubDiagram(delay_1_label, moddelay_1_diag); 129 | setSubDiagram(delay_2_label, moddelay_2_diag); 130 | setSubDiagram(delay_3_label, moddelay_3_diag); 131 | setSubDiagram(delay_4_label, moddelay_4_diag); 132 | 133 | } 134 | 135 | }; 136 | 137 | #endif 138 | -------------------------------------------------------------------------------- /diagrams/effects/hack_audio_GardnerlargeReverb.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_GARDNERLARGEREVERB_H 25 | #define HACK_AUDIO_GARDNERLARGEREVERB_H 26 | 27 | struct GardnerlargeReverb : public HackAudio::Diagram 28 | { 29 | 30 | 31 | HackAudio::Label apf_1_label; 32 | HackAudio::Label apf_2_label; 33 | HackAudio::Label napf_1_label; 34 | HackAudio::Label napf_2_label; 35 | 36 | HackAudio::Label lpf_label; 37 | 38 | HackAudio::Label delay_1_label; 39 | HackAudio::Label delay_2_label; 40 | HackAudio::Label delay_3_label; 41 | HackAudio::Label delay_4_label; 42 | 43 | HackAudio::Label gain_0_label; 44 | HackAudio::Label gain_1_label; 45 | HackAudio::Label gain_2_label; 46 | HackAudio::Label gain_3_label; 47 | 48 | HackAudio::Diagram::Junction sum1; 49 | HackAudio::Diagram::Junction sum2; 50 | HackAudio::Diagram::Junction sum3; 51 | HackAudio::Diagram::Junction mul0; 52 | HackAudio::Diagram::Junction mul1; 53 | HackAudio::Diagram::Junction mul2; 54 | HackAudio::Diagram::Junction mul3; 55 | HackAudio::Diagram::Junction node0; 56 | HackAudio::Diagram::Junction node1; 57 | HackAudio::Diagram::Junction node2; 58 | 59 | HackAudio::Diagrams::BiquadFilter lpf_diag; 60 | HackAudio::Diagrams::AllpassFilter apf_1_diag; 61 | HackAudio::Diagrams::AllpassFilter apf_2_diag; 62 | HackAudio::Diagrams::NestedallpassFilter napf_1_diag; 63 | HackAudio::Diagrams::NestedtwoFilter napf_2_diag; 64 | 65 | GardnerlargeReverb() 66 | { 67 | 68 | //////// Gardner LARGE///////////////////////////////////////// 69 | sum1.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 70 | sum1.setBounds(0,8,30,30); 71 | 72 | apf_1_label.setPlaceholder("APF"); 73 | apf_1_label.setBounds(45,0,60,48); 74 | 75 | apf_2_label.setPlaceholder("APF"); 76 | apf_2_label.setBounds(130,0,60,48); 77 | 78 | delay_1_label.setPlaceholder("Delay"); 79 | delay_1_label.setBounds(215,0,60,48); 80 | 81 | delay_2_label.setPlaceholder("Delay"); 82 | delay_2_label.setBounds(310,0,60,48); 83 | 84 | napf_1_label.setPlaceholder("NAPF"); 85 | napf_1_label.setBounds(392,0,60,48); 86 | 87 | delay_3_label.setPlaceholder("Delay"); 88 | delay_3_label.setBounds(474,0,60,48); 89 | 90 | delay_4_label.setPlaceholder("Delay"); 91 | delay_4_label.setBounds(566,0,60,48); 92 | 93 | napf_2_label.setPlaceholder("2NAPF"); 94 | napf_2_label.setBounds(647,0,60,48); 95 | 96 | lpf_label.setPlaceholder("LPF"); 97 | lpf_label.setBounds(256,95,60,48); 98 | 99 | gain_1_label.setPlaceholder("Gain"); 100 | gain_1_label.setBounds(460,-48,50,30); 101 | 102 | gain_2_label.setPlaceholder("Gain"); 103 | gain_2_label.setBounds(650,-48,50,30); 104 | 105 | gain_3_label.setPlaceholder("Gain"); 106 | gain_3_label.setBounds(100,64,50,30); 107 | 108 | // Output 109 | node1.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 110 | node1.setBounds(545,18,12,12); 111 | 112 | node2.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 113 | node2.setBounds(735,64,0,0); 114 | 115 | mul1.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 116 | mul1.setBounds(535,-48,30,30); 117 | 118 | mul2.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 119 | mul2.setBounds(720,-48,30,30); 120 | 121 | mul3.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 122 | mul3.setBounds(150,104,30,30); 123 | 124 | sum2.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 125 | sum2.setBounds(721,-96,30,30); 126 | 127 | sum3.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 128 | sum3.setBounds(580,-96,30,30); 129 | 130 | gain_0_label.setPlaceholder("Gain"); 131 | gain_0_label.setBounds(205,-96,50,30); 132 | mul0.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 133 | mul0.setBounds(280,-96,30,30); 134 | node0.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 135 | node0.setBounds(290,18,12,12); 136 | 137 | 138 | // Connections 139 | addDiagramInput(sum1); 140 | connect(sum1,apf_1_label); 141 | connect(apf_1_label,apf_2_label); 142 | connect(apf_2_label,delay_1_label); 143 | connect(delay_1_label,delay_2_label); 144 | connect(delay_2_label,napf_1_label); 145 | connect(napf_1_label,delay_3_label); 146 | connect(delay_3_label,delay_4_label); 147 | connect(delay_4_label,napf_2_label); 148 | connect(napf_2_label,mul2); 149 | 150 | connect(napf_2_label,node2); 151 | connect(node2,lpf_label); 152 | connect(lpf_label,mul3); 153 | 154 | connect(gain_3_label,mul3); 155 | connect(mul3,sum1,HackAudio::Diagram::Junction::Horizontal); 156 | 157 | connect(node1,mul1); 158 | connect(gain_1_label,mul1); 159 | connect(mul1,sum3,HackAudio::Diagram::Junction::Horizontal); 160 | connect(gain_2_label,mul2); 161 | connect(mul2,sum2,HackAudio::Diagram::Junction::Horizontal); 162 | connect(sum3,sum2); 163 | 164 | connect(node0,mul0); 165 | connect(gain_0_label,mul0); 166 | connect(mul0,sum3); 167 | addDiagramOutput(sum2); 168 | 169 | 170 | setName("Gardner Large Reverb"); 171 | 172 | setSubDiagram(lpf_label,lpf_diag); 173 | setSubDiagram(apf_1_label,apf_1_diag); 174 | setSubDiagram(apf_2_label,apf_2_diag); 175 | setSubDiagram(napf_1_label,napf_1_diag); 176 | setSubDiagram(napf_2_label,napf_2_diag); 177 | } 178 | 179 | }; 180 | 181 | #endif 182 | -------------------------------------------------------------------------------- /diagrams/effects/hack_audio_GardnermediumReverb.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_GARDNERMEDIUMREVERB_H 25 | #define HACK_AUDIO_GARDNERMEDIUMREVERB_H 26 | 27 | struct GardnermediumReverb : public HackAudio::Diagram 28 | { 29 | 30 | HackAudio::Label napf_1_label; 31 | HackAudio::Label napf_2_label; 32 | HackAudio::Label apf_label; 33 | HackAudio::Label lpf_label; 34 | 35 | HackAudio::Label delay_1_label; 36 | HackAudio::Label delay_2_label; 37 | HackAudio::Label delay_3_label; 38 | HackAudio::Label delay_4_label; 39 | 40 | HackAudio::Label gain_0_label; 41 | HackAudio::Label gain_1_label; 42 | HackAudio::Label gain_2_label; 43 | HackAudio::Label gain_3_label; 44 | 45 | HackAudio::Diagram::Junction sum1; 46 | HackAudio::Diagram::Junction sum2; 47 | HackAudio::Diagram::Junction sum3; 48 | HackAudio::Diagram::Junction mul0; 49 | HackAudio::Diagram::Junction mul1; 50 | HackAudio::Diagram::Junction mul2; 51 | HackAudio::Diagram::Junction mul3; 52 | HackAudio::Diagram::Junction node0; 53 | HackAudio::Diagram::Junction node1; 54 | HackAudio::Diagram::Junction node2; 55 | 56 | HackAudio::Diagrams::BiquadFilter lpf_diag; 57 | HackAudio::Diagrams::AllpassFilter apf_diag; 58 | HackAudio::Diagrams::NestedtwoFilter napf_1_diag; 59 | HackAudio::Diagrams::NestedallpassFilter napf_2_diag; 60 | 61 | GardnermediumReverb() 62 | { 63 | 64 | sum1.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 65 | sum1.setBounds(0,8,30,30); 66 | 67 | napf_1_label.setPlaceholder("2NAPF"); 68 | napf_1_label.setBounds(65,0,60,48); 69 | 70 | delay_1_label.setPlaceholder("Delay"); 71 | delay_1_label.setBounds(165,0,60,48); 72 | 73 | apf_label.setPlaceholder("APF"); 74 | apf_label.setBounds(250,0,60,48); 75 | 76 | delay_2_label.setPlaceholder("Delay"); 77 | delay_2_label.setBounds(340,0,60,48); 78 | 79 | delay_3_label.setPlaceholder("Delay"); 80 | delay_3_label.setBounds(440,0,60,48); 81 | 82 | napf_2_label.setPlaceholder("NAPF"); 83 | napf_2_label.setBounds(550,0,60,48); 84 | 85 | delay_4_label.setPlaceholder("Delay"); 86 | delay_4_label.setBounds(440,95,60,48); 87 | 88 | lpf_label.setPlaceholder("LPF"); 89 | lpf_label.setBounds(256,95,60,48); 90 | 91 | gain_1_label.setPlaceholder("Gain"); 92 | gain_1_label.setBounds(335,-48,50,30); 93 | 94 | gain_2_label.setPlaceholder("Gain"); 95 | gain_2_label.setBounds(550,-48,50,30); 96 | 97 | gain_3_label.setPlaceholder("Gain"); 98 | gain_3_label.setBounds(100,64,50,30); 99 | 100 | // Output 101 | node1.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 102 | node1.setBounds(415,18,12,12); 103 | 104 | node2.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 105 | node2.setBounds(637,64,0,0); 106 | 107 | mul1.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 108 | mul1.setBounds(405,-48,30,30); 109 | 110 | mul2.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 111 | mul2.setBounds(620,-48,30,30); 112 | 113 | mul3.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 114 | mul3.setBounds(150,104,30,30); 115 | 116 | sum2.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 117 | sum2.setBounds(660,-96,30,30); 118 | 119 | sum3.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 120 | sum3.setBounds(445,-96,30,30); 121 | 122 | gain_0_label.setPlaceholder("Gain"); 123 | gain_0_label.setBounds(55,-96,50,30); 124 | mul0.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 125 | mul0.setBounds(130,-96,30,30); 126 | node0.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 127 | node0.setBounds(140,18,12,12); 128 | 129 | 130 | addDiagramInput(sum1); 131 | connect(sum1,napf_1_label); 132 | connect(napf_1_label,delay_1_label); 133 | connect(delay_1_label,apf_label); 134 | connect(apf_label,delay_2_label); 135 | connect(delay_2_label,delay_3_label); 136 | connect(delay_3_label,napf_2_label); 137 | 138 | connect(napf_2_label,mul2); 139 | connect(napf_2_label,node2); 140 | connect(node2,delay_4_label); 141 | connect(delay_4_label,lpf_label); 142 | connect(lpf_label,mul3); 143 | 144 | connect(gain_3_label,mul3); 145 | connect(mul3,sum1,HackAudio::Diagram::Junction::Horizontal); 146 | 147 | connect(node1,mul1); 148 | connect(gain_1_label,mul1); 149 | connect(mul1,sum3,HackAudio::Diagram::Junction::Horizontal); 150 | connect(gain_2_label,mul2); 151 | connect(mul2,sum2,HackAudio::Diagram::Junction::Horizontal); 152 | connect(sum3,sum2); 153 | 154 | connect(node0,mul0); 155 | connect(gain_0_label,mul0); 156 | connect(mul0,sum3); 157 | addDiagramOutput(sum2); 158 | 159 | 160 | setName("Gardner Medium Reverb"); 161 | 162 | setSubDiagram(lpf_label, lpf_diag); 163 | setSubDiagram(apf_label, apf_diag); 164 | setSubDiagram(napf_1_label, napf_1_diag); 165 | setSubDiagram(napf_2_label, napf_2_diag); 166 | } 167 | 168 | }; 169 | 170 | #endif 171 | -------------------------------------------------------------------------------- /diagrams/effects/hack_audio_GardnersmallReverb.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_GARDNERSMALLREVERB_H 25 | #define HACK_AUDIO_GARDNERSMALLREVERB_H 26 | 27 | struct GardnersmallReverb : public HackAudio::Diagram 28 | { 29 | 30 | HackAudio::Label main_delay_label; 31 | HackAudio::Label napf_1_label; 32 | HackAudio::Label napf_2_label; 33 | HackAudio::Label lpf_label; 34 | 35 | HackAudio::Label gain_1_label; 36 | HackAudio::Label gain_2_label; 37 | HackAudio::Label gain_3_label; 38 | 39 | HackAudio::Diagram::Junction sum1; 40 | HackAudio::Diagram::Junction sum2; 41 | HackAudio::Diagram::Junction mul1; 42 | HackAudio::Diagram::Junction mul2; 43 | HackAudio::Diagram::Junction mul3; 44 | HackAudio::Diagram::Junction node1; 45 | HackAudio::Diagram::Junction node2; 46 | 47 | HackAudio::Diagrams::BiquadFilter lpf_diag; 48 | HackAudio::Diagrams::NestedtwoFilter napf_1_diag; 49 | HackAudio::Diagrams::NestedallpassFilter napf_2_diag; 50 | 51 | 52 | GardnersmallReverb() 53 | { 54 | 55 | sum1.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 56 | sum1.setBounds(0,8,30,30); 57 | 58 | main_delay_label.setPlaceholder("Delay"); 59 | //main_delay_label.setText("24",dontSendNotification); 60 | main_delay_label.setBounds(70,0,64,48); 61 | 62 | 63 | napf_1_label.setPlaceholder("2NAPF"); 64 | //napf_1_label.setText("35",dontSendNotification); 65 | napf_1_label.setBounds(192,0,64,48); 66 | 67 | napf_2_label.setPlaceholder("NAPF"); 68 | //napf_2_label.setText("66",dontSendNotification); 69 | napf_2_label.setBounds(320,0,64,48); 70 | 71 | lpf_label.setPlaceholder("LPF"); 72 | //lpf_label.setText("4200",dontSendNotification); 73 | lpf_label.setBounds(256,95,64,48); 74 | 75 | gain_1_label.setPlaceholder("Gain"); 76 | //gain_1_label.setText("0.5",dontSendNotification); 77 | gain_1_label.setBounds(200,-96,50,30); 78 | 79 | gain_2_label.setPlaceholder("Gain"); 80 | //gain_2_label.setText("0.5",dontSendNotification); 81 | gain_2_label.setBounds(365,-48,50,30); 82 | 83 | gain_3_label.setPlaceholder("Gain"); 84 | gain_3_label.setBounds(100,64,50,30); 85 | 86 | 87 | node1.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 88 | node1.setBounds(285,18,12,12); // BUG? 284 89 | 90 | node2.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 91 | node2.setBounds(410,64,0,0); 92 | 93 | mul1.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 94 | mul1.setBounds(275,-96,30,30); 95 | 96 | mul2.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 97 | mul2.setBounds(440,-48,30,30); 98 | 99 | mul3.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 100 | mul3.setBounds(150,104,30,30); 101 | 102 | sum2.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 103 | sum2.setBounds(500,-96,30,30); 104 | 105 | 106 | addDiagramInput(sum1); 107 | connect(sum1,main_delay_label); 108 | connect(main_delay_label,napf_1_label); 109 | connect(napf_1_label,napf_2_label); 110 | connect(napf_2_label,mul2); 111 | connect(napf_2_label,node2); 112 | connect(node2,lpf_label); 113 | connect(lpf_label,mul3); 114 | 115 | connect(gain_3_label,mul3); 116 | connect(mul3,sum1,HackAudio::Diagram::Junction::Horizontal); 117 | 118 | connect(node1,mul1); 119 | connect(gain_1_label,mul1); 120 | connect(mul1,sum2); 121 | connect(gain_2_label,mul2); 122 | connect(mul2,sum2,HackAudio::Diagram::Junction::Horizontal); 123 | addDiagramOutput(sum2); 124 | 125 | 126 | setName("Gardner Small Reverb"); 127 | 128 | 129 | setSubDiagram(lpf_label, lpf_diag); 130 | setSubDiagram(napf_1_label, napf_1_diag); 131 | setSubDiagram(napf_2_label, napf_2_diag); 132 | 133 | } 134 | 135 | }; 136 | 137 | #endif 138 | -------------------------------------------------------------------------------- /diagrams/effects/hack_audio_MoorerReverb.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_MOORERREVERB_H 25 | #define HACK_AUDIO_MOORERREVERB_H 26 | 27 | struct MoorerReverb : public HackAudio::Diagram 28 | { 29 | HackAudio::Label earlyRef_label; 30 | 31 | HackAudio::Label comb_2_label; 32 | HackAudio::Label comb_3_label; 33 | HackAudio::Label comb_4_label; 34 | HackAudio::Label comb_5_label; 35 | HackAudio::Label comb_6_label; 36 | HackAudio::Label comb_7_label; 37 | 38 | HackAudio::Diagram::Junction comb_sum; 39 | 40 | HackAudio::Label apf_1_label; 41 | HackAudio::Label apf_2_label; 42 | HackAudio::Label apf_3_label; 43 | 44 | HackAudio::Diagrams::EarlyReflections earlyRef_diag; 45 | 46 | HackAudio::Diagrams::LPCombFilter comb_2_diag; 47 | HackAudio::Diagrams::LPCombFilter comb_3_diag; 48 | HackAudio::Diagrams::LPCombFilter comb_4_diag; 49 | HackAudio::Diagrams::LPCombFilter comb_5_diag; 50 | HackAudio::Diagrams::LPCombFilter comb_6_diag; 51 | HackAudio::Diagrams::LPCombFilter comb_7_diag; 52 | 53 | 54 | HackAudio::Diagrams::AllpassFilter apf_1_diag; 55 | HackAudio::Diagrams::AllpassFilter apf_2_diag; 56 | HackAudio::Diagrams::AllpassFilter apf_3_diag; 57 | 58 | MoorerReverb() 59 | { 60 | earlyRef_label.setPlaceholder("ER"); 61 | earlyRef_label.setBounds(0,-8,72,64); 62 | 63 | comb_2_label.setPlaceholder("LPCF"); 64 | comb_2_label.setBounds(240, -90, 64, 48); 65 | comb_3_label.setPlaceholder("LPCF"); 66 | comb_3_label.setBounds(155, -55, 64, 48); 67 | comb_4_label.setPlaceholder("LPCF"); 68 | comb_4_label.setBounds(240, -20, 64, 48); 69 | comb_5_label.setPlaceholder("LPCF"); 70 | comb_5_label.setBounds(155, 20, 64, 48); 71 | comb_6_label.setPlaceholder("LPCF"); 72 | comb_6_label.setBounds(240, 55, 64, 48); 73 | comb_7_label.setPlaceholder("LPCF"); 74 | comb_7_label.setBounds(155, 90, 64, 48); 75 | 76 | 77 | comb_sum.setSymbol(HackAudio::Diagram::Junction::Add); 78 | comb_sum.setBounds(350, 10, 30, 30); 79 | 80 | apf_1_label.setPlaceholder("APF"); 81 | apf_1_label.setBounds(425, 0, 64, 48); 82 | apf_2_label.setPlaceholder("APF"); 83 | apf_2_label.setBounds(525, 0, 64, 48); 84 | apf_3_label.setPlaceholder("APF"); 85 | apf_3_label.setBounds(625, 0, 64, 48); 86 | 87 | addDiagramInput(earlyRef_label); 88 | connect(earlyRef_label,comb_2_label); 89 | connect(earlyRef_label,comb_3_label); 90 | connect(earlyRef_label,comb_4_label); 91 | connect(earlyRef_label,comb_5_label); 92 | connect(earlyRef_label,comb_6_label); 93 | connect(earlyRef_label,comb_7_label); 94 | 95 | connect(comb_2_label, comb_sum); 96 | connect(comb_3_label, comb_sum); 97 | connect(comb_4_label, comb_sum); 98 | connect(comb_5_label, comb_sum); 99 | connect(comb_6_label, comb_sum); 100 | connect(comb_7_label, comb_sum); 101 | 102 | connect(comb_sum, apf_1_label); 103 | connect(apf_1_label, apf_2_label); 104 | connect(apf_2_label, apf_3_label); 105 | 106 | addDiagramOutput(apf_3_label); 107 | 108 | setSubDiagram(comb_2_label, comb_2_diag); 109 | setSubDiagram(comb_3_label, comb_3_diag); 110 | setSubDiagram(comb_4_label, comb_4_diag); 111 | setSubDiagram(comb_5_label, comb_5_diag); 112 | setSubDiagram(comb_6_label, comb_6_diag); 113 | setSubDiagram(comb_7_label, comb_7_diag); 114 | 115 | setSubDiagram(apf_1_label, apf_1_diag); 116 | setSubDiagram(apf_2_label, apf_2_diag); 117 | setSubDiagram(apf_3_label, apf_3_diag); 118 | 119 | setSubDiagram(earlyRef_label, earlyRef_diag); 120 | 121 | setName("Moorer Reverb"); 122 | 123 | } 124 | 125 | }; 126 | 127 | #endif 128 | -------------------------------------------------------------------------------- /diagrams/effects/hack_audio_SchroederReverb.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_SCHROEDERREVERB_H 25 | #define HACK_AUDIO_SCHROEDERREVERB_H 26 | 27 | struct SchroederReverb : public HackAudio::Diagram 28 | { 29 | 30 | HackAudio::Label comb_1_label; 31 | HackAudio::Label comb_2_label; 32 | HackAudio::Label comb_3_label; 33 | HackAudio::Label comb_4_label; 34 | HackAudio::Label comb_5_label; 35 | HackAudio::Label comb_6_label; 36 | HackAudio::Label comb_7_label; 37 | HackAudio::Label comb_8_label; 38 | 39 | HackAudio::Diagram::Junction comb_sum; 40 | 41 | HackAudio::Label apf_1_label; 42 | HackAudio::Label apf_2_label; 43 | HackAudio::Label apf_3_label; 44 | 45 | HackAudio::Diagrams::CombFilter comb_1_diag; 46 | HackAudio::Diagrams::CombFilter comb_2_diag; 47 | HackAudio::Diagrams::CombFilter comb_3_diag; 48 | HackAudio::Diagrams::CombFilter comb_4_diag; 49 | HackAudio::Diagrams::CombFilter comb_5_diag; 50 | HackAudio::Diagrams::CombFilter comb_6_diag; 51 | HackAudio::Diagrams::CombFilter comb_7_diag; 52 | HackAudio::Diagrams::CombFilter comb_8_diag; 53 | 54 | HackAudio::Diagrams::AllpassFilter apf_1_diag; 55 | HackAudio::Diagrams::AllpassFilter apf_2_diag; 56 | HackAudio::Diagrams::AllpassFilter apf_3_diag; 57 | 58 | SchroederReverb() 59 | { 60 | 61 | comb_1_label.setPlaceholder("FBCF"); 62 | comb_1_label.setBounds(65, -125, 64, 48); 63 | comb_2_label.setPlaceholder("FBCF"); 64 | comb_2_label.setBounds(150, -90, 64, 48); 65 | comb_3_label.setPlaceholder("FBCF"); 66 | comb_3_label.setBounds(65, -55, 64, 48); 67 | comb_4_label.setPlaceholder("FBCF"); 68 | comb_4_label.setBounds(150, -20, 64, 48); 69 | comb_5_label.setPlaceholder("FBCF"); 70 | comb_5_label.setBounds(65, 20, 64, 48); 71 | comb_6_label.setPlaceholder("FBCF"); 72 | comb_6_label.setBounds(150, 55, 64, 48); 73 | comb_7_label.setPlaceholder("FBCF"); 74 | comb_7_label.setBounds(65, 90, 64, 48); 75 | comb_8_label.setPlaceholder("FBCF"); 76 | comb_8_label.setBounds(150, 125, 64, 48); 77 | 78 | comb_sum.setSymbol(HackAudio::Diagram::Junction::Add); 79 | comb_sum.setBounds(300, 10, 30, 30); 80 | 81 | apf_1_label.setPlaceholder("APF"); 82 | apf_1_label.setBounds(384, 0, 64, 48); 83 | apf_2_label.setPlaceholder("APF"); 84 | apf_2_label.setBounds(512, 0, 64, 48); 85 | apf_3_label.setPlaceholder("APF"); 86 | apf_3_label.setBounds(640, 0, 64, 48); 87 | 88 | addDiagramInput(comb_1_label); 89 | addDiagramInput(comb_2_label); 90 | addDiagramInput(comb_3_label); 91 | addDiagramInput(comb_4_label); 92 | addDiagramInput(comb_5_label); 93 | addDiagramInput(comb_6_label); 94 | addDiagramInput(comb_7_label); 95 | addDiagramInput(comb_8_label); 96 | 97 | connect(comb_1_label, comb_sum); 98 | connect(comb_2_label, comb_sum); 99 | connect(comb_3_label, comb_sum); 100 | connect(comb_4_label, comb_sum); 101 | connect(comb_5_label, comb_sum); 102 | connect(comb_6_label, comb_sum); 103 | connect(comb_7_label, comb_sum); 104 | connect(comb_8_label, comb_sum); 105 | 106 | connect(comb_sum, apf_1_label); 107 | connect(apf_1_label, apf_2_label); 108 | connect(apf_2_label, apf_3_label); 109 | 110 | addDiagramOutput(apf_3_label); 111 | 112 | setSubDiagram(comb_1_label, comb_1_diag); 113 | setSubDiagram(comb_2_label, comb_2_diag); 114 | setSubDiagram(comb_3_label, comb_3_diag); 115 | setSubDiagram(comb_4_label, comb_4_diag); 116 | setSubDiagram(comb_5_label, comb_5_diag); 117 | setSubDiagram(comb_6_label, comb_6_diag); 118 | setSubDiagram(comb_7_label, comb_7_diag); 119 | setSubDiagram(comb_8_label, comb_8_diag); 120 | 121 | setSubDiagram(apf_1_label, apf_1_diag); 122 | setSubDiagram(apf_2_label, apf_2_diag); 123 | setSubDiagram(apf_3_label, apf_3_diag); 124 | 125 | setName("Schroeder Reverb"); 126 | 127 | } 128 | 129 | }; 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /diagrams/filters/hack_audio_AllpassFilter.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_ALLPASS_H 25 | #define HACK_AUDIO_ALLPASS_H 26 | 27 | struct AllpassFilter : public HackAudio::Diagram 28 | { 29 | 30 | HackAudio::Label main_delay; 31 | HackAudio::Diagram::Junction main_sum_1; 32 | HackAudio::Diagram::Junction main_sum_2; 33 | 34 | HackAudio::Label fb_gain; 35 | HackAudio::Diagram::Junction fb_mult; 36 | HackAudio::Diagram::Junction fb_node; 37 | 38 | HackAudio::Label ff_gain; 39 | HackAudio::Diagram::Junction ff_mult; 40 | HackAudio::Diagram::Junction ff_node; 41 | 42 | HackAudio::Diagrams::Moddelay moddelay_diag; 43 | 44 | AllpassFilter() 45 | { 46 | 47 | main_delay.setPlaceholder("Delay"); 48 | main_delay.setBounds(325, -8, 96, 64); 49 | main_sum_1.setSymbol(HackAudio::Diagram::Junction::Add); 50 | main_sum_1.setBounds(200, 9, 30, 30); 51 | main_sum_2.setSymbol(HackAudio::Diagram::Junction::Add); 52 | main_sum_2.setBounds(550, 9, 30, 30); 53 | 54 | fb_gain.setPlaceholder("Gain"); 55 | fb_gain.setBounds(130, -100, 64, 48); 56 | fb_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 57 | fb_mult.setBounds(275, -50, 30, 30); 58 | fb_node.setSymbol(HackAudio::Diagram::Junction::None); 59 | fb_node.setBounds(475, 15, 15, 15); 60 | 61 | ff_gain.setPlaceholder("Gain"); 62 | ff_gain.setBounds(540, 100, 64, 48); 63 | ff_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 64 | ff_mult.setBounds(450, 70, 30, 30); 65 | ff_node.setSymbol(HackAudio::Diagram::Junction::None); 66 | ff_node.setBounds(250, 15, 15, 15); 67 | 68 | addDiagramInput(main_sum_1); 69 | 70 | connect(main_sum_1, main_delay); 71 | connect(main_delay, main_sum_2); 72 | 73 | connect(fb_node, fb_mult); 74 | connect(fb_gain, fb_mult); 75 | connect(fb_mult, main_sum_1,HackAudio::Diagram::Junction::Horizontal); 76 | 77 | connect(ff_node, ff_mult); 78 | connect(ff_gain, ff_mult); 79 | connect(ff_mult, main_sum_2, HackAudio::Diagram::Junction::Horizontal); 80 | 81 | addDiagramOutput(main_sum_2); 82 | 83 | setName("All-Pass Filter"); 84 | 85 | setSubDiagram(main_delay, moddelay_diag); 86 | 87 | } 88 | 89 | }; 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /diagrams/filters/hack_audio_BiquadFilter.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_BIQUADFILTER_H 25 | #define HACK_AUDIO_BIQUADFILTER_H 26 | 27 | struct BiquadFilter : public HackAudio::Diagram 28 | { 29 | 30 | HackAudio::Label main_dry; 31 | HackAudio::Diagram::Junction main_sum; 32 | HackAudio::Diagram::Junction main_mult; 33 | 34 | HackAudio::Label ff_1_delay; 35 | HackAudio::Label ff_1_gain; 36 | HackAudio::Diagram::Junction ff_1_mult; 37 | 38 | HackAudio::Label ff_2_delay; 39 | HackAudio::Label ff_2_gain; 40 | HackAudio::Diagram::Junction ff_2_mult; 41 | 42 | HackAudio::Label fb_1_delay; 43 | HackAudio::Label fb_1_gain; 44 | HackAudio::Diagram::Junction fb_1_mult; 45 | 46 | HackAudio::Label fb_2_delay; 47 | HackAudio::Label fb_2_gain; 48 | HackAudio::Diagram::Junction fb_2_mult; 49 | 50 | HackAudio::Diagram::Junction fb_node; 51 | 52 | BiquadFilter() 53 | { 54 | 55 | main_dry.setPlaceholder("b_0"); 56 | main_dry.setBounds(85, -48, 55, 32); 57 | main_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 58 | main_mult.setBounds(176, 5, 30, 30); 59 | main_sum.setSymbol(HackAudio::Diagram::Junction::Add); 60 | main_sum.setBounds(250, 5, 30, 30); 61 | 62 | ff_1_delay.setText("z^{-1}", juce::dontSendNotification); 63 | ff_1_delay.setBounds(0, -115, 64, 40); 64 | ff_1_gain.setPlaceholder("b_1"); 65 | ff_1_gain.setBounds(85, -150, 55, 32); 66 | ff_1_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 67 | ff_1_mult.setBounds(176, -110, 30, 30); 68 | 69 | ff_2_delay.setText("z^{-2}", juce::dontSendNotification); 70 | ff_2_delay.setBounds(0, -200, 64, 40); 71 | ff_2_gain.setPlaceholder("b_2"); 72 | ff_2_gain.setBounds(85, -230, 55, 32); 73 | ff_2_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 74 | ff_2_mult.setBounds(176, -195, 30, 30); 75 | 76 | fb_1_delay.setText("z^{-1}", juce::dontSendNotification); 77 | fb_1_delay.setBounds(512, -115, 64, 40); 78 | fb_1_gain.setPlaceholder("-a_1"); 79 | fb_1_gain.setBounds(410, -150, 55, 32); 80 | fb_1_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 81 | fb_1_mult.setBounds(336, -110, 30, 30); 82 | 83 | fb_2_delay.setText("z^{-2}", juce::dontSendNotification); 84 | fb_2_delay.setBounds(512, -200, 64, 40); 85 | fb_2_gain.setPlaceholder("-a_2"); 86 | fb_2_gain.setBounds(410, -230, 55, 32); 87 | fb_2_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 88 | fb_2_mult.setBounds(336, -195, 30, 30); 89 | 90 | fb_node.setSymbol(HackAudio::Diagram::Junction::None); 91 | fb_node.setBounds(625, 12, 15, 15); 92 | 93 | addDiagramInput(main_mult); 94 | addDiagramInput(ff_1_delay); 95 | addDiagramInput(ff_2_delay); 96 | 97 | connect(main_dry, main_mult); 98 | connect(main_mult, main_sum); 99 | 100 | connect(ff_1_delay, ff_1_mult); 101 | connect(ff_1_gain, ff_1_mult); 102 | connect(ff_1_mult, main_sum, HackAudio::Diagram::Junction::Horizontal); 103 | 104 | connect(ff_2_delay, ff_2_mult); 105 | connect(ff_2_gain, ff_2_mult); 106 | connect(ff_2_mult, main_sum, HackAudio::Diagram::Junction::Horizontal); 107 | 108 | connect(fb_1_delay, fb_1_mult); 109 | connect(fb_1_gain, fb_1_mult); 110 | connect(fb_1_mult, main_sum, HackAudio::Diagram::Junction::Horizontal); 111 | 112 | connect(fb_2_delay, fb_2_mult); 113 | connect(fb_2_gain, fb_2_mult); 114 | connect(fb_2_mult, main_sum, HackAudio::Diagram::Junction::Horizontal); 115 | 116 | connect(fb_node, fb_1_delay); 117 | connect(fb_node, fb_2_delay); 118 | 119 | addDiagramOutput(main_sum); 120 | 121 | setName("Bi-Quad Low-Pass Filter"); 122 | 123 | } 124 | 125 | }; 126 | 127 | #endif 128 | -------------------------------------------------------------------------------- /diagrams/filters/hack_audio_CombFilter.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_COMBFILTER_H 25 | #define HACK_AUDIO_COMBFILTER_H 26 | 27 | struct CombFilter : public HackAudio::Diagram 28 | { 29 | 30 | HackAudio::Label main_delay; 31 | HackAudio::Diagram::Junction main_sum; 32 | HackAudio::Diagram::Junction main_mult; 33 | 34 | HackAudio::Label fb_gain; 35 | HackAudio::Diagram::Junction fb_node; 36 | 37 | HackAudio::Diagrams::Moddelay moddelay_diag; 38 | 39 | CombFilter() 40 | { 41 | 42 | main_sum.setSymbol(HackAudio::Diagram::Junction::Add); 43 | main_sum.setBounds(250, 10, 30, 30); 44 | main_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 45 | main_mult.setBounds(300, -64, 30, 30); 46 | main_delay.setPlaceholder("Delay"); 47 | main_delay.setBounds(400, -7.5, 96, 64); 48 | 49 | fb_gain.setPlaceholder("Gain"); 50 | fb_gain.setBounds(350, -128, 64, 48); 51 | fb_node.setSymbol(HackAudio::Diagram::Junction::None); 52 | fb_node.setBounds(550, 17, 15, 15); 53 | 54 | addDiagramInput(main_sum); 55 | 56 | connect(main_sum, main_delay); 57 | connect(fb_node, main_mult); 58 | connect(fb_gain, main_mult); 59 | connect(main_mult, main_sum, HackAudio::Diagram::Junction::Horizontal); 60 | connect(main_delay, fb_node); 61 | 62 | addDiagramOutput(fb_node); 63 | 64 | setName("Feed-Back Comb Filter"); 65 | 66 | setSubDiagram(main_delay, moddelay_diag); 67 | 68 | } 69 | 70 | }; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /diagrams/filters/hack_audio_DampingFilter.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_DAMPINGFILTER_H 25 | #define HACK_AUDIO_DAMPINGFILTER_H 26 | 27 | struct DampingFilter : public HackAudio::Diagram 28 | { 29 | 30 | HackAudio::Label main_delay; 31 | HackAudio::Diagram::Junction main_sum; 32 | HackAudio::Diagram::Junction main_mult; 33 | 34 | HackAudio::Label fb_gain; 35 | HackAudio::Diagram::Junction fb_node; 36 | 37 | HackAudio::Diagram::Junction ff_mult; 38 | HackAudio::Label ff_gain; 39 | 40 | 41 | DampingFilter() 42 | { 43 | 44 | main_sum.setSymbol(HackAudio::Diagram::Junction::Add); 45 | main_sum.setBounds(250, 10, 30, 30); 46 | main_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 47 | main_mult.setBounds(300, -64, 30, 30); 48 | main_delay.setPlaceholder("z^{-1}"); 49 | main_delay.setBounds(400, -81, 96, 64); 50 | 51 | fb_gain.setPlaceholder("Gain"); 52 | fb_gain.setBounds(200, -128, 64, 48); 53 | fb_node.setSymbol(HackAudio::Diagram::Junction::None); 54 | fb_node.setBounds(550, 17, 15, 15); 55 | 56 | ff_gain.setPlaceholder("Gain"); 57 | ff_gain.setBounds(100, -64, 64, 48); 58 | ff_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 59 | ff_mult.setBounds(180, 10, 30, 30); 60 | 61 | addDiagramInput(ff_mult); 62 | connect(ff_gain,ff_mult); 63 | connect(ff_mult,main_sum); 64 | //connect(main_sum, main_delay); 65 | connect(fb_node, main_delay); 66 | connect(main_delay, main_mult); 67 | connect(fb_gain, main_mult); 68 | connect(main_mult, main_sum,HackAudio::Diagram::Junction::Horizontal); 69 | 70 | addDiagramOutput(main_sum); 71 | 72 | setName("Feed-Back Comb Filter"); 73 | 74 | 75 | 76 | } 77 | 78 | }; 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /diagrams/filters/hack_audio_LPCombFilter.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_LPCOMBFILTER_H 25 | #define HACK_AUDIO_LPCOMBFILTER_H 26 | 27 | struct LPCombFilter : public HackAudio::Diagram 28 | { 29 | 30 | HackAudio::Label delay_1; 31 | HackAudio::Label fb_1_gain; 32 | HackAudio::Diagram::Junction sum_1; 33 | HackAudio::Diagram::Junction mult_1; 34 | HackAudio::Diagram::Junction fb_1_node; 35 | 36 | HackAudio::Diagram::Junction sum_2; 37 | HackAudio::Diagram::Junction mult_2; 38 | HackAudio::Label delay_2; 39 | HackAudio::Label fb_gain2; 40 | HackAudio::Diagram::Junction fb_2_node; 41 | 42 | HackAudio::Diagrams::Moddelay moddelay_diag; 43 | 44 | LPCombFilter() 45 | { 46 | 47 | sum_1.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 48 | sum_1.setBounds(250,0,30,30); 49 | mult_1.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 50 | mult_1.setBounds(300,-64,30,30); 51 | delay_1.setPlaceholder("Delay"); 52 | delay_1.setBounds(400,-17,96,64); 53 | fb_1_gain.setPlaceholder("Gain"); 54 | fb_1_gain.setBounds(200,-128,64,48); 55 | fb_1_node.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 56 | fb_1_node.setBounds(550,8,15,15); 57 | 58 | sum_2.setSymbol(HackAudio::Diagram::Junction::Symbol::Add); 59 | sum_2.setBounds(500,-64,30,30); 60 | mult_2.setSymbol(HackAudio::Diagram::Junction::Symbol::Multiply); 61 | mult_2.setBounds(440,-125,30,30); 62 | delay_2.setPlaceholder("z^{-1}"); 63 | delay_2.setBounds(400,-72,64,48); 64 | 65 | fb_gain2.setPlaceholder("Gain"); 66 | fb_gain2.setBounds(500,-160,64,48); 67 | fb_2_node.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 68 | fb_2_node.setBounds(350,-56.5,15,15); 69 | 70 | addDiagramInput(sum_1); 71 | 72 | connect(sum_1,delay_1,HackAudio::Diagram::Junction::Horizontal); 73 | connect(delay_1, fb_1_node); 74 | connect(fb_1_node,sum_2); 75 | connect(fb_1_gain,mult_1); 76 | connect(sum_2,delay_2); 77 | connect(delay_2,mult_1); 78 | connect(fb_2_node,mult_2); 79 | connect(fb_gain2,mult_2); 80 | connect(mult_2,sum_2,HackAudio::Diagram::Junction::Horizontal); 81 | connect(mult_1,sum_1,HackAudio::Diagram::Junction::Horizontal); 82 | 83 | addDiagramOutput(fb_1_node); 84 | 85 | setName("Low-Pass, Feed-Back Comb Filter"); 86 | 87 | setSubDiagram(delay_1, moddelay_diag); 88 | } 89 | 90 | }; 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /diagrams/filters/hack_audio_NestedallpassFilter.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_NESTEDALLPASS_H 25 | #define HACK_AUDIO_NESTEDALLPASS_H 26 | 27 | struct NestedallpassFilter : public HackAudio::Diagram 28 | { 29 | 30 | HackAudio::Label main_delay; 31 | HackAudio::Diagram::Junction main_sum_1; 32 | HackAudio::Diagram::Junction main_sum_2; 33 | 34 | HackAudio::Label fb_gain; 35 | HackAudio::Diagram::Junction fb_mult; 36 | HackAudio::Diagram::Junction fb_node; 37 | 38 | HackAudio::Label ff_gain; 39 | HackAudio::Diagram::Junction ff_mult; 40 | HackAudio::Diagram::Junction ff_node; 41 | 42 | HackAudio::Label apf_label; 43 | 44 | HackAudio::Diagrams::AllpassFilter apf_diag; 45 | 46 | NestedallpassFilter() 47 | { 48 | apf_label.setPlaceholder("APF"); 49 | apf_label.setBounds(445, -8, 96, 64); 50 | 51 | main_delay.setPlaceholder("Delay"); 52 | main_delay.setBounds(315, -8, 96, 64); 53 | main_sum_1.setSymbol(HackAudio::Diagram::Junction::Add); 54 | main_sum_1.setBounds(200, 9, 30, 30); 55 | main_sum_2.setSymbol(HackAudio::Diagram::Junction::Add); 56 | main_sum_2.setBounds(650, 9, 30, 30); 57 | 58 | fb_gain.setPlaceholder("Gain"); 59 | fb_gain.setBounds(130, -100, 64, 48); 60 | fb_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 61 | fb_mult.setBounds(275, -50, 30, 30); 62 | fb_node.setSymbol(HackAudio::Diagram::Junction::None); 63 | fb_node.setBounds(575, 15, 15, 15); 64 | 65 | ff_gain.setPlaceholder("Gain"); 66 | ff_gain.setBounds(640, 100, 64, 48); 67 | ff_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 68 | ff_mult.setBounds(550, 70, 30, 30); 69 | ff_node.setSymbol(HackAudio::Diagram::Junction::None); 70 | ff_node.setBounds(250, 15, 15, 15); 71 | 72 | addDiagramInput(main_sum_1); 73 | 74 | connect(main_sum_1, main_delay); 75 | connect(main_delay, apf_label); 76 | connect(apf_label, main_sum_2); 77 | 78 | connect(fb_node, fb_mult); 79 | connect(fb_gain, fb_mult); 80 | connect(fb_mult, main_sum_1,HackAudio::Diagram::Junction::Horizontal); 81 | 82 | connect(ff_node, ff_mult); 83 | connect(ff_gain, ff_mult); 84 | connect(ff_mult, main_sum_2, HackAudio::Diagram::Junction::Horizontal); 85 | 86 | addDiagramOutput(main_sum_2); 87 | 88 | setName("Nested All-Pass Filter"); 89 | 90 | setSubDiagram(apf_label, apf_diag); 91 | 92 | } 93 | 94 | }; 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /diagrams/filters/hack_audio_NestedtwoFilter.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_NESTEDTWOFILTER_H 25 | #define HACK_AUDIO_NESTEDTWOFILTER_H 26 | 27 | struct NestedtwoFilter : public HackAudio::Diagram 28 | { 29 | 30 | HackAudio::Label main_delay; 31 | HackAudio::Diagram::Junction main_sum_1; 32 | HackAudio::Diagram::Junction main_sum_2; 33 | 34 | HackAudio::Label fb_gain; 35 | HackAudio::Diagram::Junction fb_mult; 36 | HackAudio::Diagram::Junction fb_node; 37 | 38 | HackAudio::Label ff_gain; 39 | HackAudio::Diagram::Junction ff_mult; 40 | HackAudio::Diagram::Junction ff_node; 41 | 42 | HackAudio::Label apf_1_label; 43 | HackAudio::Label apf_2_label; 44 | 45 | HackAudio::Diagrams::AllpassFilter apf_1_diag; 46 | HackAudio::Diagrams::AllpassFilter apf_2_diag; 47 | 48 | NestedtwoFilter() 49 | { 50 | apf_1_label.setPlaceholder("APF"); 51 | apf_1_label.setBounds(410, -4, 88, 56); 52 | apf_2_label.setPlaceholder("APF"); 53 | apf_2_label.setBounds(520, -4, 88, 56); 54 | 55 | main_delay.setPlaceholder("Delay"); 56 | main_delay.setBounds(300, -4, 88, 56); 57 | main_sum_1.setSymbol(HackAudio::Diagram::Junction::Add); 58 | main_sum_1.setBounds(200, 9, 30, 30); 59 | main_sum_2.setSymbol(HackAudio::Diagram::Junction::Add); 60 | main_sum_2.setBounds(650, 9, 30, 30); 61 | 62 | fb_gain.setPlaceholder("Gain"); 63 | fb_gain.setBounds(130, -100, 64, 48); 64 | fb_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 65 | fb_mult.setBounds(275, -50, 30, 30); 66 | fb_node.setSymbol(HackAudio::Diagram::Junction::None); 67 | fb_node.setBounds(630, 15, 15, 15); 68 | 69 | ff_gain.setPlaceholder("Gain"); 70 | ff_gain.setBounds(640, 100, 64, 48); 71 | ff_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 72 | ff_mult.setBounds(550, 70, 30, 30); 73 | ff_node.setSymbol(HackAudio::Diagram::Junction::None); 74 | ff_node.setBounds(250, 15, 15, 15); 75 | 76 | addDiagramInput(main_sum_1); 77 | 78 | connect(main_sum_1, main_delay); 79 | connect(main_delay, apf_1_label); 80 | connect(apf_1_label, apf_2_label); 81 | connect(apf_2_label, main_sum_2); 82 | 83 | connect(fb_node, fb_mult); 84 | connect(fb_gain, fb_mult); 85 | connect(fb_mult, main_sum_1,HackAudio::Diagram::Junction::Horizontal); 86 | 87 | connect(ff_node, ff_mult); 88 | connect(ff_gain, ff_mult); 89 | connect(ff_mult, main_sum_2, HackAudio::Diagram::Junction::Horizontal); 90 | 91 | addDiagramOutput(main_sum_2); 92 | 93 | setName("Double-Nested, All-Pass Filter"); 94 | 95 | setSubDiagram(apf_1_label, apf_1_diag); 96 | setSubDiagram(apf_2_label, apf_2_diag); 97 | 98 | } 99 | 100 | }; 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /diagrams/hack_audio_Diagrams.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_DIAGRAMS_H 25 | #define HACK_AUDIO_DIAGRAMS_H 26 | 27 | namespace HackAudio 28 | { 29 | 30 | namespace Diagrams 31 | { 32 | 33 | #include "utils/hack_audio_Gain.h" 34 | #include "utils/hack_audio_preDelay.h" 35 | #include "utils/hack_audio_Moddelay.h" 36 | 37 | #include "filters/hack_audio_AllpassFilter.h" 38 | #include "filters/hack_audio_CombFilter.h" 39 | #include "filters/hack_audio_DampingFilter.h" 40 | #include "filters/hack_audio_LPCombFilter.h" 41 | #include "filters/hack_audio_BiquadFilter.h" 42 | #include "filters/hack_audio_NestedallpassFilter.h" 43 | #include "filters/hack_audio_NestedtwoFilter.h" 44 | 45 | #include "effects/hack_audio_SchroederReverb.h" 46 | #include "effects/hack_audio_EarlyReflections.h" 47 | #include "effects/hack_audio_MoorerReverb.h" 48 | #include "effects/hack_audio_FDNReverb.h" 49 | #include "effects/hack_audio_DattorroReverb.h" 50 | #include "effects/hack_audio_GardnersmallReverb.h" 51 | #include "effects/hack_audio_GardnermediumReverb.h" 52 | #include "effects/hack_audio_GardnerlargeReverb.h" 53 | 54 | }; 55 | 56 | } 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /diagrams/utils/hack_audio_Gain.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_GAIN_H 25 | #define HACK_AUDIO_GAIN_H 26 | 27 | struct Gain : public HackAudio::Diagram 28 | { 29 | 30 | HackAudio::Label main_db; 31 | HackAudio::Label main_linear; 32 | HackAudio::Diagram::Junction main_mult; 33 | 34 | Gain() 35 | { 36 | 37 | setName("Gain"); 38 | 39 | main_db.setPlaceholder("Decibel"); 40 | main_db.setBounds(0, -64, 96, 64); 41 | 42 | main_linear.setPlaceholder("10^{(dB/20)}"); 43 | main_linear.setBounds(256, -64, 128, 64); 44 | 45 | main_mult.setSymbol(HackAudio::Diagram::Junction::Multiply); 46 | main_mult.setBounds(512, 64, 40, 40); 47 | 48 | addDiagramInput(main_mult); 49 | 50 | connect(main_db, main_linear); 51 | connect(main_linear, main_mult); 52 | 53 | addDiagramOutput(main_mult); 54 | 55 | } 56 | 57 | }; 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /diagrams/utils/hack_audio_Moddelay.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_MODDELAY_H 25 | #define HACK_AUDIO_MODDELAY_H 26 | 27 | struct Moddelay : public HackAudio::Diagram 28 | { 29 | 30 | HackAudio::Label main_lfo; 31 | HackAudio::Label main_delay; 32 | HackAudio::Diagram::Junction main_node; 33 | 34 | Moddelay() 35 | { 36 | 37 | setName("Modulated Delay"); 38 | 39 | main_lfo.setPlaceholder("LFO"); 40 | main_lfo.setBounds(0, -80, 96, 64); 41 | 42 | main_delay.setPlaceholder("z^{-0}"); 43 | main_delay.setBounds(150, 0, 128, 64); 44 | 45 | main_node.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 46 | main_node.setBounds(214,0,0,0); 47 | 48 | addDiagramInput(main_delay); 49 | 50 | connect(main_lfo, main_node); 51 | 52 | addDiagramOutput(main_delay); 53 | 54 | } 55 | 56 | }; 57 | 58 | #endif 59 | 60 | -------------------------------------------------------------------------------- /diagrams/utils/hack_audio_preDelay.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_PREDELAY_H 25 | #define HACK_AUDIO_PREDELAY_H 26 | 27 | struct Predelay : public HackAudio::Diagram 28 | { 29 | 30 | HackAudio::Label main_ms; 31 | HackAudio::Label main_delay; 32 | HackAudio::Diagram::Junction main_node; 33 | 34 | Predelay() 35 | { 36 | 37 | setName("Pre-delay"); 38 | 39 | main_ms.setPlaceholder("Milliseconds"); 40 | main_ms.setBounds(0, -80, 96, 64); 41 | 42 | main_delay.setPlaceholder("Samples of\nDelay"); 43 | main_delay.setBounds(150, 0, 128, 64); 44 | 45 | main_node.setSymbol(HackAudio::Diagram::Junction::Symbol::None); 46 | main_node.setBounds(214,0,0,0); 47 | 48 | addDiagramInput(main_delay); 49 | 50 | connect(main_ms, main_node); 51 | 52 | addDiagramOutput(main_delay); 53 | 54 | } 55 | 56 | }; 57 | 58 | #endif 59 | 60 | -------------------------------------------------------------------------------- /docs/baumans/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Cyreal (www.cyreal.org), 2 | with Reserved Font Name "Baumans". 3 | 4 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 5 | This license is copied below, and is also available with a FAQ at: 6 | http://scripts.sil.org/OFL 7 | 8 | 9 | ----------------------------------------------------------- 10 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 11 | ----------------------------------------------------------- 12 | 13 | PREAMBLE 14 | The goals of the Open Font License (OFL) are to stimulate worldwide 15 | development of collaborative font projects, to support the font creation 16 | efforts of academic and linguistic communities, and to provide a free and 17 | open framework in which fonts may be shared and improved in partnership 18 | with others. 19 | 20 | The OFL allows the licensed fonts to be used, studied, modified and 21 | redistributed freely as long as they are not sold by themselves. The 22 | fonts, including any derivative works, can be bundled, embedded, 23 | redistributed and/or sold with any software provided that any reserved 24 | names are not used by derivative works. The fonts and derivatives, 25 | however, cannot be released under any other type of license. The 26 | requirement for fonts to remain under this license does not apply 27 | to any document created using the fonts or their derivatives. 28 | 29 | DEFINITIONS 30 | "Font Software" refers to the set of files released by the Copyright 31 | Holder(s) under this license and clearly marked as such. This may 32 | include source files, build scripts and documentation. 33 | 34 | "Reserved Font Name" refers to any names specified as such after the 35 | copyright statement(s). 36 | 37 | "Original Version" refers to the collection of Font Software components as 38 | distributed by the Copyright Holder(s). 39 | 40 | "Modified Version" refers to any derivative made by adding to, deleting, 41 | or substituting -- in part or in whole -- any of the components of the 42 | Original Version, by changing formats or by porting the Font Software to a 43 | new environment. 44 | 45 | "Author" refers to any designer, engineer, programmer, technical 46 | writer or other person who contributed to the Font Software. 47 | 48 | PERMISSION & CONDITIONS 49 | Permission is hereby granted, free of charge, to any person obtaining 50 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 51 | redistribute, and sell modified and unmodified copies of the Font 52 | Software, subject to the following conditions: 53 | 54 | 1) Neither the Font Software nor any of its individual components, 55 | in Original or Modified Versions, may be sold by itself. 56 | 57 | 2) Original or Modified Versions of the Font Software may be bundled, 58 | redistributed and/or sold with any software, provided that each copy 59 | contains the above copyright notice and this license. These can be 60 | included either as stand-alone text files, human-readable headers or 61 | in the appropriate machine-readable metadata fields within text or 62 | binary files as long as those fields can be easily viewed by the user. 63 | 64 | 3) No Modified Version of the Font Software may use the Reserved Font 65 | Name(s) unless explicit written permission is granted by the corresponding 66 | Copyright Holder. This restriction only applies to the primary font name as 67 | presented to the users. 68 | 69 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 70 | Software shall not be used to promote, endorse or advertise any 71 | Modified Version, except to acknowledge the contribution(s) of the 72 | Copyright Holder(s) and the Author(s) or with their explicit written 73 | permission. 74 | 75 | 5) The Font Software, modified or unmodified, in part or in whole, 76 | must be distributed entirely under this license, and must not be 77 | distributed under any other license. The requirement for fonts to 78 | remain under this license does not apply to any document created 79 | using the Font Software. 80 | 81 | TERMINATION 82 | This license becomes null and void if any of the above conditions are 83 | not met. 84 | 85 | DISCLAIMER 86 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 87 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 88 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 89 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 90 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 91 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 92 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 93 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 94 | OTHER DEALINGS IN THE FONT SOFTWARE. 95 | -------------------------------------------------------------------------------- /docs/img/add-module.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackAudio/hack_audio_gui/7aacb7e2eb051308c81bfdc79bb6c4ed2446fa52/docs/img/add-module.png -------------------------------------------------------------------------------- /docs/img/background.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /docs/img/button.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/img/clone-module.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackAudio/hack_audio_gui/7aacb7e2eb051308c81bfdc79bb6c4ed2446fa52/docs/img/clone-module.png -------------------------------------------------------------------------------- /docs/img/knob.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /docs/img/meter.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/img/slider.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/index.css: -------------------------------------------------------------------------------- 1 | :root 2 | { 3 | 4 | --black: #10151D; 5 | --gray: #3E4C5C; 6 | --white: #FFFFFF; 7 | --cyan: #11F2DE; 8 | 9 | --clear-black: rgba(16, 21, 29, 0.6); 10 | --hidden-gray: #202830; 11 | 12 | background-color: var(--black); 13 | color: var(--white); 14 | 15 | font-family: 'NowRegular'; 16 | font-weight: normal; 17 | font-style: normal; 18 | 19 | } 20 | 21 | ::selection 22 | { 23 | 24 | background: var(--clear-black); 25 | 26 | } 27 | 28 | ::-moz-selection 29 | { 30 | 31 | background: var(--clear-black); 32 | 33 | } 34 | 35 | body, html 36 | { 37 | 38 | height: 100vh; 39 | width: 100vw; 40 | margin: 0px; 41 | overflow-x: hidden; 42 | overflow-y: hidden; 43 | 44 | } 45 | 46 | .nonSelectable 47 | { 48 | 49 | user-select: none; 50 | -moz-user-select: none; 51 | -khtml-user-select: none; 52 | -webkit-user-select: none; 53 | -o-user-select: none; 54 | 55 | } 56 | 57 | a:link, a:visited 58 | { 59 | 60 | color: var(--cyan); 61 | text-decoration: none; 62 | 63 | } 64 | 65 | a:hover 66 | { 67 | 68 | text-decoration: underline; 69 | 70 | } 71 | 72 | a:active 73 | { 74 | 75 | color: var(--black); 76 | text-decoration: none; 77 | 78 | } 79 | 80 | img 81 | { 82 | 83 | max-width: none; 84 | 85 | } 86 | 87 | .hFrame 88 | { 89 | 90 | width: 70vw; 91 | 92 | background-color: var(--gray); 93 | 94 | border-top-left-radius: 0px; 95 | border-top-right-radius: 24px; 96 | border-bottom-left-radius: 24px; 97 | border-bottom-right-radius: 0px; 98 | 99 | position: relative; 100 | 101 | padding: 48px; 102 | margin-top: 48px; 103 | margin-bottom: 48px; 104 | margin-left: auto; 105 | margin-right: auto; 106 | 107 | text-align: justify; 108 | 109 | box-shadow: 0px 25px 50px var(--clear-black); 110 | 111 | } 112 | 113 | .hWidget 114 | { 115 | 116 | box-shadow: 0px 25px 50px var(--clear-black); 117 | 118 | } 119 | 120 | .hWidgetContainer 121 | { 122 | 123 | margin-top: 128px; 124 | margin-left: 96px; 125 | margin-right: 96px; 126 | 127 | display: none; 128 | flex-direction: column; 129 | align-items: center; 130 | 131 | } 132 | 133 | .hTitle 134 | { 135 | 136 | font-family: 'Baumans', cursive; 137 | font-size: 32pt; 138 | 139 | } 140 | 141 | .hParallax 142 | { 143 | 144 | perspective: 0px; 145 | height: 100vh; 146 | overflow-x: hidden; 147 | overflow-y: auto; 148 | 149 | } 150 | 151 | .hParallaxLayer 152 | { 153 | position: absolute; 154 | top: 0; 155 | right: 0; 156 | bottom: 0; 157 | left: 0; 158 | } 159 | 160 | .hParallaxBack 161 | { 162 | 163 | display: none; 164 | 165 | } 166 | 167 | .hParallaxFront 168 | { 169 | 170 | transform: translateZ(0px) scale(1); 171 | 172 | } 173 | 174 | .hParallaxTop 175 | { 176 | 177 | display: none; 178 | 179 | } 180 | 181 | @media only screen and (min-width: 1024px) 182 | { 183 | 184 | .hFrame 185 | { 186 | 187 | width: 512px; 188 | 189 | } 190 | 191 | .hWidgetContainer 192 | { 193 | 194 | display: flex; 195 | 196 | } 197 | 198 | .hParallax 199 | { 200 | 201 | perspective: 1px; 202 | 203 | } 204 | 205 | .hParallaxBack 206 | { 207 | 208 | display: inline; 209 | transform: translateZ(-2px) scale(1.5) translateX(-50%); 210 | width: 100%; 211 | height: 100%; 212 | 213 | } 214 | 215 | .hParallaxFront 216 | { 217 | 218 | transform: translateZ(-1px) scale(2); 219 | 220 | } 221 | 222 | .hParallaxTop 223 | { 224 | 225 | display: inline; 226 | transform: translateZ(0px); 227 | 228 | } 229 | 230 | } 231 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HackAudio GUI 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 15 |
16 | 17 |
18 |
19 | 20 |
21 | 22 |
23 | 24 |
25 | 26 |
27 | 28 |
29 |
30 | 31 |
32 |
33 |
34 | hack 35 | audio 36 | gui 37 |
38 |
39 | 40 |
41 | about 42 |

43 | This JUCE module provides a custom interface for HackAudio plugins. 44 |
45 | 46 |
47 | installation 48 |

49 | To install this module, simply clone the repository into the modules folder of your JUCE installation. 50 |

51 | 52 |

53 | Once the module has been downloaded, you can import it with the Projucer! 54 |



55 | 56 |

57 |
58 | 59 |
60 | requirements 61 |

62 | This modules requires at least JUCE version 4.0. 63 |
64 | 65 |
66 | features 67 |

68 | This module customizes built-in JUCE components such as sliders, buttons, and labels, while also offering new components such as selectors, diagram displays, and meters! 69 |
70 | 71 |
72 |
73 |
74 |
75 |
76 | 77 | 78 | -------------------------------------------------------------------------------- /hack_audio_gui.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifdef HACK_AUDIO_UI_INCLUDED 25 | /* When you add this cpp file to your project, you mustn't include it in a file where you've 26 | already included any other headers - just put it inside a file on its own, possibly with your config 27 | flags preceding it, but don't include anything else. That also includes avoiding any automatic prefix 28 | header files that the compiler may be using. 29 | */ 30 | #error "Incorrect use of JUCE cpp file" 31 | #endif 32 | 33 | /* HackAudio GUI Configurations */ 34 | // ============================================================================= 35 | 36 | #define ANIMATION_SPEED 0.1 37 | #define ANIMATION_FPS 60 38 | 39 | #define CORNER_RADIUS 24 40 | #define CORNER_CONFIG CORNER_RADIUS, CORNER_RADIUS, false, true, true, false 41 | 42 | #define ROTARY_ANGLESTART ((7.0f * juce::float_Pi) / 6.0f) 43 | #define ROTARY_ANGLERANGE ((5.0f * juce::float_Pi) / 3.0f) 44 | 45 | #define DEFAULT_PIPMIN 6 46 | #define DEFAULT_PIPMAX 8 47 | 48 | #define MOUSEWHEEL_SENSITIVITY 128 49 | 50 | // ============================================================================= 51 | 52 | #include "hack_audio_gui.h" 53 | 54 | #include "utils/hack_audio_Colours.cpp" 55 | #include "utils/hack_audio_Fonts.cpp" 56 | 57 | #include "components/hack_audio_Selector.cpp" 58 | #include "components/hack_audio_Slider.cpp" 59 | #include "components/hack_audio_Button.cpp" 60 | #include "components/hack_audio_Label.cpp" 61 | #include "components/hack_audio_Meter.cpp" 62 | #include "components/hack_audio_Graph.cpp" 63 | 64 | #include "layout/hack_audio_Diagram.cpp" 65 | #include "layout/hack_audio_Viewport.cpp" 66 | #include "layout/hack_audio_FlexBox.cpp" 67 | -------------------------------------------------------------------------------- /hack_audio_gui.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | /* 25 | 26 | BEGIN_JUCE_MODULE_DECLARATION 27 | 28 | ID: hack_audio_gui 29 | vendor: HackAudio 30 | version: 0.1.0 31 | name: HackAudio GUI 32 | description: Custom JUCE UI for HackAudio Plugins 33 | website: http://www.hackaudio.com 34 | license: MIT 35 | 36 | END_JUCE_MODULE_DECLARATION 37 | 38 | */ 39 | 40 | #ifndef HACK_AUDIO_GUI_INCLUDED 41 | #define HACK_AUDIO_GUI_INCLUDED 42 | 43 | #include 44 | #include 45 | #include 46 | 47 | // ============================================================================= 48 | 49 | #include "utils/hack_audio_Colours.h" 50 | #include "utils/hack_audio_Fonts.h" 51 | #include "utils/hack_audio_NavigationButton.h" 52 | 53 | #include "components/hack_audio_Selector.h" 54 | #include "components/hack_audio_Slider.h" 55 | #include "components/hack_audio_Button.h" 56 | #include "components/hack_audio_Label.h" 57 | #include "components/hack_audio_Meter.h" 58 | #include "components/hack_audio_Graph.h" 59 | 60 | #include "layout/hack_audio_Diagram.h" 61 | #include "layout/hack_audio_Viewport.h" 62 | #include "layout/hack_audio_FlexBox.h" 63 | 64 | #include "diagrams/hack_audio_Diagrams.h" 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /hack_audio_gui.mm: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #include "hack_audio_gui.cpp" 25 | -------------------------------------------------------------------------------- /layout/hack_audio_Diagram.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_DIAGRAM_H 25 | #define HACK_AUDIO_DIAGRAM_H 26 | 27 | namespace HackAudio 28 | { 29 | 30 | /** 31 | A class that displays HackAudio::Labels in a signal flow diagram 32 | */ 33 | class Diagram : public juce::Component, 34 | private juce::ComponentListener 35 | { 36 | 37 | friend class Viewport; 38 | 39 | public: 40 | 41 | /** 42 | A circular junction for use in HackAudio::Diagrams 43 | */ 44 | class Junction : public juce::Component 45 | { 46 | 47 | friend Diagram; 48 | 49 | public: 50 | 51 | Junction(); 52 | ~Junction(); 53 | 54 | /** 55 | The mathematical operation symbol the junction will display 56 | */ 57 | enum Symbol 58 | { 59 | 60 | None, /**< An empty junction, usually used to represent a signal path splitting into multiple paths */ 61 | Add, /**< An addition junction */ 62 | Subtract, /**< A subtraction junction */ 63 | Divide, /**< A dividing junction */ 64 | Multiply, /**< A multiplying junction */ 65 | Power, /**< An exponential junction */ 66 | Sqrt, /**< A square root junction */ 67 | Average /**< An averaging junction */ 68 | 69 | }; 70 | 71 | /** 72 | The direction that the junction should connect from 73 | */ 74 | enum Direction 75 | { 76 | Null, /**< I forget */ 77 | Auto, /**< The diagram automatically picks the best direction in which to draw the connection */ 78 | Vertical, /**< The diagram only draws the connection from either the top or bottom of the junction */ 79 | Horizontal /**< The diagram only draws the connection from either the left or right of the junction */ 80 | }; 81 | 82 | /** 83 | Sets the junction's displayed symbol 84 | 85 | @see Symbol 86 | */ 87 | void setSymbol(Symbol s); 88 | 89 | private: 90 | 91 | void paint(juce::Graphics& g) override; 92 | 93 | juce::String currentSymbol; 94 | 95 | juce::HashMap outputDirections; 96 | 97 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Junction) 98 | 99 | }; 100 | 101 | // ========================================================== 102 | 103 | Diagram(); 104 | ~Diagram(); 105 | 106 | using juce::Component::setName; 107 | using juce::Component::getName; 108 | 109 | /** 110 | Designates a component that represents an audio input source of the diagram 111 | */ 112 | void addDiagramInput(juce::Component& component); 113 | 114 | /** 115 | Removes a component previously designated as an input 116 | */ 117 | void removeDiagramInput(juce::Component& component); 118 | 119 | /** 120 | Returns an array of current input components 121 | */ 122 | juce::Array getDiagramInputs() const; 123 | 124 | /** 125 | Designates a component that represents an audio output source of the diagram 126 | */ 127 | void addDiagramOutput(juce::Component& component); 128 | 129 | /** 130 | Removes a component previously designated as an output 131 | */ 132 | void removeDiagramOutput(juce::Component& component); 133 | 134 | /** 135 | Returns an array of current output components 136 | */ 137 | juce::Array getDiagramOutputs() const; 138 | 139 | /** 140 | Adds two components as children and draws a connection between them 141 | 142 | @param source the component outputting a connection 143 | @param destination the component accepting a connection 144 | */ 145 | void connect(juce::Component& source, juce::Component& destination); 146 | 147 | /** 148 | Adds a junction and component as children and draws a connection between them 149 | 150 | @param source the component outputting a connection 151 | @param destination the component accepting a connection 152 | @param directionFromSource this is a specific argument to determine which axis the connection should be drawn from when the source is a HackAudio::Diagram::Junction 153 | */ 154 | void connect(Junction& source, juce::Component& destination, Junction::Direction directionFromSource = Junction::Direction::Auto); 155 | 156 | /** 157 | Breaks a connection between two components 158 | 159 | @param source the component outputting a connection 160 | @param destination the component accepting a connection 161 | */ 162 | void disconnect(juce::Component& source, juce::Component& destination); 163 | 164 | /** 165 | Breaks all incoming connections to the component 166 | */ 167 | void disconnectInputs(juce::Component& component); 168 | 169 | /** 170 | Breaks all outgoing connections from the component 171 | */ 172 | void disconnectOutputs(juce::Component& component); 173 | 174 | /** 175 | Toggles the state of a connection between source and destination 176 | 177 | @param source the component outputting a connection 178 | @param destination the component to break or receive a connection from source 179 | */ 180 | void toggle(juce::Component& source, juce::Component& destination); 181 | 182 | /** 183 | Swaps the state of connections between source, a connected component, and a disconnected component. This method does nothing if both destinations are connected to source or disconnected from source. 184 | 185 | @param source the component outputting a connection 186 | @param destinationOne a component to break or receive a connection from source 187 | @param destinationTwo a component to break or receive a connection from source 188 | */ 189 | void swap(juce::Component& source, juce::Component& destinationOne, juce::Component& destinationTwo); 190 | 191 | /** 192 | Breaks a connection between two components to route it to a new destination. This method only creates the new connection if the connection between source and oldDestination exists 193 | 194 | @param source the component outputting a connection 195 | @param oldDestination the previous component receiving the connection 196 | @param newDestination the component to reroute the connection to 197 | */ 198 | void reroute(juce::Component& source, juce::Component& oldDestination, juce::Component& newDestination); 199 | 200 | /** 201 | Designates a diagram to be expanded when double-clicking the source component 202 | 203 | @param source the component to double click to expand the diagram 204 | @param subDiagram the diagram to expand 205 | */ 206 | void setSubDiagram(juce::Component& source, HackAudio::Diagram& subDiagram); 207 | 208 | private: 209 | 210 | void updateSize(); 211 | void updateConnections(); 212 | void updateChildren(); 213 | 214 | void childrenChanged() override; 215 | void parentHierarchyChanged() override; 216 | 217 | void componentMovedOrResized(juce::Component& component, bool wasMoved, bool wasResized) override; 218 | 219 | void paintOverChildren(juce::Graphics& g) override; 220 | 221 | bool moveGuard; 222 | 223 | juce::Array inputComponents; 224 | juce::Array outputComponents; 225 | 226 | juce::Path connectionPaths; 227 | juce::HashMap> connections; 228 | 229 | juce::HashMap submap; 230 | 231 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Diagram) 232 | 233 | }; 234 | 235 | } 236 | 237 | #endif 238 | -------------------------------------------------------------------------------- /layout/hack_audio_FlexBox.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_FLEXBOX_H 25 | #define HACK_AUDIO_FLEXBOX_H 26 | 27 | namespace HackAudio 28 | { 29 | 30 | /** 31 | A custom implementation of juce::FlexBox that provides an easier API for setting up a basic layout 32 | */ 33 | class FlexBox : private juce::ComponentListener 34 | { 35 | public: 36 | 37 | FlexBox(); 38 | ~FlexBox(); 39 | 40 | /** 41 | Sets the default juce::FlexItem settings to use when adding new items 42 | 43 | @param item the juce::FlexItem to use as default 44 | @param updateExistingItems whether or not to conform the current items to the passed default 45 | */ 46 | void setDefaultItem(juce::FlexItem item, bool updateExistingItems); 47 | 48 | /** 49 | Add a component to be controlled by the FlexBox (forces a layout adjusment) 50 | 51 | @paremeter component the component to add 52 | */ 53 | void addComponent(juce::Component& component, int customOrder = 0); 54 | 55 | /** 56 | Remove a component from being controlled by the FlexBox 57 | 58 | @param component a component currently controlled by the FlexBox 59 | */ 60 | void removeComponent(juce::Component& component); 61 | 62 | /** 63 | Add a FlexBox to nest within this one 64 | */ 65 | void addFlexBox(juce::FlexBox& flexbox, int customOrder = 0); 66 | 67 | /** 68 | Remove a flexbox from being controlled by this one 69 | */ 70 | void removeFlexBox(juce::FlexBox& flexbox); 71 | 72 | /** 73 | Specifies how flex items are placed in the flex container, and defines the direction of the main axis 74 | */ 75 | void setDirection(juce::FlexBox::Direction newDirection); 76 | 77 | /** 78 | Returns the FlexBox's current direction 79 | */ 80 | juce::FlexBox::Direction getDirection() const; 81 | 82 | /** 83 | Specifies whether items are forced into a single line or can be wrapped onto multiple lines 84 | */ 85 | void setWrap(juce::FlexBox::Wrap newWrap); 86 | 87 | /** 88 | Returns the FlexBox's current wrapping 89 | */ 90 | juce::FlexBox::Wrap getWrap() const; 91 | 92 | /** 93 | Specifies how a flex container's lines are placed within the flex container when there is extra space on the cross-axis 94 | */ 95 | void setAlignContent(juce::FlexBox::AlignContent newAlignment); 96 | 97 | /** 98 | Returns the FlexBox's current content alignment 99 | */ 100 | juce::FlexBox::AlignContent getAlignContent() const; 101 | 102 | /** 103 | Specifies the alignment of flex items along the cross-axis of each line 104 | */ 105 | void setAlignItems(juce::FlexBox::AlignItems newAlignment); 106 | 107 | /** 108 | Returns the FlexBox's current item alignment 109 | */ 110 | juce::FlexBox::AlignItems getAlignItems() const; 111 | 112 | /** 113 | Defines how the container distributes space between and around items along the main-axis 114 | */ 115 | void setJustifyContent(juce::FlexBox::JustifyContent newJustification); 116 | 117 | /** 118 | Returns the FlexBox's current justification 119 | */ 120 | juce::FlexBox::JustifyContent getJustifyContent() const; 121 | 122 | /** 123 | Returns the FlexItems currently held by the FlexBox 124 | */ 125 | juce::Array getItems() const; 126 | 127 | /** 128 | Returns the FlexItem associated with the given component 129 | 130 | @param component a component controlled by the FlexBox 131 | */ 132 | juce::FlexItem* getItem(juce::Component& component) const; 133 | 134 | /** 135 | Returns the FlexItem associated with the given FlexBox 136 | 137 | @param flexbox a component controlled by this FlexBox 138 | */ 139 | juce::FlexItem* getItem(juce::FlexBox& flexbox) const; 140 | 141 | /** 142 | Sets the properties for the FlexItem of the relevant component 143 | 144 | @param component a component controlled by the FlexBox 145 | @param newFlexProperties the properties the FlexItem should inherit 146 | */ 147 | void setItem(juce::Component& component, juce::FlexItem newFlexProperties); 148 | 149 | /** 150 | Sets the properties for the FlexItem of the relevant FlexBox 151 | 152 | @param flexbox a FlexBox controlled by this FlexBox 153 | @param newFlexProperties the properties the FlexItem should inherit 154 | */ 155 | void setItem(juce::FlexBox& flexbox, juce::FlexItem newFlexProperties); 156 | 157 | /** 158 | Set the flex for a component's FlexItem 159 | */ 160 | void setItemFlex(juce::Component& component, float newFlexGrow); 161 | void setItemFlex(juce::Component& component, float newFlexGrow, float newFlexShrink); 162 | void setItemFlex(juce::Component& component, float newFlexGrow, float newFlexShrink, float newFlexBasis); 163 | 164 | /** 165 | Set the flex for a FlexBox's FlexItem 166 | */ 167 | void setItemFlex(juce::FlexBox& flexbox, float newFlexGrow); 168 | void setItemFlex(juce::FlexBox& flexbox, float newFlexGrow, float newFlexShrink); 169 | void setItemFlex(juce::FlexBox& flexbox, float newFlexGrow, float newFlexShrink, float newFlexBasis); 170 | 171 | /** 172 | Set the width for a component's FlexItem 173 | */ 174 | void setItemWidth(juce::Component& component, float newWidth); 175 | 176 | /** 177 | Set the width for a FlexBox's FlexItem 178 | */ 179 | void setItemWidth(juce::FlexBox& flexbox, float newWidth); 180 | 181 | /** 182 | Set the flex for a component's FlexItem 183 | */ 184 | void setItemHeight(juce::Component& component, float newHeight); 185 | 186 | /** 187 | Set the flex for a FlexBox's FlexItem 188 | */ 189 | void setItemHeight(juce::FlexBox& flexbox, float newHeight); 190 | 191 | /** 192 | Set the margin for a component's FlexItem 193 | */ 194 | void setItemMargin(juce::Component& component, juce::FlexItem::Margin newMargin); 195 | 196 | /** 197 | Set the margin for a FlexBox's FlexItem 198 | */ 199 | void setItemMargin(juce::FlexBox& flexbox, juce::FlexItem::Margin newMargin); 200 | 201 | /** 202 | Sets the flex for all contained items 203 | */ 204 | void applyItemFlex(float newFlexGrow); 205 | void applyItemFlex(float newFlexGrow, float newFlexShrink); 206 | void applyItemFlex(float newFlexGrow, float newFlexShrink, float newFlexBasis); 207 | 208 | /** 209 | Sets the width for all contained items 210 | */ 211 | void applyItemWidth(float newWidth); 212 | 213 | /** 214 | Sets the height for all contained items 215 | */ 216 | void applyItemHeight(float newHeight); 217 | 218 | /** 219 | Sets the margin for all contained items 220 | */ 221 | void applyItemMargin(juce::FlexItem::Margin newMargin); 222 | 223 | /** 224 | Sets all FlexItem properties to those of newFlexProperties 225 | */ 226 | void applyGlobalFlexItem(juce::FlexItem newFlexProperties); 227 | 228 | /** 229 | Sets the bounds the FlexBox should use and performs a layout adjustment 230 | 231 | @param bounds the bounds the FlexBox should conform to 232 | */ 233 | void applyBounds(juce::Rectangle bounds); 234 | void applyBounds(juce::Rectangle bounds); 235 | void applyBounds(int x, int y, int width, int height); 236 | 237 | /** 238 | Custom API for calling juce::FlexBox::performLayout(...) that handles component resizing callbacks 239 | */ 240 | void applyLayout(); 241 | 242 | private: 243 | 244 | void componentMovedOrResized(juce::Component& component, bool wasMoved, bool wasResized) override; 245 | 246 | void componentVisibilityChanged(juce::Component& component) override; 247 | 248 | bool resizeGuard; 249 | 250 | bool validBounds; 251 | juce::Rectangle flexBoxBounds; 252 | 253 | juce::FlexBox flexbox; 254 | 255 | juce::FlexItem defaultFlexSettings; 256 | 257 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FlexBox) 258 | 259 | }; 260 | 261 | } 262 | 263 | #endif 264 | -------------------------------------------------------------------------------- /layout/hack_audio_Viewport.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_VIEWPORT_H 25 | #define HACK_AUDIO_VIEWPORT_H 26 | 27 | namespace HackAudio 28 | { 29 | 30 | /** 31 | An unbounded, infinitely-scrollable viewport for displaying HackAudio::Diagram components 32 | */ 33 | class Viewport : public juce::Component, 34 | private juce::ComponentListener, 35 | private juce::Button::Listener 36 | { 37 | 38 | public: 39 | 40 | Viewport(); 41 | ~Viewport(); 42 | 43 | /** 44 | Sets the top-level diagram to display, clearing out any traversal chains 45 | */ 46 | void setDiagram(HackAudio::Diagram& d); 47 | 48 | /** 49 | Removes any diagrams from the display 50 | */ 51 | void clearDiagram(); 52 | 53 | /** 54 | Move downwards to a specific diagram, marking the current one as the last parent 55 | */ 56 | void traverseDown(HackAudio::Diagram& d); 57 | 58 | /** 59 | Move up to the next parent diagram 60 | */ 61 | void traverseUp(); 62 | 63 | /** 64 | Return to the top level diagram 65 | */ 66 | void traverseTop(); 67 | 68 | /** 69 | Returns true if the diagram is within the traversal chain 70 | */ 71 | bool isInTraversal(HackAudio::Diagram& d) const; 72 | 73 | /** 74 | Sets the font to be used when displaying diagram titles 75 | */ 76 | void setFont(juce::Font newFont); 77 | 78 | /** 79 | Returns the viewport's current font 80 | */ 81 | juce::Font getFont() const; 82 | 83 | /** 84 | Sets whether or not the diagrams can be moved inside the viewport. Viewports 85 | are draggable by default. 86 | 87 | If disabled, labels part of diagrams will still be clickable (unlike 88 | disabling the entire component). 89 | */ 90 | void setDraggable(bool isDraggable); 91 | 92 | private: 93 | 94 | void setDiagramViaTraversal(HackAudio::Diagram& d); 95 | 96 | void mouseEnter (const juce::MouseEvent& e) override; 97 | void mouseExit (const juce::MouseEvent& e) override; 98 | void mouseDown (const juce::MouseEvent& e) override; 99 | void mouseDrag (const juce::MouseEvent& e) override; 100 | void mouseUp (const juce::MouseEvent& e) override; 101 | void mouseWheelMove(const juce::MouseEvent& e, const juce::MouseWheelDetails& w) override; 102 | 103 | void enablementChanged() override; 104 | 105 | void buttonClicked(juce::Button* b) override; 106 | 107 | void componentMovedOrResized(juce::Component& component, bool wasMoved, bool wasResized) override; 108 | 109 | void paint(juce::Graphics& g) override; 110 | void paintOverChildren(juce::Graphics& g) override; 111 | 112 | void resized() override; 113 | 114 | bool draggable; 115 | 116 | juce::Font viewportFont; 117 | 118 | juce::Component contentContainer; 119 | HackAudio::Diagram* currentContent; 120 | 121 | juce::Array parentContent; 122 | 123 | NavigationButton backButton; 124 | NavigationButton topButton; 125 | 126 | juce::ComponentDragger componentDragger; 127 | juce::ComponentAnimator componentAnimator; 128 | 129 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Viewport) 130 | 131 | }; 132 | 133 | } 134 | 135 | #endif 136 | -------------------------------------------------------------------------------- /utils/hack_audio_Colours.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | const juce::Colour HackAudio::Colours::Black (0xFF100B28); 25 | const juce::Colour HackAudio::Colours::DarkGray (0xFF26324A); 26 | const juce::Colour HackAudio::Colours::Gray (0xFF425568); 27 | const juce::Colour HackAudio::Colours::LightGray (0xFF5F7584); 28 | const juce::Colour HackAudio::Colours::White (0xFFFFFFFF); 29 | 30 | const juce::Colour HackAudio::Colours::Teal (0xFF13F59B); 31 | const juce::Colour HackAudio::Colours::Cyan (0xFF00C8FF); 32 | const juce::Colour HackAudio::Colours::Violet (0xFFCE8AFF); 33 | const juce::Colour HackAudio::Colours::Magenta (0xFFFB7BCA); 34 | 35 | void HackAudio::Colours::setGlobalColour(int colourId, juce::Colour newColour) 36 | { 37 | 38 | std::function traverse = [&](juce::Component* parent) 39 | { 40 | 41 | for (int i = 0; i < parent->getNumChildComponents(); ++i) 42 | { 43 | 44 | if (juce::Component* const child = parent->getChildComponent(i)) 45 | { 46 | 47 | child->setColour(colourId, newColour); 48 | child->repaint(); 49 | traverse(child); 50 | 51 | } 52 | 53 | } 54 | 55 | }; 56 | 57 | juce::Desktop& d = juce::Desktop::getInstance(); 58 | 59 | for (int i = 0; i < d.getNumComponents(); ++i) 60 | { 61 | 62 | if (juce::Component* c = d.getComponent(i)) 63 | { 64 | 65 | traverse(c); 66 | 67 | } 68 | 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /utils/hack_audio_Colours.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_COLOURS_H 25 | #define HACK_AUDIO_COLOURS_H 26 | 27 | namespace HackAudio 28 | { 29 | 30 | /** 31 | The predefined colours for the HackAudio theme 32 | */ 33 | class Colours 34 | { 35 | public: 36 | static const juce::Colour 37 | Black, 38 | DarkGray, 39 | Gray, 40 | LightGray, 41 | White, 42 | 43 | Teal, 44 | Cyan, 45 | Violet, 46 | Magenta; 47 | 48 | /** 49 | Registers a colour for every available component. This affects all components even if they are invisible or disabled. 50 | */ 51 | static void setGlobalColour(int colourId, juce::Colour newColour); 52 | 53 | private: 54 | Colours(); 55 | 56 | JUCE_DECLARE_NON_COPYABLE (Colours) 57 | 58 | }; 59 | 60 | /** 61 | The standard colour IDs for the HackAudio theme 62 | */ 63 | enum ColourIds 64 | { 65 | 66 | backgroundColourId, 67 | midgroundColourId, 68 | foregroundColourId, 69 | highlightColourId 70 | 71 | }; 72 | 73 | } 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /utils/hack_audio_Fonts.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #include "hack_audio_FontData.cpp" 25 | 26 | const juce::Typeface::Ptr ptr_NowLight = juce::Typeface::createSystemTypefaceFor(NowLight_otf, NowLight_otfSize); 27 | const juce::Typeface::Ptr ptr_NowRegular = juce::Typeface::createSystemTypefaceFor(NowRegular_otf, NowRegular_otfSize); 28 | const juce::Typeface::Ptr ptr_NowBold = juce::Typeface::createSystemTypefaceFor(NowBold_otf, NowBold_otfSize); 29 | const juce::Typeface::Ptr ptr_BaumansRegular = juce::Typeface::createSystemTypefaceFor(BaumansRegular_ttf, BaumansRegular_ttfSize); 30 | 31 | const juce::Font HackAudio::Fonts::NowLight (ptr_NowLight); 32 | const juce::Font HackAudio::Fonts::NowRegular (ptr_NowRegular); 33 | const juce::Font HackAudio::Fonts::NowBold (ptr_NowBold); 34 | const juce::Font HackAudio::Fonts::Baumans (ptr_BaumansRegular); 35 | -------------------------------------------------------------------------------- /utils/hack_audio_Fonts.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_FONTS 25 | #define HACK_AUDIO_FONTS 26 | 27 | namespace HackAudio 28 | { 29 | 30 | /** 31 | The default fonts for the HackAudio theme 32 | */ 33 | class Fonts 34 | { 35 | public: 36 | 37 | static const juce::Font 38 | NowLight, 39 | NowRegular, 40 | NowBold, 41 | Baumans; 42 | 43 | private: 44 | 45 | Fonts(); 46 | JUCE_DECLARE_NON_COPYABLE (Fonts) 47 | 48 | }; 49 | 50 | /** 51 | The default font heights used in the HackAudio theme 52 | */ 53 | enum FontHeights 54 | { 55 | 56 | Small = 12, 57 | Medium = 14, 58 | Large = 18, 59 | Huge = 24, 60 | 61 | }; 62 | 63 | } 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /utils/hack_audio_NavigationButton.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 2 | * 3 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | #ifndef HACK_AUDIO_NAVIGATIONBUTTON_H 25 | #define HACK_AUDIO_NAVIGATIONBUTTON_H 26 | 27 | #include 28 | #include 29 | 30 | namespace HackAudio 31 | { 32 | 33 | /** 34 | A basic arrow style button to embed in larger components 35 | */ 36 | class NavigationButton : public juce::Button 37 | { 38 | public: 39 | 40 | NavigationButton() : juce::Button("") { setWantsKeyboardFocus(false); } 41 | ~NavigationButton() {}; 42 | 43 | /** 44 | The direction the button should face 45 | */ 46 | enum Direction 47 | { 48 | Up, 49 | Down, 50 | Left, 51 | Right 52 | }; 53 | 54 | Direction buttonDirection = Left; 55 | 56 | private: 57 | 58 | void mouseEnter(const juce::MouseEvent& e) override 59 | { 60 | 61 | if (isEnabled()) 62 | { 63 | 64 | setMouseCursor(juce::MouseCursor::PointingHandCursor); 65 | 66 | } 67 | 68 | juce::Button::mouseEnter(e); 69 | 70 | } 71 | 72 | void mouseExit(const juce::MouseEvent& e) override 73 | { 74 | 75 | if (isEnabled()) 76 | { 77 | 78 | setMouseCursor(juce::MouseCursor::NormalCursor); 79 | 80 | } 81 | 82 | juce::Button::mouseExit(e); 83 | 84 | } 85 | 86 | void enablementChanged() override 87 | { 88 | 89 | repaint(); 90 | 91 | } 92 | 93 | void paintButton(juce::Graphics& g, bool isMouseOverButton, bool isButtonDown) override 94 | { 95 | 96 | int width = getWidth(); 97 | int height = getHeight(); 98 | 99 | juce::Button::ButtonState state = getState(); 100 | 101 | if (state == juce::Button::ButtonState::buttonOver && state != juce::Button::ButtonState::buttonDown) 102 | { 103 | 104 | g.setColour(HackAudio::Colours::LightGray); 105 | 106 | } 107 | else if (state == juce::Button::ButtonState::buttonOver || state == juce::Button::ButtonState::buttonDown) 108 | { 109 | 110 | g.setColour(HackAudio::Colours::DarkGray); 111 | 112 | } 113 | else 114 | { 115 | 116 | g.setColour(HackAudio::Colours::White); 117 | 118 | } 119 | 120 | if (!isEnabled()) 121 | { 122 | 123 | g.setColour(HackAudio::Colours::Black); 124 | 125 | } 126 | 127 | if (buttonDirection == Up) 128 | { 129 | 130 | g.drawLine((width/16), (height - height/4), (width/2), (height/4), 2); 131 | g.drawLine((width/2), (height/4), (width - width/16), (height - height/4), 2); 132 | 133 | } 134 | else if (buttonDirection == Down) 135 | { 136 | 137 | g.drawLine((width/16), (height/4), (width/2), (height - height/4), 2); 138 | g.drawLine((width/2), (height - height/4), (width - width/16), (height/4), 2); 139 | 140 | } 141 | else if (buttonDirection == Left) 142 | { 143 | 144 | g.drawLine((width/4), (height/2), (width - width/4), (height/16), 2); 145 | g.drawLine((width/4), (height/2), (width - width/4), (height - height/16), 2); 146 | 147 | } 148 | else if (buttonDirection == Right) 149 | { 150 | 151 | g.drawLine((width - width/4), (height/2), (width/4), (height/16), 2); 152 | g.drawLine((width - width/4), (height/2), (width/4), (height - height/16), 2); 153 | 154 | } 155 | 156 | }; 157 | 158 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NavigationButton) 159 | 160 | }; 161 | 162 | } 163 | 164 | #endif 165 | -------------------------------------------------------------------------------- /utils/hack_audio_TextFormatting.h: -------------------------------------------------------------------------------- 1 | #ifndef HACK_AUDIO_TEXTFORMATTING_H 2 | #define HACK_AUDIO_TEXTFORMATTING_H 3 | 4 | #include 5 | 6 | /* Copyright (C) 2017 by Antonio Lassandro, HackAudio LLC 7 | * 8 | * hack_audio_gui is provided under the terms of The MIT License (MIT): 9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and associated documentation files (the "Software"), to deal 12 | * in the Software without restriction, including without limitation the rights 13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, and to permit persons to whom the Software is 15 | * furnished to do so, subject to the following conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be included in 18 | * all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | * SOFTWARE. 27 | */ 28 | 29 | juce::StringArray parseText(juce::String stringToParse) 30 | { 31 | 32 | juce::StringArray results; 33 | 34 | std::regex r("\\\\array.+"); 35 | 36 | std::string s(stringToParse.toUTF8()); 37 | 38 | std::sregex_iterator begin(s.begin(), s.end(), r), end; 39 | for (auto i = begin; i != end; ++i) 40 | { 41 | 42 | results.add(i->str()); 43 | 44 | } 45 | 46 | if (!results.size()) 47 | { 48 | 49 | r.assign("([^\\^_]+|([\\^_][^\\s\\^_]){2}|[\\^_]\\{[^\\}]+\\}|[\\^_][^\\s\\^_]?)"); 50 | 51 | std::sregex_iterator begin(s.begin(), s.end(), r), end; 52 | for (auto i = begin; i != end; ++i) 53 | { 54 | 55 | results.add(i->str()); 56 | 57 | } 58 | 59 | } 60 | 61 | return results; 62 | 63 | } 64 | 65 | void formatScript(juce::GlyphArrangement& glyphs, juce::String jstring, juce::Font& font, int& currentHeight, int& baseline, int& offset) 66 | { 67 | 68 | if (jstring.startsWith("^")) 69 | { 70 | 71 | if (baseline > 0) 72 | { 73 | baseline -= currentHeight / 2; 74 | } 75 | else if (baseline < 0) 76 | { 77 | baseline += currentHeight / 4; 78 | } 79 | else 80 | { 81 | baseline -= currentHeight / 2; 82 | } 83 | 84 | currentHeight -= currentHeight / 3; 85 | 86 | if (jstring.startsWith("^{")) 87 | { 88 | 89 | jstring = jstring.fromFirstOccurrenceOf("{", false, true); 90 | jstring = jstring.upToFirstOccurrenceOf("}", false, true); 91 | 92 | juce::StringArray temp = parseText(jstring); 93 | 94 | for (int i = 0; i < temp.size(); ++i) 95 | { 96 | 97 | if (temp[i].containsAnyOf("^_")) 98 | { 99 | 100 | formatScript(glyphs, temp[i], font, currentHeight, baseline, offset); 101 | 102 | } 103 | else 104 | { 105 | 106 | glyphs.addLineOfText 107 | ( 108 | font.withHeight(currentHeight), 109 | temp[i], 110 | offset, 111 | baseline 112 | ); 113 | 114 | offset = (int)glyphs.getBoundingBox(0, glyphs.getNumGlyphs(), true).getWidth(); 115 | 116 | } 117 | 118 | } 119 | 120 | } 121 | else if (jstring.matchesWildcard("^*_*", true)) 122 | { 123 | 124 | glyphs.addLineOfText 125 | ( 126 | font.withHeight(currentHeight), 127 | jstring.substring(1,2), 128 | offset, 129 | baseline 130 | ); 131 | 132 | glyphs.addLineOfText 133 | ( 134 | font.withHeight(currentHeight), 135 | jstring.substring(3, 4), 136 | offset, 137 | baseline + baseline * -2 138 | ); 139 | 140 | } 141 | else 142 | { 143 | 144 | glyphs.addLineOfText 145 | ( 146 | font.withHeight(currentHeight), 147 | jstring.substring(1), 148 | offset, 149 | baseline 150 | ); 151 | 152 | } 153 | 154 | } 155 | else if (jstring.startsWith("_")) 156 | { 157 | 158 | if (baseline > 0) 159 | { 160 | 161 | baseline += currentHeight / 4; 162 | 163 | } 164 | else if (baseline < 0) 165 | { 166 | 167 | baseline -= currentHeight / 2; 168 | 169 | } 170 | else if (baseline == 0) 171 | { 172 | 173 | baseline += currentHeight / 2; 174 | 175 | } 176 | 177 | currentHeight -= currentHeight / 3; 178 | 179 | if (jstring.startsWith("_{")) 180 | { 181 | 182 | jstring = jstring.fromFirstOccurrenceOf("{", false, true); 183 | jstring = jstring.upToFirstOccurrenceOf("}", false, true); 184 | 185 | juce::StringArray temp = parseText(jstring); 186 | 187 | for (int i = 0; i < temp.size(); ++i) 188 | { 189 | 190 | if (temp[i].containsAnyOf("^_")) 191 | { 192 | 193 | formatScript(glyphs, temp[i], font, currentHeight, baseline, offset); 194 | 195 | } 196 | else 197 | { 198 | 199 | glyphs.addLineOfText 200 | ( 201 | font.withHeight(currentHeight), 202 | jstring, 203 | offset, 204 | baseline 205 | ); 206 | 207 | offset = (int)glyphs.getBoundingBox(0, glyphs.getNumGlyphs(), true).getWidth(); 208 | 209 | } 210 | 211 | } 212 | 213 | } 214 | else if (jstring.matchesWildcard("_*^*", true)) 215 | { 216 | 217 | glyphs.addLineOfText 218 | ( 219 | font.withHeight(currentHeight), 220 | jstring.substring(1,2), 221 | offset, 222 | baseline 223 | ); 224 | 225 | glyphs.addLineOfText 226 | ( 227 | font.withHeight(currentHeight), 228 | jstring.substring(3, 4), 229 | offset, 230 | baseline + baseline * -2 231 | ); 232 | 233 | } 234 | else 235 | { 236 | 237 | glyphs.addLineOfText 238 | ( 239 | font.withHeight(currentHeight), 240 | jstring.substring(1), 241 | offset, 242 | baseline 243 | ); 244 | 245 | } 246 | 247 | } 248 | 249 | offset = (int)glyphs.getBoundingBox(0, glyphs.getNumGlyphs(), true).getWidth(); 250 | 251 | } 252 | 253 | void formatArray(juce::GlyphArrangement& glyphs, juce::String& jstring, juce::Font& font, int& currentHeight, int& baseline, int& offset, int& width, int& height) 254 | { 255 | 256 | offset = 0; 257 | baseline = 0; 258 | currentHeight = font.getHeight(); 259 | 260 | jstring = jstring.fromFirstOccurrenceOf("\\array", false, true).upToFirstOccurrenceOf("\\end", false, true); 261 | jstring = jstring.trimStart().trimEnd(); 262 | 263 | int rows = 0; 264 | juce::String s_row = jstring; 265 | while (1) 266 | { 267 | 268 | rows++; 269 | s_row = s_row.fromFirstOccurrenceOf("&//", false, true); 270 | if (!s_row.contains("&//")) { break; } 271 | 272 | } 273 | 274 | juce::StringArray chars; 275 | 276 | while (1) 277 | { 278 | 279 | chars.add(jstring.upToFirstOccurrenceOf("&", false, true)); 280 | if (!jstring.contains("&")) { break; } 281 | jstring = jstring.fromFirstOccurrenceOf("&", false, false); 282 | jstring = jstring.trim(); 283 | 284 | } 285 | 286 | int spacing = 0; 287 | int n = 0; 288 | 289 | for (int j = 0; j < chars.size(); ++j) 290 | { 291 | 292 | juce::StringArray results = parseText(chars[j]); 293 | 294 | for (int k = 0; k < results.size(); ++k) 295 | { 296 | 297 | juce::String temp = results[k]; 298 | 299 | if (temp.startsWith("//")) 300 | { 301 | 302 | baseline += height / rows; 303 | temp = temp.removeCharacters("//"); 304 | temp = temp.trimStart(); 305 | spacing = 0; 306 | offset = 0; 307 | n = 0; 308 | 309 | } 310 | else if (temp.startsWith("^") || temp.startsWith("_")) 311 | { 312 | 313 | juce::Rectangle glyphOffset = glyphs.getBoundingBox(glyphs.getNumGlyphs() - 1, glyphs.getNumGlyphs(), true); 314 | offset = spacing + glyphOffset.getWidth(); 315 | 316 | int tempBaseline = baseline; 317 | 318 | formatScript(glyphs, temp, font, currentHeight, tempBaseline, offset); 319 | 320 | currentHeight = font.getHeight(); 321 | offset = 0; 322 | 323 | n--; 324 | 325 | continue; 326 | 327 | } 328 | 329 | spacing = ((width / rows) * n) - font.getStringWidth(temp); 330 | 331 | glyphs.addLineOfText(font.withHeight(currentHeight), temp, spacing, baseline); 332 | 333 | n++; 334 | 335 | } 336 | 337 | } 338 | 339 | } 340 | 341 | juce::GlyphArrangement formatText(juce::String stringToFormat, juce::Font font, juce::Justification justificationType, int x, int y, int width, int height) 342 | { 343 | 344 | juce::GlyphArrangement glyphs; 345 | 346 | int fontHeight = font.getHeight(); 347 | int currentHeight = fontHeight; 348 | 349 | int offset = 0; 350 | int baseline = 0; 351 | 352 | juce::StringArray results = parseText(stringToFormat); 353 | 354 | for (int i = 0; i < results.size(); ++i) 355 | { 356 | 357 | juce::String jstring = results[i]; 358 | 359 | if (jstring.startsWith("^") || jstring.startsWith("_")) 360 | { 361 | 362 | formatScript(glyphs, jstring, font, currentHeight, baseline, offset); 363 | 364 | } 365 | else if (jstring.startsWith("\\array")) 366 | { 367 | 368 | formatArray(glyphs, jstring, font, currentHeight, baseline, offset, width, height); 369 | 370 | } 371 | else 372 | { 373 | 374 | baseline = 0; 375 | currentHeight = fontHeight; 376 | 377 | glyphs.addLineOfText(font.withHeight(currentHeight), jstring, offset, baseline); 378 | 379 | } 380 | 381 | offset = (int)glyphs.getBoundingBox(0, glyphs.getNumGlyphs(), true).getWidth(); 382 | 383 | } 384 | 385 | glyphs.justifyGlyphs(0, glyphs.getNumGlyphs(), x, y, width, height, justificationType); 386 | 387 | return glyphs; 388 | 389 | } 390 | 391 | 392 | #endif 393 | --------------------------------------------------------------------------------