-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
181 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
============================================================================== | ||
WaveTypeSelector.cpp | ||
Created: 4 Jun 2021 8:44:02am | ||
Author: Hayden Setlik | ||
============================================================================== | ||
*/ | ||
|
||
#include "WaveTypeSelector.h" | ||
|
||
ImageToggle::ImageToggle(juce::Image on, juce::Image off) : onImg(on), offImg(off) | ||
{ | ||
setClickingTogglesState(true); | ||
} | ||
|
||
void ImageToggle::paintButton(juce::Graphics &g, bool down, bool highlighted) | ||
{ | ||
auto image = (getToggleState()) ? onImg : offImg; | ||
auto fBounds = getLocalBounds(); | ||
g.drawImageAt(image, fBounds.getX(), fBounds.getY()); | ||
} | ||
//============================================================================== | ||
|
||
WaveButtonSet::WaveButtonSet(int opIndex) : | ||
sineButton(ImageToggle::getForWave(Sine, true), ImageToggle::getForWave(Sine, false)), | ||
squareButton(ImageToggle::getForWave(Square, true), ImageToggle::getForWave(Square, false)), | ||
sawButton(ImageToggle::getForWave(Saw, true), ImageToggle::getForWave(Saw, false)), | ||
triButton(ImageToggle::getForWave(Tri, true), ImageToggle::getForWave(Tri, false)) | ||
{ | ||
addAndMakeVisible(&sineButton); | ||
addAndMakeVisible(&squareButton); | ||
addAndMakeVisible(&sawButton); | ||
addAndMakeVisible(&triButton); | ||
int radioNum = 60 + opIndex; | ||
sineButton.setRadioGroupId(radioNum); | ||
squareButton.setRadioGroupId(radioNum); | ||
sawButton.setRadioGroupId(radioNum); | ||
triButton.setRadioGroupId(radioNum); | ||
} | ||
|
||
void WaveButtonSet::resized() | ||
{ | ||
auto bounds = getLocalBounds(); | ||
auto dX = bounds.getWidth() / 4; | ||
sineButton.setBounds(bounds.removeFromLeft(dX)); | ||
squareButton.setBounds(bounds.removeFromLeft(dX)); | ||
sawButton.setBounds(bounds.removeFromLeft(dX)); | ||
triButton.setBounds(bounds); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
============================================================================== | ||
WaveTypeSelector.h | ||
Created: 4 Jun 2021 8:44:02am | ||
Author: Hayden Setlik | ||
============================================================================== | ||
*/ | ||
|
||
#pragma once | ||
#include "RGBColor.h" | ||
#include "GlobalColor.h" | ||
#include "WavetableProcessor.h" | ||
|
||
class ImageToggle : public juce::ImageButton | ||
{ | ||
public: | ||
ImageToggle(juce::Image on, juce::Image off); | ||
void paintButton(juce::Graphics &g, bool down, bool highlighted) override; | ||
static juce::Image getForWave(WaveType type, bool on) | ||
{ | ||
switch(type) | ||
{ | ||
case Sine: | ||
{ | ||
if(on) | ||
return juce::ImageCache::getFromMemory(BinaryData::sineOn_png, BinaryData::sineOn_pngSize); | ||
else | ||
return juce::ImageCache::getFromMemory(BinaryData::sineOff_png, BinaryData::sineOff_pngSize); | ||
} | ||
case Square: | ||
{ | ||
if(on) | ||
return juce::ImageCache::getFromMemory(BinaryData::squareOn_png, BinaryData::squareOn_pngSize); | ||
else | ||
return juce::ImageCache::getFromMemory(BinaryData::squareOff_png, BinaryData::squareOff_pngSize); | ||
} | ||
case Saw: | ||
{ | ||
if(on) | ||
return juce::ImageCache::getFromMemory(BinaryData::sawOn_png, BinaryData::sawOn_pngSize); | ||
else | ||
return juce::ImageCache::getFromMemory(BinaryData::sawOff_png, BinaryData::sawOff_pngSize); | ||
} | ||
case Tri: | ||
{ | ||
if(on) | ||
return juce::ImageCache::getFromMemory(BinaryData::triOn_png, BinaryData::triOn_pngSize); | ||
else | ||
return juce::ImageCache::getFromMemory(BinaryData::triOff_png, BinaryData::triOff_pngSize); | ||
} | ||
} | ||
} | ||
private: | ||
juce::Image onImg; | ||
juce::Image offImg; | ||
}; | ||
|
||
|
||
class WaveButtonSet : public juce::Component | ||
{ | ||
public: | ||
WaveButtonSet(int opIndex); | ||
void resized() override; | ||
private: | ||
ImageToggle sineButton; | ||
ImageToggle squareButton; | ||
ImageToggle sawButton; | ||
ImageToggle triButton; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters