mirror of
https://codeberg.org/armin/monostep.git
synced 2026-09-01 04:10:46 +02:00
MonoStep: monophonic 2-oscillator step-sequencer synth
This commit is contained in:
commit
e52e5cb161
14 changed files with 2674 additions and 0 deletions
67
Source/ui/SequencerMatrix.h
Normal file
67
Source/ui/SequencerMatrix.h
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
#pragma once
|
||||
|
||||
#include <JuceHeader.h>
|
||||
|
||||
class MonoStepAudioProcessor;
|
||||
|
||||
class SequencerMatrix final : public juce::Component
|
||||
{
|
||||
public:
|
||||
explicit SequencerMatrix (MonoStepAudioProcessor& processor);
|
||||
~SequencerMatrix() override = default;
|
||||
|
||||
std::function<void (int stepIdx)> onStepSelected;
|
||||
std::function<void (int stepIdx, bool gate)> onGateChanged;
|
||||
std::function<void (int stepIdx, int semitone)> onNoteChanged;
|
||||
std::function<void (int stepIdx, float cents)> onFineChanged;
|
||||
std::function<void (int stepIdx, bool slide)> onSlideChanged;
|
||||
|
||||
void setSelectedStep (int stepIdx);
|
||||
int getSelectedStep() const { return selectedStep; }
|
||||
|
||||
void setPlayPosition (int stepIdx);
|
||||
|
||||
void paint (juce::Graphics&) override;
|
||||
void mouseDown (const juce::MouseEvent&) override;
|
||||
void mouseDrag (const juce::MouseEvent&) override;
|
||||
void mouseUp (const juce::MouseEvent&) override;
|
||||
|
||||
private:
|
||||
struct CellRect
|
||||
{
|
||||
int step;
|
||||
int row;
|
||||
bool hit;
|
||||
};
|
||||
|
||||
CellRect cellAt (const juce::MouseEvent&) const;
|
||||
juce::Rectangle<int> matrixBounds() const;
|
||||
int rowForSemitone (int semitone) const;
|
||||
int semitoneForRow (int row) const;
|
||||
|
||||
MonoStepAudioProcessor& processor;
|
||||
|
||||
float cellW = 24.0f;
|
||||
float cellH = 17.0f;
|
||||
float labelW = 40.0f;
|
||||
float headerH = 24.0f;
|
||||
float headerPad = 10.0f;
|
||||
|
||||
int selectedStep = 0;
|
||||
int playPos = -1;
|
||||
|
||||
bool dragging = false;
|
||||
bool startedActive = false;
|
||||
bool moved = false;
|
||||
int lastRow = 0;
|
||||
int dragStep = 0;
|
||||
|
||||
bool fineDragging = false;
|
||||
int fineRefRow = 0;
|
||||
float fineStartCents = 0.0f;
|
||||
float fineLastCents = -1000.0f;
|
||||
|
||||
bool slideDragging = false;
|
||||
bool startedSlideActive = false;
|
||||
int slideLastStep = -1;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue