21 lines
645 B
C
21 lines
645 B
C
#pragma once
|
|
#include "ui/ui_core.h"
|
|
#include "midi/midi.h"
|
|
|
|
#define PIANO_FIRST_NOTE 21 // A0
|
|
#define PIANO_LAST_NOTE 108 // C8
|
|
|
|
typedef struct UI_PianoState {
|
|
S32 mouse_note; // MIDI note held by mouse click (-1 = none)
|
|
} UI_PianoState;
|
|
|
|
B32 piano_is_black_key(S32 note);
|
|
Clay_Color piano_velocity_color(S32 velocity);
|
|
|
|
// Render the 88-key piano widget.
|
|
// avail_w: total width for key layout, avail_h: total height for keys
|
|
void ui_piano(UI_PianoState *state, MidiEngine *midi, F32 avail_w, F32 avail_h);
|
|
|
|
// Update piano mouse input (call after Clay layout is computed)
|
|
void ui_piano_update_input(UI_PianoState *state);
|