Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
musical_typing.hpp File Reference

Computer-keyboard "musical typing" — maps the QWERTY row to MIDI notes so a plugin/standalone editor can be played from the keyboard without a MIDI device. More...

#include <pulp/view/input_events.hpp>
#include <algorithm>
#include <functional>
#include <unordered_map>

Go to the source code of this file.

Classes

class  pulp::view::MusicalTypingController

Namespaces

namespace  pulp
namespace  pulp::view
 Hover-cursor tracking for platform window hosts.

Detailed Description

Computer-keyboard "musical typing" — maps the QWERTY row to MIDI notes so a plugin/standalone editor can be played from the keyboard without a MIDI device.

This is the reusable, platform-agnostic CORE: an editor feeds it raw key up/down events (from whatever the host delivers) and it emits note on/off.

The row is "awsedftgyhujkolp" — the layout DAWs and plugin hosts have converged on, so a player's muscle memory carries over. It lays a piano keyboard over the home + top rows: the home row is the white keys, the row above it the black keys, positioned where they sit on a real keyboard. a=C w=C# s=D e=D# d=E f=F t=F# g=G y=G# h=A u=A# j=B k=C(+12) o=C# l=D p=D# z / x shift the base octave down / up.

Behavioural contract:

  • Rejects Cmd/Ctrl/Alt/Meta chords so host menu shortcuts (Cmd+S …) still work — handle_key returns false for them and for unmapped keys, so the caller falls through to the host.
  • De-dups OS key auto-repeat (a held key only sounds once).
  • Tracks which note each KEY produced, so an octave shift mid-hold still releases the right note; all_notes_off() releases everything (call it on focus loss / capture disable to avoid stuck notes).
  • No platform / focus / threading concerns live here — the host delivers keys, the callbacks hand notes to wherever (e.g. a lock-free UI->audio note queue). UI-thread use.