2024-08-10 19:26:56 +00:00
# pragma once
2024-09-12 22:09:54 +00:00
# define VERSION_HINT 2
2024-08-10 19:26:56 +00:00
# include <JuceHeader.h>
# include "EffectComponent.h"
# include "SvgButton.h"
2024-08-13 13:55:30 +00:00
# include "../LookAndFeel.h"
# include "SwitchButton.h"
2024-08-10 19:26:56 +00:00
2024-09-12 22:09:54 +00:00
class VisualiserParameters {
public :
std : : atomic < int > roughness = 4 ;
std : : atomic < double > intensity = 1.0 ;
BooleanParameter * graticuleEnabled = new BooleanParameter ( " Show Graticule " , " graticuleEnabled " , VERSION_HINT , true , " Show the graticule or grid lines over the oscilloscope display. " ) ;
BooleanParameter * smudgesEnabled = new BooleanParameter ( " Show Smudges " , " smudgesEnabled " , VERSION_HINT , true , " Adds a subtle layer of dirt/smudges to the oscilloscope display to make it look more realistic. " ) ;
BooleanParameter * upsamplingEnabled = new BooleanParameter ( " Upsample Audio " , " upsamplingEnabled " , VERSION_HINT , false , " Upsamples the audio before visualising it to make it appear more realistic, at the expense of performance. " ) ;
BooleanParameter * legacyVisualiserEnabled = new BooleanParameter ( " Use Legacy Visualiser " , " legacyVisualiserEnabled " , VERSION_HINT , false , " Replaces the realistic oscilloscope visualiser with the legacy visualiser. This may improve performance. " ) ;
BooleanParameter * visualiserFullScreen = new BooleanParameter ( " Visualiser Fullscreen " , " visualiserFullScreen " , VERSION_HINT , false , " Makes the software visualiser fullscreen. " ) ;
std : : shared_ptr < Effect > persistenceEffect = std : : make_shared < Effect > (
new EffectParameter (
" Persistence " ,
" Controls how long the light glows for on the oscilloscope display. " ,
" persistence " ,
VERSION_HINT , 0.5 , 0 , 6.0
)
) ;
std : : shared_ptr < Effect > hueEffect = std : : make_shared < Effect > (
new EffectParameter (
" Hue " ,
" Controls the hue/colour of the oscilloscope display. " ,
" hue " ,
VERSION_HINT , 125 , 0 , 359 , 1
)
) ;
std : : shared_ptr < Effect > brightnessEffect = std : : make_shared < Effect > (
new EffectParameter (
" Brightness " ,
" Controls how bright the light glows for on the oscilloscope display. " ,
" brightness " ,
VERSION_HINT , 3.0 , 0.0 , 10.0
)
) ;
std : : shared_ptr < Effect > intensityEffect = std : : make_shared < Effect > (
new EffectParameter (
" Intensity " ,
" Controls how bright the electron beam of the oscilloscope is. " ,
" intensity " ,
VERSION_HINT , 3.0 , 0.0 , 10.0
)
) ;
2024-09-29 18:46:35 +00:00
std : : shared_ptr < Effect > saturationEffect = std : : make_shared < Effect > (
new EffectParameter (
" Saturation " ,
" Controls how saturated the colours are on the oscilloscope. " ,
" saturation " ,
VERSION_HINT , 1.0 , 0.0 , 5.0
)
) ;
2024-09-29 19:36:16 +00:00
std : : shared_ptr < Effect > focusEffect = std : : make_shared < Effect > (
new EffectParameter (
" Focus " ,
" Controls how focused the electron beam of the oscilloscope is. " ,
" focus " ,
VERSION_HINT , 1.0 , 0.01 , 10.0
)
) ;
2024-09-12 22:09:54 +00:00
} ;
2024-08-10 19:26:56 +00:00
class VisualiserSettings : public juce : : Component {
public :
2024-09-22 17:49:58 +00:00
VisualiserSettings ( VisualiserParameters & , int numChannels = 2 ) ;
2024-08-10 19:26:56 +00:00
~ VisualiserSettings ( ) ;
void resized ( ) override ;
2024-08-13 13:55:30 +00:00
juce : : var getSettings ( ) ;
2024-08-10 19:26:56 +00:00
2024-09-12 22:09:54 +00:00
VisualiserParameters & parameters ;
2024-09-22 17:49:58 +00:00
int numChannels ;
2024-09-12 22:09:54 +00:00
private :
EffectComponent brightness { * parameters . brightnessEffect } ;
EffectComponent intensity { * parameters . intensityEffect } ;
EffectComponent persistence { * parameters . persistenceEffect } ;
EffectComponent hue { * parameters . hueEffect } ;
2024-09-29 18:46:35 +00:00
EffectComponent saturation { * parameters . saturationEffect } ;
2024-09-29 19:36:16 +00:00
EffectComponent focus { * parameters . focusEffect } ;
2024-08-13 13:55:30 +00:00
2024-09-12 22:09:54 +00:00
jux : : SwitchButton graticuleToggle { parameters . graticuleEnabled } ;
jux : : SwitchButton smudgeToggle { parameters . smudgesEnabled } ;
jux : : SwitchButton upsamplingToggle { parameters . upsamplingEnabled } ;
2024-08-10 19:26:56 +00:00
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR ( VisualiserSettings )
} ;
2024-08-13 13:55:30 +00:00
class SettingsWindow : public juce : : DocumentWindow {
public :
SettingsWindow ( juce : : String name ) : juce : : DocumentWindow ( name , Colours : : darker , juce : : DocumentWindow : : TitleBarButtons : : closeButton ) { }
void closeButtonPressed ( ) override {
setVisible ( false ) ;
}
} ;