Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added octave up and down buttons #409

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -8,6 +8,8 @@ Builds/VisualStudio2017/
.vs/
*.exe

.vscode

JuceLibraryCode/
Builds/
assets/
Expand Down
2 changes: 2 additions & 0 deletions Documentation/KeyboardShortcuts.md
@@ -0,0 +1,2 @@
X = Octave down\
C = Octave up
1 change: 1 addition & 0 deletions Source/CartManager.cpp
Expand Up @@ -342,6 +342,7 @@ void CartManager::initialFocus() {
}

bool CartManager::keyPressed(const KeyPress& key, Component* originatingComponent) {
// Keycode 13 is enter.
if ( key.getKeyCode() == 13 ) {
File file = cartBrowser->getSelectedFile();
if ( file.isDirectory() )
Expand Down
20 changes: 20 additions & 0 deletions Source/PluginEditor.cpp
Expand Up @@ -37,6 +37,9 @@ DexedAudioProcessorEditor::DexedAudioProcessorEditor (DexedAudioProcessor* owner
cartManager(this)
{
setSize(WINDOW_SIZE_X, (ownerFilter->showKeyboard ? WINDOW_SIZE_Y : WINDOW_SIZE_Y - 94));

setWantsKeyboardFocus(true);
addKeyListener(this);

processor = ownerFilter;

Expand Down Expand Up @@ -441,3 +444,20 @@ void DexedAudioProcessorEditor::filesDropped (const StringArray &files, int x, i
processor->applyKBMMapping( File( fn ) );
}
}

bool DexedAudioProcessorEditor::keyPressed(const KeyPress &key, Component *originatingComponent) {
if (key.getTextDescription() == "X") {
if (processor->octaveShift > 0) {
processor->octaveShift -= 1;
midiKeyboard.setKeyPressBaseOctave(processor->octaveShift);
}
return true;
} else if (key.getTextDescription() == "C") {
if (processor->octaveShift < 10) {
processor->octaveShift += 1;
midiKeyboard.setKeyPressBaseOctave(processor->octaveShift);
}
return true;
}
return false;
}
3 changes: 2 additions & 1 deletion Source/PluginEditor.h
Expand Up @@ -32,7 +32,7 @@
/**
*/
class DexedAudioProcessorEditor : public AudioProcessorEditor, public ComboBox::Listener, public Timer,
public FileDragAndDropTarget {
public FileDragAndDropTarget, public juce::KeyListener {
MidiKeyboardComponent midiKeyboard;
OperatorEditor operators[6];
Colour background;
Expand Down Expand Up @@ -62,6 +62,7 @@ class DexedAudioProcessorEditor : public AudioProcessorEditor, public ComboBox:

virtual bool isInterestedInFileDrag (const StringArray &files) override;
virtual void filesDropped (const StringArray &files, int x, int y ) override;
virtual bool keyPressed (const KeyPress &key, Component *originatingComponent);

static const int WINDOW_SIZE_X = 866;
static const int WINDOW_SIZE_Y = 674;
Expand Down
2 changes: 2 additions & 0 deletions Source/PluginProcessor.h
Expand Up @@ -172,6 +172,8 @@ public :
std::unique_ptr<CtrlFloat> output;
std::unique_ptr<Ctrl> tune;

int octaveShift = 5;

void loadCartridge(Cartridge &cart);
void setDxValue(int offset, int v);

Expand Down