Follow-up Comment #1, bug #50661 (project denemo): This script sets up a UK keyboard to act as a MIDI simulator:
;;;;;;;SimulateMidi keys a, w etc respond like a piano keyboard with notes from Middle C to G in the next octave. US keyboards need the top few names adjusting, other keyboards even more. (define-once SimulateMidi::active #f) (if SimulateMidi::active (begin (set! SimulateMidi::active #f) (d-InfoDialog (_ "MIDI simulator end"))) (begin (d-InputFilterNames "Simulated MIDI Filter") (let loop () (define key (d-GetKeypress)) (cond ((equal? key "a") (d-PutMidi #xFF3C90)) ((equal? key "w") (d-PutMidi #xFF3D90)) ((equal? key "s") (d-PutMidi #xFF3E90)) ((equal? key "e") (d-PutMidi #xFF3F90)) ((equal? key "d") (d-PutMidi #xFF4090)) ((equal? key "f") (d-PutMidi #xFF4190));f ((equal? key "t") (d-PutMidi #xFF4290)) ((equal? key "g") (d-PutMidi #xFF4390)) ((equal? key "y") (d-PutMidi #xFF4490)) ((equal? key "h") (d-PutMidi #xFF4590)) ((equal? key "u") (d-PutMidi #xFF4690)) ((equal? key "j") (d-PutMidi #xFF4790));b ((equal? key "k") (d-PutMidi #xFF4890)) ((equal? key "o") (d-PutMidi #xFF4990)) ((equal? key "l") (d-PutMidi #xFF4A90)) ((equal? key "p") (d-PutMidi #xFF4B90)) ((equal? key "semicolon") (d-PutMidi #xFF4C90)) ((equal? key "apostrophe") (d-PutMidi #xFF4D90)) ((equal? key "bracketright") (d-PutMidi #xFF4E90)) ((equal? key "numbersign") (d-PutMidi #xFF4F90)) ) (if (not (equal? key "Escape")) (loop))) (set! SimulateMidi::active #f) (d-InputFilterNames "No MIDI Filter") (TimedNotice (_ "MIDI simulator end")))) ;;;;;;;;end of script The script ends the simulated MIDI when Escape is pressed. Other keys are ignored. It would be nice to have other keys passed back to be actioned (e.g. arrow keys for correcting notes ...) This would require a new functionality in C. The procedure (in scheme-callbacks.c) could take a parameter to say put back the last event. Here is the current code: SCM scheme_get_keypress (void) { GdkEventKey event; gboolean success = intercept_scorearea_keypress (&event); if (success) { gchar *str = dnm_accelerator_name (event.keyval, event.state); SCM scm = scm_from_locale_string (str); g_free (str); return scm; } else return SCM_BOOL (FALSE); } event would need to be static and calling with #f as parameter could lookup the command for the event lookup_command_for_keyevent (&event) and then execute the command, if any. _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?50661> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Denemo-devel mailing list Denemo-devel@gnu.org https://lists.gnu.org/mailman/listinfo/denemo-devel