Vital
Loading...
Searching...
No Matches
synth_computer_keyboard.h
Go to the documentation of this file.
1#pragma once
2
3#include "JuceHeader.h"
4#include "synth_types.h"
5#include <set>
6
7namespace vital {
8 class SoundEngine;
9}
10
21class SynthComputerKeyboard : public vital::StringLayout, public KeyListener {
22public:
26 static constexpr int kKeyboardMidiChannel = 1;
27
32
39 SynthComputerKeyboard(vital::SoundEngine* synth, MidiKeyboardState* keyboard_state);
40
45
53 void changeKeyboardOffset(int new_offset);
54
62 bool keyPressed(const KeyPress &key, Component *origin) override;
63
74 bool keyStateChanged(bool isKeyDown, Component *origin) override;
75
76private:
77 vital::SoundEngine* synth_;
78 MidiKeyboardState* keyboard_state_;
79 std::set<char> keys_pressed_;
80 int computer_keyboard_offset_;
81
82 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SynthComputerKeyboard)
83};
Provides a computer-keyboard-based MIDI input mechanism for the Vital standalone application.
Definition synth_computer_keyboard.h:21
bool keyStateChanged(bool isKeyDown, Component *origin) override
Called when a key state changes (pressed or released).
Definition synth_computer_keyboard.cpp:38
bool keyPressed(const KeyPress &key, Component *origin) override
Called when a key is pressed.
Definition synth_computer_keyboard.cpp:32
void changeKeyboardOffset(int new_offset)
Changes the base offset of the computer keyboard notes.
Definition synth_computer_keyboard.cpp:19
static constexpr int kKeyboardMidiChannel
The MIDI channel used for the computer keyboard input.
Definition synth_computer_keyboard.h:26
~SynthComputerKeyboard()
Destructor. Cleans up any resources.
Definition synth_computer_keyboard.cpp:16
SynthComputerKeyboard()=delete
Deleted default constructor to ensure that a SoundEngine and MidiKeyboardState are provided.
Core class responsible for handling note events, oversampling, and the main effects chain.
Definition sound_engine.h:33
Manages a keyboard layout mapping for a computer keyboard used as a MIDI input device.
Definition synth_types.h:134
Contains classes and functions used within the Vital synthesizer framework.